public void Delete(bool cleanupAll,VMContext context)
{
if (cleanupAll)
{
MultitileGroup.Delete(context);
}
else
{
var threads = SoundThreads;
for (int i = 0; i < threads.Count; i++)
{
threads[i].Sound.RemoveOwner(ObjectID);
}
threads.Clear();
PrePositionChange(context);
context.RemoveObjectInstance(this);
MultitileGroup.RemoveObject(this); //we're no longer part of the multitile group
int slots = TotalSlots();
for (int i = 0; i < slots; i++)
{
var obj = GetSlot(i);
if (obj != null)
{
obj.SetPosition(Position,obj.Direction,context);
}
}
}
}