Ejemplo n.º 1
0
        public static void Enter(Caravan caravan, Map map, Func <Pawn, IntVec3> spawnCellGetter, CaravanDropInventoryMode dropInventoryMode = CaravanDropInventoryMode.DoNotDrop, bool draftColonists = false)
        {
            tmpPawns.Clear();
            tmpPawns.AddRange(caravan.PawnsListForReading);
            for (int i = 0; i < tmpPawns.Count; i++)
            {
                IntVec3 loc = spawnCellGetter(tmpPawns[i]);
                GenSpawn.Spawn(tmpPawns[i], loc, map, Rot4.Random);
            }
            switch (dropInventoryMode)
            {
            case CaravanDropInventoryMode.DropInstantly:
                DropAllInventory(tmpPawns);
                break;

            case CaravanDropInventoryMode.UnloadIndividually:
            {
                for (int j = 0; j < tmpPawns.Count; j++)
                {
                    tmpPawns[j].inventory.UnloadEverything = true;
                }
                break;
            }
            }
            if (draftColonists)
            {
                DraftColonists(tmpPawns);
            }
            if (map.IsPlayerHome)
            {
                for (int k = 0; k < tmpPawns.Count; k++)
                {
                    if (tmpPawns[k].IsPrisoner)
                    {
                        tmpPawns[k].guest.WaitInsteadOfEscapingForDefaultTicks();
                    }
                }
            }
            caravan.RemoveAllPawns();
            if (!caravan.Destroyed)
            {
                caravan.Destroy();
            }
            tmpPawns.Clear();
        }
 public static void Enter(Caravan caravan, Map map, Func <Pawn, IntVec3> spawnCellGetter, CaravanDropInventoryMode dropInventoryMode = CaravanDropInventoryMode.DoNotDrop, bool draftColonists = false)
 {
     CaravanEnterMapUtility.tmpPawns.Clear();
     CaravanEnterMapUtility.tmpPawns.AddRange(caravan.PawnsListForReading);
     for (int i = 0; i < CaravanEnterMapUtility.tmpPawns.Count; i++)
     {
         IntVec3 loc = spawnCellGetter(CaravanEnterMapUtility.tmpPawns[i]);
         GenSpawn.Spawn(CaravanEnterMapUtility.tmpPawns[i], loc, map, Rot4.Random, WipeMode.Vanish, false);
     }
     if (dropInventoryMode == CaravanDropInventoryMode.DropInstantly)
     {
         CaravanEnterMapUtility.DropAllInventory(CaravanEnterMapUtility.tmpPawns);
     }
     else if (dropInventoryMode == CaravanDropInventoryMode.UnloadIndividually)
     {
         for (int j = 0; j < CaravanEnterMapUtility.tmpPawns.Count; j++)
         {
             CaravanEnterMapUtility.tmpPawns[j].inventory.UnloadEverything = true;
         }
     }
     if (draftColonists)
     {
         CaravanEnterMapUtility.DraftColonists(CaravanEnterMapUtility.tmpPawns);
     }
     if (map.IsPlayerHome)
     {
         for (int k = 0; k < CaravanEnterMapUtility.tmpPawns.Count; k++)
         {
             if (CaravanEnterMapUtility.tmpPawns[k].IsPrisoner)
             {
                 CaravanEnterMapUtility.tmpPawns[k].guest.WaitInsteadOfEscapingForDefaultTicks();
             }
         }
     }
     caravan.RemoveAllPawns();
     if (caravan.Spawned)
     {
         Find.WorldObjects.Remove(caravan);
     }
     CaravanEnterMapUtility.tmpPawns.Clear();
 }