private void TransferHopperItems(Building_PocketDimensionEntranceBase otherSide)
 {
     for (int i = 0; i < AdjCellsCardinalInBounds.Count; i++)
     {
         Building_Storage hopper    = null;
         List <Thing>     thingList = AdjCellsCardinalInBounds[i].GetThingList(base.Map);
         for (int j = 0; j < thingList.Count; j++)
         {
             Thing thing = thingList[j];
             if ((thing.def == ThingDefOf.Hopper || thing.def == PocketDimensionDefOf.CM_PocketDimensionHopper) && thing as MinifiedThing == null)
             {
                 hopper = thing as Building_Storage;
                 SlotGroup slotGroup = hopper.GetSlotGroup();
                 if (slotGroup != null && slotGroup.HeldThings != null)
                 {
                     foreach (Thing thing2 in slotGroup.HeldThings)
                     {
                         if (hopper.Accepts(thing2))
                         {
                             thing2.DeSpawn(DestroyMode.Vanish);
                             GenSpawn.Spawn(thing2, otherSide.InteractionCell, otherSide.Map, WipeMode.Vanish);
                         }
                     }
                 }
                 break;
             }
         }
     }
 }
Пример #2
0
 public void TakeInventory()
 {
     if (!this.initialized)
     {
         this.Initialize();
     }
     this.ClearInventory();
     foreach (Building current in Find.ListerBuildings.allBuildingsColonist)
     {
         this.Count(current);
         Building_Storage building_Storage = current as Building_Storage;
         if (building_Storage != null && building_Storage.GetSlotGroup() != null)
         {
             foreach (Thing current2 in building_Storage.GetSlotGroup().HeldThings)
             {
                 this.Count(current2);
             }
         }
         InventoryResolver inventoryResolver;
         if (this.inventoryResolvers.TryGetValue(current.def.defName, out inventoryResolver))
         {
             List <InventoryCount> inventoryCounts = inventoryResolver.GetInventoryCounts(current, this.state.prefs);
             if (inventoryCounts != null)
             {
                 foreach (InventoryCount current3 in inventoryCounts)
                 {
                     this.Count(current3);
                 }
             }
         }
     }
     using (List <Zone> .Enumerator enumerator4 = Find.ZoneManager.AllZones.FindAll((Zone zone) => zone is Zone_Stockpile).GetEnumerator())
     {
         while (enumerator4.MoveNext())
         {
             Zone_Stockpile zone_Stockpile = (Zone_Stockpile)enumerator4.Current;
             if (zone_Stockpile.GetSlotGroup() != null)
             {
                 foreach (Thing current4 in zone_Stockpile.GetSlotGroup().HeldThings)
                 {
                     this.Count(current4);
                 }
             }
         }
     }
     foreach (Pawn current5 in Find.ListerPawns.FreeColonists)
     {
         if (current5.equipment != null)
         {
             foreach (Thing current6 in current5.equipment.AllEquipment)
             {
                 this.Count(current6);
             }
         }
         if (current5.apparel != null)
         {
             foreach (Thing current7 in current5.apparel.WornApparel)
             {
                 this.Count(current7);
             }
         }
         if (current5.inventory != null && current5.inventory.container != null)
         {
             ThingContainer container = current5.inventory.container;
             int            count     = container.Count;
             for (int i = 0; i < count; i++)
             {
                 this.Count(container[i]);
             }
         }
     }
 }