fix: Optimizes FindItemsByType by removing allocations. (#1515)
### Summary Container enumeration is in dire need of optimization. Thanks to @stefanomerotta for initiating this work with PR #1443. This PR handles a small part of what Stefan started. Also included are some bug fixes. ### Method Signatures ```cs // Use with foreach without moving/deleting items FindItemsByTypeEnumerator<T> FindItemsByType<T>(bool recurse = true, Predicate<T> predicate = null) // Use with foreach when moving/deleting items QueuedItemsEnumerator<T> EnumerateItemsByType<T>(bool recurse = true, Predicate<T> predicate = null) // Use when iterating multiple times or queuing PooledRefQueue<T> QueueItemsByType<T>(bool recurse = true, Predicate<T> predicate = null) // Use when iterating multiples times or manipulating elements without traversing PooledRefList<T> ListItemsByType<T>(bool recurse = true, Predicate<T> predicate = null) ``` * `FindItemsByType<T>` has changed from returning `List<T>` to `FindItemsByTypeEnumerator<T>` - This method is not safe to use in situations where an item may get consumed, deleted, or moved. * `EnumerateItemsByType<T>` was added as a safe way to iterate and manipulate items. * **Note**: EnumerateItemsByType will _completely traverse the container_ before iteration starts because it uses `QueueItemsByType` under the hood. * `QueueItemsByType<T>` and `ListItemsByType<T>` was added to return a queue or list of items to iterate multiple times and manipulate the items. This isn't the most efficient since it uses a predicate and can result in 2 or 3 total iterations unnecessarily. ### Bug Fixes - [X] Fishing had an error in the random check that may have caused slight bias.
This commit is contained in:
parent
146abad36e
commit
a4cabe2fa4
23 changed files with 655 additions and 390 deletions
|
|
@ -1737,23 +1737,20 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
var hadBomb = false;
|
||||
|
||||
corpse.FindItemsByType<BRBomb>(false)
|
||||
.ForEach(
|
||||
bomb =>
|
||||
{
|
||||
hadBomb = true;
|
||||
bomb.DropTo(mob, killer);
|
||||
}
|
||||
);
|
||||
foreach (var bomb in corpse.EnumerateItemsByType<BRBomb>(false))
|
||||
{
|
||||
hadBomb = true;
|
||||
bomb.DropTo(mob, killer);
|
||||
}
|
||||
|
||||
mob.Backpack?.FindItemsByType<BRBomb>(false)
|
||||
.ForEach(
|
||||
bomb =>
|
||||
{
|
||||
hadBomb = true;
|
||||
bomb.DropTo(mob, killer);
|
||||
}
|
||||
);
|
||||
if (mob.Backpack != null)
|
||||
{
|
||||
foreach (var bomb in mob.Backpack.EnumerateItemsByType<BRBomb>(false))
|
||||
{
|
||||
hadBomb = true;
|
||||
bomb.DropTo(mob, killer);
|
||||
}
|
||||
}
|
||||
|
||||
if (killer?.Player == true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1018,23 +1018,20 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
var hadFlag = false;
|
||||
|
||||
corpse.FindItemsByType<CTFFlag>(false)
|
||||
.ForEach(
|
||||
flag =>
|
||||
{
|
||||
hadFlag = true;
|
||||
flag.DropTo(mob, killer);
|
||||
}
|
||||
);
|
||||
foreach (var flag in corpse.EnumerateItemsByType<CTFFlag>(false))
|
||||
{
|
||||
hadFlag = true;
|
||||
flag.DropTo(mob, killer);
|
||||
}
|
||||
|
||||
mob.Backpack?.FindItemsByType<CTFFlag>(false)
|
||||
.ForEach(
|
||||
flag =>
|
||||
{
|
||||
hadFlag = true;
|
||||
flag.DropTo(mob, killer);
|
||||
}
|
||||
);
|
||||
if (mob.Backpack != null)
|
||||
{
|
||||
foreach (var flag in mob.Backpack.EnumerateItemsByType<CTFFlag>(false))
|
||||
{
|
||||
hadFlag = true;
|
||||
flag.DropTo(mob, killer);
|
||||
}
|
||||
}
|
||||
|
||||
if (killer?.Player == true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -141,11 +141,12 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (from.Backpack != null)
|
||||
{
|
||||
var items = from.Backpack.FindItemsByType(resourceType);
|
||||
|
||||
for (var i = 0; i < items.Count; ++i)
|
||||
foreach (var item in from.Backpack.FindItemsByType())
|
||||
{
|
||||
resourceCount += items[i].Amount;
|
||||
if (resourceType.IsInstanceOfType(item))
|
||||
{
|
||||
resourceCount += item.Amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -185,11 +186,12 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (from.Backpack != null)
|
||||
{
|
||||
var items = from.Backpack.FindItemsByType(resourceType);
|
||||
|
||||
for (var i = 0; i < items.Count; ++i)
|
||||
foreach (var item in from.Backpack.FindItemsByType())
|
||||
{
|
||||
resourceCount += items[i].Amount;
|
||||
if (resourceType.IsInstanceOfType(item))
|
||||
{
|
||||
resourceCount += item.Amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -263,11 +265,13 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (from.Backpack != null)
|
||||
{
|
||||
var items = from.Backpack.FindItemsByType(subResource.ItemType);
|
||||
|
||||
for (var j = 0; j < items.Count; ++j)
|
||||
var type = subResource.ItemType;
|
||||
foreach (var item in from.Backpack.FindItemsByType())
|
||||
{
|
||||
resourceCount += items[j].Amount;
|
||||
if (type.IsInstanceOfType(item))
|
||||
{
|
||||
resourceCount += item.Amount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -685,7 +685,14 @@ namespace Server.Engines.Craft
|
|||
if (NameNumber == 1041267)
|
||||
{
|
||||
// Runebooks are a special case, they need a blank recall rune
|
||||
consumeExtra = ourPack.FindItemsByType<RecallRune>().Find(rune => !rune.Marked);
|
||||
foreach (var rune in ourPack.FindItemsByType<RecallRune>())
|
||||
{
|
||||
if (!rune.Marked)
|
||||
{
|
||||
consumeExtra = rune;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (consumeExtra == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -385,7 +385,14 @@ namespace Server.Factions
|
|||
|
||||
// Ordinarily, through normal faction removal, this will never find any sigils.
|
||||
// Only with a leave delay less than the ReturnPeriod or a Faction Kick/Ban, will this ever do anything
|
||||
mob.Backpack?.FindItemsByType<Sigil>().ForEach(sigil => sigil.ReturnHome());
|
||||
|
||||
if (mob.Backpack != null)
|
||||
{
|
||||
foreach (var sigil in mob.Backpack.EnumerateItemsByType<Sigil>())
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
}
|
||||
}
|
||||
|
||||
if (pl.RankIndex != -1)
|
||||
{
|
||||
|
|
@ -1039,35 +1046,36 @@ namespace Server.Factions
|
|||
|
||||
var killerState = PlayerState.Find(killer);
|
||||
var killerPack = killer?.Backpack;
|
||||
victim.Backpack?.FindItemsByType<Sigil>()
|
||||
.ForEach(
|
||||
sigil =>
|
||||
{
|
||||
if (killerState == null || killerPack == null)
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
return;
|
||||
}
|
||||
|
||||
if (killer?.GetDistanceToSqrt(victim) > 64)
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
killer.SendLocalizedMessage(1042230); // The sigil has gone back to its home location.
|
||||
}
|
||||
else if (Sigil.ExistsOn(killer))
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
// The sigil has gone back to its home location because you already have a sigil.
|
||||
killer?.SendLocalizedMessage(1010258);
|
||||
}
|
||||
else if (!killerPack.TryDropItem(killer, sigil, false))
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
// The sigil has gone home because your backpack is full.
|
||||
killer?.SendLocalizedMessage(1010259);
|
||||
}
|
||||
if (victim.Backpack != null)
|
||||
{
|
||||
foreach (var sigil in victim.Backpack.EnumerateItemsByType<Sigil>())
|
||||
{
|
||||
if (killerState == null || killerPack == null)
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
continue;
|
||||
}
|
||||
);
|
||||
|
||||
if (killer?.GetDistanceToSqrt(victim) > 64)
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
killer.SendLocalizedMessage(1042230); // The sigil has gone back to its home location.
|
||||
}
|
||||
else if (Sigil.ExistsOn(killer))
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
// The sigil has gone back to its home location because you already have a sigil.
|
||||
killer?.SendLocalizedMessage(1010258);
|
||||
}
|
||||
else if (!killerPack.TryDropItem(killer, sigil, false))
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
// The sigil has gone home because your backpack is full.
|
||||
killer?.SendLocalizedMessage(1010259);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (killerState == null)
|
||||
{
|
||||
|
|
@ -1227,7 +1235,13 @@ namespace Server.Factions
|
|||
|
||||
private static void EventSink_Logout(Mobile m)
|
||||
{
|
||||
m.Backpack?.FindItemsByType<Sigil>().ForEach(sigil => sigil.ReturnHome());
|
||||
if (m.Backpack != null)
|
||||
{
|
||||
foreach (var sigil in m.Backpack.EnumerateItemsByType<Sigil>())
|
||||
{
|
||||
sigil.ReturnHome();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void EventSink_Login(Mobile m) => CheckLeaveTimer(m);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Factions.AI;
|
||||
using Server.Items;
|
||||
using Server.Mobiles;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Quests;
|
||||
using Server.Engines.Quests.Collector;
|
||||
using Server.Items;
|
||||
|
|
@ -46,6 +45,27 @@ namespace Server.Engines.Harvest
|
|||
0x34B5, 0x35D5
|
||||
};
|
||||
|
||||
private static readonly int[] bodyParts = {
|
||||
0x1CDD, 0x1CE5, // arm
|
||||
0x1CE0, 0x1CE8, // torso
|
||||
0x1CE1, 0x1CE9, // head
|
||||
0x1CE2, 0x1CEC // leg
|
||||
};
|
||||
|
||||
private static readonly int[] boneParts = {
|
||||
0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4, // skulls
|
||||
0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles
|
||||
0x1B15, 0x1B16 // pelvis bones
|
||||
};
|
||||
|
||||
private static readonly int[] miscItems = {
|
||||
0x1EB5, // unfinished barrel
|
||||
0xA2A, // stool
|
||||
0xC1F, // broken clock
|
||||
0x1047, 0x1048, // globe
|
||||
0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4 // barrel staves
|
||||
};
|
||||
|
||||
private Fishing()
|
||||
{
|
||||
var fish = new HarvestDefinition
|
||||
|
|
@ -101,7 +121,7 @@ namespace Server.Engines.Harvest
|
|||
Definitions = new[] { fish };
|
||||
}
|
||||
|
||||
public static Fishing System => _system ?? (_system = new Fishing());
|
||||
public static Fishing System => _system ??= new Fishing();
|
||||
|
||||
public override void OnConcurrentHarvest(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
|
||||
{
|
||||
|
|
@ -179,12 +199,8 @@ namespace Server.Engines.Harvest
|
|||
|
||||
if (pack != null)
|
||||
{
|
||||
List<SOS> messages = pack.FindItemsByType<SOS>();
|
||||
|
||||
for (int i = 0; i < messages.Count; ++i)
|
||||
foreach (var sos in pack.FindItemsByType<SOS>())
|
||||
{
|
||||
SOS sos = messages[i];
|
||||
|
||||
if ((from.Map == Map.Felucca || from.Map == Map.Trammel) && from.InRange(sos.TargetLocation, 60))
|
||||
{
|
||||
return true;
|
||||
|
|
@ -222,12 +238,9 @@ namespace Server.Engines.Harvest
|
|||
|
||||
if (pack != null)
|
||||
{
|
||||
var messages = pack.FindItemsByType<SOS>();
|
||||
|
||||
for (var i = 0; i < messages.Count; ++i)
|
||||
// We don't have to queue since we are returning on the first SOS.
|
||||
foreach (var sos in pack.FindItemsByType<SOS>())
|
||||
{
|
||||
var sos = messages[i];
|
||||
|
||||
if ((from.Map == Map.Felucca || from.Map == Map.Trammel) && from.InRange(sos.TargetLocation, 60))
|
||||
{
|
||||
Item preLoot = null;
|
||||
|
|
@ -236,27 +249,12 @@ namespace Server.Engines.Harvest
|
|||
{
|
||||
case 0: // Body parts
|
||||
{
|
||||
int[] list =
|
||||
{
|
||||
0x1CDD, 0x1CE5, // arm
|
||||
0x1CE0, 0x1CE8, // torso
|
||||
0x1CE1, 0x1CE9, // head
|
||||
0x1CE2, 0x1CEC // leg
|
||||
};
|
||||
|
||||
preLoot = new ShipwreckedItem(list.RandomElement());
|
||||
preLoot = new ShipwreckedItem(bodyParts.RandomElement());
|
||||
break;
|
||||
}
|
||||
case 1: // Bone parts
|
||||
{
|
||||
int[] list =
|
||||
{
|
||||
0x1AE0, 0x1AE1, 0x1AE2, 0x1AE3, 0x1AE4, // skulls
|
||||
0x1B09, 0x1B0A, 0x1B0B, 0x1B0C, 0x1B0D, 0x1B0E, 0x1B0F, 0x1B10, // bone piles
|
||||
0x1B15, 0x1B16 // pelvis bones
|
||||
};
|
||||
|
||||
preLoot = new ShipwreckedItem(list.RandomElement());
|
||||
preLoot = new ShipwreckedItem(boneParts.RandomElement());
|
||||
break;
|
||||
}
|
||||
case 2: // Paintings and portraits
|
||||
|
|
@ -276,36 +274,16 @@ namespace Server.Engines.Harvest
|
|||
}
|
||||
case 5: // Hats
|
||||
{
|
||||
if (Utility.RandomBool())
|
||||
{
|
||||
preLoot = new SkullCap();
|
||||
}
|
||||
else
|
||||
{
|
||||
preLoot = new TricorneHat();
|
||||
}
|
||||
|
||||
preLoot = Utility.RandomBool() ? new SkullCap() : new TricorneHat();
|
||||
break;
|
||||
}
|
||||
case 6: // Misc
|
||||
{
|
||||
int[] list =
|
||||
{
|
||||
0x1EB5, // unfinished barrel
|
||||
0xA2A, // stool
|
||||
0xC1F, // broken clock
|
||||
0x1047, 0x1048, // globe
|
||||
0x1EB1, 0x1EB2, 0x1EB3, 0x1EB4 // barrel staves
|
||||
};
|
||||
var rand = Utility.Random(miscItems.Length + 1);
|
||||
|
||||
if (Utility.Random(list.Length + 1) == 0)
|
||||
{
|
||||
preLoot = new Candelabra();
|
||||
}
|
||||
else
|
||||
{
|
||||
preLoot = new ShipwreckedItem(list.RandomElement());
|
||||
}
|
||||
preLoot = rand == miscItems.Length
|
||||
? new Candelabra()
|
||||
: new ShipwreckedItem(miscItems[rand]);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -317,16 +295,7 @@ namespace Server.Engines.Harvest
|
|||
return preLoot;
|
||||
}
|
||||
|
||||
LockableContainer chest;
|
||||
|
||||
if (Utility.RandomBool())
|
||||
{
|
||||
chest = new MetalGoldenChest();
|
||||
}
|
||||
else
|
||||
{
|
||||
chest = new WoodenChest();
|
||||
}
|
||||
LockableContainer chest = Utility.RandomBool() ? new MetalGoldenChest() : new WoodenChest();
|
||||
|
||||
if (sos.IsAncient)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using Server.Gumps;
|
||||
|
||||
namespace Server.Engines.MLQuests.Objectives
|
||||
|
|
@ -110,8 +109,16 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
return 0;
|
||||
}
|
||||
|
||||
var items = pack.FindItemsByType(Objective.AcceptedType, false); // Note: subclasses are included
|
||||
return items.Where(item => item.QuestItem && Objective.CheckItem(item)).Sum(item => item.Amount);
|
||||
var total = 0;
|
||||
foreach (var item in pack.FindItemsByType(false))
|
||||
{
|
||||
if (ClaimTypePredicate(item) && item.QuestItem && Objective.CheckItem(item))
|
||||
{
|
||||
total += item.Amount;
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public override bool AllowsQuestItem(Item item, Type type) => Objective.CheckType(type) && Objective.CheckItem(item);
|
||||
|
|
@ -128,19 +135,20 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
return;
|
||||
}
|
||||
|
||||
var checkType = Objective.AcceptedType;
|
||||
var items = pack.FindItemsByType(checkType, false);
|
||||
|
||||
foreach (var item in items)
|
||||
foreach (var item in pack.FindItemsByType(false))
|
||||
{
|
||||
if (item.QuestItem && !MLQuestSystem.CanMarkQuestItem(pm, item, checkType)
|
||||
) // does another quest still need this item? (OSI just unmarks everything)
|
||||
// does another quest still need this item? (OSI just unmarks everything)
|
||||
if (ClaimTypePredicate(item) &&
|
||||
item.QuestItem && !MLQuestSystem.CanMarkQuestItem(pm, item, Objective.AcceptedType))
|
||||
{
|
||||
item.QuestItem = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Note: subclasses are included
|
||||
private bool ClaimTypePredicate(Item item) => Objective.AcceptedType.IsInstanceOfType(item);
|
||||
|
||||
// Should only be called after IsComplete() is checked to be true
|
||||
public override void OnClaimReward()
|
||||
{
|
||||
|
|
@ -153,10 +161,9 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
|
||||
// TODO: OSI also counts the item in the cursor?
|
||||
|
||||
var items = pack.FindItemsByType(Objective.AcceptedType, false);
|
||||
var left = Objective.DesiredAmount;
|
||||
|
||||
foreach (var item in items)
|
||||
foreach (var item in pack.EnumerateItemsByType<Item>(false, ClaimTypePredicate))
|
||||
{
|
||||
if (item.QuestItem && Objective.CheckItem(item))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Logging;
|
||||
|
|
@ -150,8 +149,16 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
return 0;
|
||||
}
|
||||
|
||||
var items = pack.FindItemsByType(Objective.Delivery, false); // Note: subclasses are included
|
||||
return items.Sum(item => item.Amount);
|
||||
var total = 0;
|
||||
foreach (var item in pack.FindItemsByType(false))
|
||||
{
|
||||
if (ClaimTypePredicate(item))
|
||||
{
|
||||
total += item.Amount;
|
||||
}
|
||||
}
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
public override bool OnBeforeClaimReward()
|
||||
|
|
@ -171,6 +178,9 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
return true;
|
||||
}
|
||||
|
||||
// Note: subclasses are included
|
||||
private bool ClaimTypePredicate(Item item) => Objective.Delivery.IsInstanceOfType(item);
|
||||
|
||||
// TODO: This is VERY similar to CollectObjective.OnClaimReward
|
||||
public override void OnClaimReward()
|
||||
{
|
||||
|
|
@ -181,10 +191,9 @@ namespace Server.Engines.MLQuests.Objectives
|
|||
return;
|
||||
}
|
||||
|
||||
var items = pack.FindItemsByType(Objective.Delivery, false);
|
||||
var left = Objective.Amount;
|
||||
|
||||
foreach (var item in items)
|
||||
foreach (var item in pack.EnumerateItemsByType<Item>(false, ClaimTypePredicate))
|
||||
{
|
||||
if (left == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -327,11 +327,16 @@ namespace Server.Engines.Plants
|
|||
}
|
||||
case 6: // Water
|
||||
{
|
||||
var bev = from.Backpack.FindItemsByType<BaseBeverage>()
|
||||
.Find(
|
||||
beverage =>
|
||||
beverage.IsEmpty && beverage.Pourable && beverage.Content == BeverageType.Water
|
||||
);
|
||||
BaseBeverage bev = null;
|
||||
|
||||
foreach (var beverage in from.Backpack.FindItemsByType<BaseBeverage>())
|
||||
{
|
||||
if (beverage.IsEmpty && beverage.Pourable && beverage.Content == BeverageType.Water)
|
||||
{
|
||||
bev = beverage;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (bev == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Items;
|
||||
using Server.Misc;
|
||||
|
||||
namespace Server.Engines.Plants
|
||||
|
|
@ -402,28 +403,29 @@ namespace Server.Engines.Plants
|
|||
|
||||
private static void EventSink_Login(Mobile from)
|
||||
{
|
||||
from.Backpack?.FindItemsByType<PlantItem>()
|
||||
.ForEach(
|
||||
plant =>
|
||||
Container cont = from.Backpack;
|
||||
if (cont != null)
|
||||
{
|
||||
foreach (var plant in cont.FindItemsByType<PlantItem>())
|
||||
{
|
||||
if (plant.IsGrowable)
|
||||
{
|
||||
if (plant.IsGrowable)
|
||||
{
|
||||
plant.PlantSystem.DoGrowthCheck();
|
||||
}
|
||||
plant.PlantSystem.DoGrowthCheck();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
from.FindBankNoCreate()
|
||||
?.FindItemsByType<PlantItem>()
|
||||
.ForEach(
|
||||
plant =>
|
||||
cont = from.FindBankNoCreate();
|
||||
if (cont != null)
|
||||
{
|
||||
foreach (var plant in cont.FindItemsByType<PlantItem>())
|
||||
{
|
||||
if (plant.IsGrowable)
|
||||
{
|
||||
if (plant.IsGrowable)
|
||||
{
|
||||
plant.PlantSystem.DoGrowthCheck();
|
||||
}
|
||||
plant.PlantSystem.DoGrowthCheck();
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GrowAll()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue