예제 #1
0
 private void AddItemsFromTransferablesToRandomInventories(List <Pawn> pawns)
 {
     transferables.RemoveAll((TransferableOneWay x) => x.AnyThing is Pawn);
     if (ListPlayerPawnsInventorySeparately)
     {
         for (int i = 0; i < pawns.Count; i++)
         {
             if (CanListInventorySeparately(pawns[i]))
             {
                 ThingOwner <Thing> innerContainer = pawns[i].inventory.innerContainer;
                 for (int num = innerContainer.Count - 1; num >= 0; num--)
                 {
                     RemoveCarriedItemFromTransferablesOrDrop(innerContainer[num], pawns[i], transferables);
                 }
             }
         }
         for (int j = 0; j < transferables.Count; j++)
         {
             if (transferables[j].things.Any((Thing x) => !x.Spawned))
             {
                 transferables[j].things.SortBy((Thing x) => x.Spawned);
             }
         }
     }
     for (int k = 0; k < transferables.Count; k++)
     {
         if (!(transferables[k].AnyThing is Corpse))
         {
             TransferableUtility.Transfer(transferables[k].things, transferables[k].CountToTransfer, delegate(Thing splitPiece, IThingHolder originalHolder)
             {
                 Thing item2 = splitPiece.TryMakeMinified();
                 CaravanInventoryUtility.FindPawnToMoveInventoryTo(item2, pawns, null).inventory.innerContainer.TryAdd(item2);
             });
         }
     }
     for (int l = 0; l < transferables.Count; l++)
     {
         if (!(transferables[l].AnyThing is Corpse))
         {
             continue;
         }
         TransferableUtility.TransferNoSplit(transferables[l].things, transferables[l].CountToTransfer, delegate(Thing originalThing, int numToTake)
         {
             if (AutoStripSpawnedCorpses)
             {
                 Corpse corpse = originalThing as Corpse;
                 if (corpse != null && corpse.Spawned)
                 {
                     corpse.Strip();
                 }
             }
             Thing item = originalThing.SplitOff(numToTake);
             CaravanInventoryUtility.FindPawnToMoveInventoryTo(item, pawns, null).inventory.innerContainer.TryAdd(item);
         });
     }
 }
        private void LoadInstantly()
        {
            TransporterUtility.InitiateLoading(transporters);
            int i;

            for (i = 0; i < transferables.Count; i++)
            {
                TransferableUtility.Transfer(transferables[i].things, transferables[i].CountToTransfer, delegate(Thing splitPiece, IThingHolder originalThing)
                {
                    transporters[i % transporters.Count].GetDirectlyHeldThings().TryAdd(splitPiece);
                });
            }
        }
예제 #3
0
        private bool DebugTryLoadInstantly()
        {
            this.CreateAndAssignNewTransportersGroup();
            int i;

            for (i = 0; i < this.transferables.Count; i++)
            {
                TransferableUtility.Transfer(this.transferables[i].things, this.transferables[i].CountToTransfer, delegate(Thing splitPiece, IThingHolder originalThing)
                {
                    this.transporters[i % this.transporters.Count].GetDirectlyHeldThings().TryAdd(splitPiece, true);
                });
            }
            return(true);
        }