dragon slayer2
Member
Okay so I decided to check this new system out and I been updating my shard to use it but. I ran into a problem or more less misunderstanding of the system.
Am I doing this correctly?
every time this code runs it autocleans up the spawner before replacing it. I did this to cut down on save times.
What I am wanting to know is did I use the WeakEntityCollection correctly.
thank you in advance
Am I doing this correctly?
Code:
public static void PutSpawner(Spawner s, Point3D loc, Map map)
{
string name = String.Format("MLQS-{0}", s.Name);
// Auto cleanup on regeneration
List<Item> toDelete = new List<Item>();
foreach (Item item in map.GetItemsInRange(loc, 0))
{
if (item is Spawner && item.Name == name)
WeakEntityCollection.Delete("bmquest");
toDelete.Add(item);
}
foreach (Item item in toDelete)
item.Delete();
s.Name = name;
WeakEntityCollection.Add("bmquest", s);
s.MoveToWorld(loc, map);
}
every time this code runs it autocleans up the spawner before replacing it. I did this to cut down on save times.
What I am wanting to know is did I use the WeakEntityCollection correctly.
thank you in advance