public void UnloadColony(PersistentColony colony)
        {
            DynamicMapUnloader.UnloadColonyMaps(colony);
            Find.ColonistBar.MarkColonistsDirty();

            colony.GameData = null;
        }
示例#2
0
        public void DeleteColony(PersistentColony colony)
        {
            this.ConvertColoniesToAbandonedColonies(colony);

            // TODO: Insert any processes before colony abandonment/deletion.

            this.SaveWorld(true);
        }
示例#3
0
        /// <summary>
        /// Used in conversion/saving of the current colony in-game.
        /// </summary>
        /// <param name="persistentWorld"></param>
        /// <param name="game"></param>
        /// <param name="colonyColonyData"></param>
        /// <returns></returns>
        public static PersistentColony Convert(PersistentWorld persistentWorld, Game game, PersistentColonyData colonyColonyData = null)
        {
            var persistentColony = new PersistentColony()
            {
                ColonyData = PersistentColonyData.Convert(game, colonyColonyData),
                GameData   = PersistentColonyGameData.Convert(game)
            };

            return(persistentColony);
        }
 public IEnumerable <Map> GetMapsForColony(PersistentColony colony)
 {
     foreach (var map in LoadedMaps.Keys)
     {
         if (colony.ColonyData.ActiveWorldTiles.Contains(map))
         {
             yield return(Current.Game.FindMap(map));
         }
     }
 }
        public void Convert(Game game)
        {
            Current.Game = game;

            this.Game = game;

            this.WorldData = PersistentWorldData.Convert(game, this.WorldData);

            var colony = PersistentColony.Convert(game);

            this.Colony = colony;

            this.Colonies.Add(colony);

            this.ConvertCurrentGameWorldObjects();
        }
示例#6
0
        private void ConvertColoniesToAbandonedColonies(PersistentColony persistentColony)
        {
            var toAdd    = new List <AbandonedColony>();
            var toRemove = new List <Settlement>();

            foreach (var settlement in this.WorldData.WorldObjectsHolder.Settlements)
            {
                if (settlement.Faction != Faction.OfPlayer)
                {
                    continue;
                }

                if (settlement.Map?.info == null)
                {
                    continue;
                }

                var abandonedColony =
                    (AbandonedColony)WorldObjectSameIDMaker.MakeWorldObject(PersistentWorldsDefOf.AbandonedColony,
                                                                            settlement.ID);

                settlement.Map.info.parent = abandonedColony;
                abandonedColony.Tile       = settlement.Tile;

                abandonedColony.Name = persistentColony.ColonyData.ColonyFaction.Name;

                toAdd.Add(abandonedColony);
                toRemove.Add(settlement);
            }

            toAdd.Do(abandonedColony => this.WorldData.WorldObjectsHolder.Add(abandonedColony));
            toAdd.Clear();

            toRemove.Do(settlement => this.WorldData.WorldObjectsHolder.Remove(settlement));
            toRemove.Clear();
        }