示例#1
0
        internal void ReclaimApparel(bool force = false)
        {
            if (base.Map == null)
            {
                return;
            }
#if DEBUG
            List <Apparel> ll = new List <Apparel>(BuildingUtil.FindThingsOfTypeNextTo <Apparel>(base.Map, base.Position, 1));
            Log.Warning("Apparel found: " + ll.Count);
#endif
            try
            {
                List <Thing> l = BuildingUtil.FindThingsNextTo(base.Map, base.Position, 1);
                if (l.Count > 0)
                {
                    foreach (Thing t in l)
                    {
                        try
                        {
                            if (t is Apparel)
                            {
                                if (!WorldComp.AddApparel((Apparel)t) &&
                                    force &&
                                    t.Spawned)
                                {
                                    t.DeSpawn();
                                    if (this.forceAddedApparel == null)
                                    {
                                        this.forceAddedApparel = new List <Thing>();
                                    }
                                    this.forceAddedApparel.Add(t);
                                }
                            }
                        }
                        catch
                        {
                            // Ignore
                        }
                    }
                    l.Clear();
                    l = null;
                }
            }
            catch
            {
                // Ignore
            }
        }
示例#2
0
        internal void ReclaimApparel()
        {
#if DEBUG
            List <Apparel> ll = new List <Apparel>(BuildingUtil.FindThingsOfTypeNextTo <Apparel>(base.Map, base.Position, 1));
            Log.Warning("Apparel found: " + ll.Count);
#endif
            List <Thing> l = BuildingUtil.FindThingsNextTo(base.Map, base.Position, 1);
            if (l.Count > 0)
            {
                foreach (Thing t in l)
                {
                    if (t is Apparel)
                    {
                        WorldComp.AddApparel((Apparel)t);
                    }
                }
                l.Clear();
            }
        }