コード例 #1
0
 public static void ForceReform(MapParent mapParent)
 {
     if (Dialog_FormCaravan.AllSendablePawns(mapParent.Map, reform: true).Any((Pawn x) => x.IsColonist))
     {
         Messages.Message("MessageYouHaveToReformCaravanNow".Translate(), new GlobalTargetInfo(mapParent.Tile), MessageTypeDefOf.NeutralEvent);
         Current.Game.CurrentMap = mapParent.Map;
         Dialog_FormCaravan window = new Dialog_FormCaravan(mapParent.Map, reform: true, delegate
         {
             if (mapParent.HasMap)
             {
                 mapParent.Destroy();
             }
         }, mapAboutToBeRemoved: true);
         Find.WindowStack.Add(window);
         return;
     }
     tmpPawns.Clear();
     tmpPawns.AddRange(mapParent.Map.mapPawns.AllPawns.Where((Pawn x) => x.Faction == Faction.OfPlayer || x.HostFaction == Faction.OfPlayer));
     if (tmpPawns.Any((Pawn x) => CaravanUtility.IsOwner(x, Faction.OfPlayer)))
     {
         CaravanExitMapUtility.ExitMapAndCreateCaravan(tmpPawns, Faction.OfPlayer, mapParent.Tile, mapParent.Tile, -1);
     }
     tmpPawns.Clear();
     mapParent.Destroy();
 }
コード例 #2
0
        private static void Abandon(MapParent settlement)
        {
            settlement.Destroy();
            Settlement settlement2 = settlement as Settlement;

            if (settlement2 != null)
            {
                AddAbandonedSettlement(settlement2);
            }
            Find.GameEnder.CheckOrUpdateGameOver();
        }
コード例 #3
0
        public static void Settle(Map map)
        {
            MapParent  parent     = map.Parent;
            Settlement settlement = SettleUtility.AddNewHome(map.Tile, Faction.OfPlayer);

            map.info.parent = settlement;
            parent?.Destroy();
            Messages.Message("MessageSettledInExistingMap".Translate(), settlement, MessageTypeDefOf.PositiveEvent, historical: false);
            tmpPlayerPawns.Clear();
            tmpPlayerPawns.AddRange(map.mapPawns.AllPawnsSpawned.Where((Pawn x) => x.Faction == Faction.OfPlayer || x.HostFaction == Faction.OfPlayer));
            CaravanEnterMapUtility.DropAllInventory(tmpPlayerPawns);
            tmpPlayerPawns.Clear();
            List <Pawn> prisonersOfColonySpawned = map.mapPawns.PrisonersOfColonySpawned;

            for (int i = 0; i < prisonersOfColonySpawned.Count; i++)
            {
                prisonersOfColonySpawned[i].guest.WaitInsteadOfEscapingForDefaultTicks();
            }
        }