private void Dispose()
        {
            try
            {
                if (this.StoredWeapons != null)
                {
                    foreach (LinkedList <ThingWithComps> l in this.StoredWeapons.Values)
                    {
                        foreach (ThingWithComps t in l)
                        {
                            this.DropThing(t);
                        }
                    }
                    this.StoredWeapons.Clear();
                }
                if (this.StoredBioEncodedWeapons != null)
                {
                    foreach (LinkedList <ThingWithComps> l in this.StoredBioEncodedWeapons.Values)
                    {
                        foreach (ThingWithComps t in l)
                        {
                            this.DropThing(t);
                        }
                    }
                    this.StoredBioEncodedWeapons.Clear();
                }
            }
            catch (Exception e)
            {
                Log.Error(
                    this.GetType().Name + ".Dispose\n" +
                    e.GetType().Name + " " + e.Message + "\n" +
                    e.StackTrace);
            }

            WorldComp.Remove(this);
            foreach (Building_RepairWeaponStorage r in BuildingUtil.FindThingsOfTypeNextTo <Building_RepairWeaponStorage>(base.Map, base.Position, Settings.RepairAttachmentDistance))
            {
#if DEBUG_REPAIR
                Log.Warning("Removing Dresser " + this.Label + " to " + r.Label);
#endif
                r.Remove(this);
            }
        }
Example #2
0
 static void Prefix(MapParent settlement)
 {
     WorldComp.Remove(settlement.Map);
 }