Exemple #1
0
        public static void AddEndParts(ref MapParent __instance)
        {
            HashSet <IncidentTargetTagDef> theListToChange;

            theListToChange = (HashSet <IncidentTargetTagDef>) typeof(MapParent).GetField("hibernatableIncidentTargets", AccessTools.all).GetValue(__instance);
            //typeof(MapParent).GetField("hibernatableIncidentTargets", AccessTools.all).SetValue(__instance,null);
            //__instance.hibernatableIncidentTargets = null;
            foreach (ThingWithComps current in __instance.Map.listerThings.ThingsOfDef(ThingDef.Named("GR_ArchotechPlatform")).OfType <ThingWithComps>())
            {
                CompHibernatable compHibernatable = current.TryGetComp <CompHibernatable>();
                if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Starting && compHibernatable.Props.incidentTargetWhileStarting != null)
                {
                    if (theListToChange == null)
                    {
                        typeof(MapParent).GetField("hibernatableIncidentTargets", AccessTools.all).SetValue(__instance, new HashSet <IncidentTargetTagDef>());

                        // this.hibernatableIncidentTargets = new HashSet<IncidentTargetTagDef>();
                    }
                    theListToChange = (HashSet <IncidentTargetTagDef>) typeof(MapParent).GetField("hibernatableIncidentTargets", AccessTools.all).GetValue(__instance);
                    theListToChange.Add(compHibernatable.Props.incidentTargetWhileStarting);
                    typeof(MapParent).GetField("hibernatableIncidentTargets", AccessTools.all).SetValue(__instance, theListToChange);
                    Log.Message("Genetic Rim is starting the Archotech Project. Prepare for raids!");

                    // this.hibernatableIncidentTargets.Add(compHibernatable.Props.incidentTargetWhileStarting);
                }
            }
        }
        public static IEnumerable <string> LaunchFailReasons(Building rootBuilding)
        {
            List <Building> shipParts = ArchotechUtility.ShipBuildingsAttachedTo(rootBuilding).ToList <Building>();

            foreach (KeyValuePair <ThingDef, int> partDef in ArchotechUtility.RequiredParts())
            {
                int shipPartCount = shipParts.Count((Building pa) => pa.def == partDef.Key);
                if (shipPartCount < partDef.Value)
                {
                    yield return(string.Format("{0}: {1}x {2} ({3} {4})", new object[]
                    {
                        "ShipReportMissingPart".Translate(),
                        partDef.Value - shipPartCount,
                        partDef.Key.label,
                        "ShipReportMissingPartRequires".Translate(),
                        partDef.Value
                    }));
                }
            }

            foreach (Building part in shipParts)
            {
                CompHibernatable hibernatable = part.TryGetComp <CompHibernatable>();
                if (hibernatable != null && hibernatable.State == HibernatableStateDefOf.Hibernating)
                {
                    yield return(string.Format("{0}: {1}", "ShipReportHibernating".Translate(), part.LabelCap));
                }
                if (hibernatable != null && !hibernatable.Running)
                {
                    yield return(string.Format("{0}: {1}", "ShipReportNotReady".Translate(), part.LabelCap));
                }
            }
        }
 static void Postfix(CompHibernatable __instance)
 {
     if (__instance.parent is Building_MechanoidBeacon beacon)
     {
         Traverse.Create(__instance).Field("endStartupTicks").SetValue(Traverse.Create(__instance).Field("endStartupTicks").GetValue <int>() + beacon.GetComp <CompHibernatable_MechanoidBeacon>().extraStartUpDays *GenDate.TicksPerDay);
     }
 }
Exemple #4
0
        public void AttemptToPlace(ThingDef thingDef, CellRect rect, Rot4 rotation, Faction faction)
        {
            Map     map = BaseGen.globalSettings.map;
            Thing   thing;
            IntVec3 loc = (from cell in rect.Cells.InRandomOrder(null)
                           where GenConstruct.CanPlaceBlueprintAt(thingDef, cell, rotation, map, false, null).Accepted&& GenAdj.OccupiedRect(cell, rotation, thingDef.Size).AdjacentCellsCardinal.Any(delegate(IntVec3 edgeCell)
            {
                bool result;
                if (edgeCell.InBounds(map))
                {
                    result = edgeCell.GetThingList(map).Any((Thing thing) => thing.def == ThingDefOf.Ship_Beam);
                }
                else
                {
                    result = false;
                }
                return(result);
            })
                           select cell).FirstOrFallback(IntVec3.Invalid);

            if (loc.IsValid)
            {
                thing = ThingMaker.MakeThing(thingDef, null);
                thing.SetFaction(faction, null);
                CompHibernatable compHibernatable = thing.TryGetComp <CompHibernatable>();
                if (compHibernatable != null)
                {
                    compHibernatable.State = HibernatableStateDefOf.Hibernating;
                }
                GenSpawn.Spawn(thing, loc, BaseGen.globalSettings.map, rotation, WipeMode.Vanish, false);
            }
        }
 static void Postfix(CompHibernatable __instance, ref int ___endStartupTick)
 {
     if (__instance.parent is Building_MechanoidBeacon beacon)
     {
         ___endStartupTick += beacon.GetComp <CompHibernatable_MechanoidBeacon>().extraStartUpDays *GenDate.TicksPerDay;
     }
 }
Exemple #6
0
        public void StartupHibernatingParts()
        {
            CompHibernatable compHibernatable = this.TryGetComp <CompHibernatable>();

            if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Hibernating)
            {
                compHibernatable.Startup();
            }
        }
Exemple #7
0
        public void StopHibernatingWomb()
        {
            CompHibernatable compHibernatable = this.TryGetComp <CompHibernatable>();

            if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Starting)
            {
                compHibernatable.State = HibernatableStateDefOf.Hibernating;
            }
        }
        public static void StartupHibernatingParts(Building rootBuilding)
        {
            List <Building> list = ArchotechUtility.ShipBuildingsAttachedTo(rootBuilding).ToList <Building>();

            foreach (Building current in list)
            {
                CompHibernatable compHibernatable = current.TryGetComp <CompHibernatable>();
                if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Hibernating)
                {
                    compHibernatable.Startup();
                }
            }
        }
Exemple #9
0
 static void Postfix(MapParent __instance, ref HashSet <IncidentTargetTagDef> ___hibernatableIncidentTargets)
 {
     foreach (ThingWithComps current in __instance.Map.listerThings.ThingsOfDef(WTH_DefOf.WTH_MechanoidBeacon).OfType <ThingWithComps>())
     {
         CompHibernatable compHibernatable = current.TryGetComp <CompHibernatable>();
         if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Starting && compHibernatable.Props.incidentTargetWhileStarting != null)
         {
             if (___hibernatableIncidentTargets == null)
             {
                 ___hibernatableIncidentTargets = new HashSet <IncidentTargetTagDef>();
             }
             ___hibernatableIncidentTargets.Add(compHibernatable.Props.incidentTargetWhileStarting);
         }
     }
 }
        public override void Resolve(ResolveParams rp)
        {
            Map map = BaseGen.globalSettings.map;

            List <Thing> list = map.listerThings.ThingsMatching(ThingRequest.ForDef(ThingDefOf.Ship_Reactor));

            for (int i = 0; i < list.Count; i++)
            {
                CompHibernatable compHibernatable = list[i].TryGetComp <CompHibernatable>();
                if (compHibernatable != null)
                {
                    compHibernatable.State = HibernatableStateDefOf.Running;
                }
            }
        }
 private void RecalculateHibernatableIncidentTargets()
 {
     this.hibernatableIncidentTargets = null;
     foreach (ThingWithComps thing in this.Map.listerThings.AllThings.OfType <ThingWithComps>())
     {
         CompHibernatable compHibernatable = thing.TryGetComp <CompHibernatable>();
         if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Starting && compHibernatable.Props.incidentTargetWhileStarting != null)
         {
             if (this.hibernatableIncidentTargets == null)
             {
                 this.hibernatableIncidentTargets = new HashSet <IncidentTargetTypeDef>();
             }
             this.hibernatableIncidentTargets.Add(compHibernatable.Props.incidentTargetWhileStarting);
         }
     }
 }
Exemple #12
0
 private void RecalculateHibernatableIncidentTargets()
 {
     hibernatableIncidentTargets = null;
     foreach (ThingWithComps item in Map.listerThings.ThingsOfDef(ThingDefOf.Ship_Reactor).OfType <ThingWithComps>())
     {
         CompHibernatable compHibernatable = item.TryGetComp <CompHibernatable>();
         if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Starting && compHibernatable.Props.incidentTargetWhileStarting != null)
         {
             if (hibernatableIncidentTargets == null)
             {
                 hibernatableIncidentTargets = new HashSet <IncidentTargetTagDef>();
             }
             hibernatableIncidentTargets.Add(compHibernatable.Props.incidentTargetWhileStarting);
         }
     }
 }
Exemple #13
0
 static void Postfix(MapParent __instance)
 {
     foreach (ThingWithComps current in __instance.Map.listerThings.ThingsOfDef(WTH_DefOf.WTH_MechanoidBeacon).OfType <ThingWithComps>())
     {
         CompHibernatable compHibernatable = current.TryGetComp <CompHibernatable>();
         if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Starting && compHibernatable.Props.incidentTargetWhileStarting != null)
         {
             HashSet <IncidentTargetTagDef> hibernatableIncidentTargets = Traverse.Create(__instance).Field("hibernatableIncidentTargets").GetValue <HashSet <IncidentTargetTagDef> >();
             if (hibernatableIncidentTargets == null)
             {
                 hibernatableIncidentTargets = new HashSet <IncidentTargetTagDef>();
             }
             hibernatableIncidentTargets.Add(compHibernatable.Props.incidentTargetWhileStarting);
             Traverse.Create(__instance).Field("hibernatableIncidentTargets").SetValue(hibernatableIncidentTargets);
         }
     }
 }
        public void AttemptToPlace(ThingDef thingDef, CellRect rect, Rot4 rotation, Faction faction)
        {
            Map     map = BaseGen.globalSettings.map;
            IntVec3 loc = (from cell in rect.Cells.InRandomOrder()
                           where GenConstruct.CanPlaceBlueprintAt(thingDef, cell, rotation, map).Accepted&& GenAdj.OccupiedRect(cell, rotation, thingDef.Size).AdjacentCellsCardinal.Any((IntVec3 edgeCell) => edgeCell.InBounds(map) && edgeCell.GetThingList(map).Any((Thing thing) => thing.def == ThingDefOf.Ship_Beam))
                           select cell).FirstOrFallback(IntVec3.Invalid);

            if (loc.IsValid)
            {
                Thing thing2 = ThingMaker.MakeThing(thingDef);
                thing2.SetFaction(faction);
                CompHibernatable compHibernatable = thing2.TryGetComp <CompHibernatable>();
                if (compHibernatable != null)
                {
                    compHibernatable.State = HibernatableStateDefOf.Hibernating;
                }
                GenSpawn.Spawn(thing2, loc, BaseGen.globalSettings.map, rotation);
            }
        }
Exemple #15
0
        static bool Prefix(ref IncidentParms parms, ref bool __result)
        {
            Map map = (Map)parms.target;

            if (parms.target != null && parms.target.IncidentTargetTags().Contains(IncidentTargetTagDefOf.Map_RaidBeacon))
            {
                foreach (ThingWithComps current in map.listerThings.ThingsOfDef(WTH_DefOf.WTH_MechanoidBeacon))
                {
                    CompHibernatable compHibernatable = current.TryGetComp <CompHibernatable>();
                    if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Starting && Rand.Chance(0.85f))
                    {
                        __result      = true;
                        parms.faction = Faction.OfMechanoids;
                        return(false);
                    }
                }
            }
            return(true);
        }
Exemple #16
0
        public override void Resolve(ResolveParams rp)
        {
            SpawnDescriptor[] array = new SpawnDescriptor[30]
            {
                new SpawnDescriptor
                {
                    offset = new IntVec3(0, 0, 0),
                    def    = ThingDefOf.Ship_Reactor,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(0, 0, 12),
                    def    = ThingDefOf.Ship_Beam,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(0, 0, 6),
                    def    = ThingDefOf.Ship_Beam,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-4, 0, -2),
                    def    = ThingDefOf.Ship_Beam,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(4, 0, -2),
                    def    = ThingDefOf.Ship_Beam,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(0, 0, -7),
                    def    = ThingDefOf.Ship_Beam,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(0, 0, 16),
                    def    = ThingDefOf.Ship_SensorCluster,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(3, 0, -7),
                    def    = ThingDefOf.Ship_ComputerCore,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-1, 0, 15),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.West
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-1, 0, 13),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.West
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-1, 0, 11),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.West
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-1, 0, 9),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.West
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-1, 0, 7),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.West
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-1, 0, 5),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.West
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-4, 0, 2),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-5, 0, 1),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.West
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(2, 0, 15),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.East
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(2, 0, 13),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.East
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(2, 0, 11),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.East
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(2, 0, 9),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.East
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(2, 0, 7),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.East
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(2, 0, 5),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.East
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(5, 0, 2),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(6, 0, 1),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.East
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-6, 0, -3),
                    def    = ThingDefOf.Ship_Engine,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(7, 0, -3),
                    def    = ThingDefOf.Ship_Engine,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(3, 0, -11),
                    def    = ThingDefOf.Ship_Engine,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-2, 0, -11),
                    def    = ThingDefOf.Ship_Engine,
                    rot    = Rot4.North
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-1, 0, -8),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.West
                },
                new SpawnDescriptor
                {
                    offset = new IntVec3(-1, 0, -6),
                    def    = ThingDefOf.Ship_CryptosleepCasket,
                    rot    = Rot4.West
                }
            };
            IntVec3 centerCell = rp.rect.CenterCell;
            IntVec3 b          = new IntVec3(-1, 0, -3);

            SpawnDescriptor[] array2 = array;
            for (int i = 0; i < array2.Length; i++)
            {
                SpawnDescriptor spawnDescriptor = array2[i];
                Thing           thing           = ThingMaker.MakeThing(spawnDescriptor.def, null);
                thing.SetFaction(rp.faction, null);
                if (rp.hpPercentRange.HasValue)
                {
                    thing.HitPoints = Mathf.Clamp(Mathf.RoundToInt((float)thing.MaxHitPoints * rp.hpPercentRange.Value.RandomInRange), 1, thing.MaxHitPoints);
                    GenLeaving.DropFilthDueToDamage(thing, (float)(thing.MaxHitPoints - thing.HitPoints));
                }
                CompHibernatable compHibernatable = thing.TryGetComp <CompHibernatable>();
                if (compHibernatable != null)
                {
                    compHibernatable.State = HibernatableStateDefOf.Hibernating;
                }
                GenSpawn.Spawn(thing, centerCell + b + spawnDescriptor.offset, BaseGen.globalSettings.map, spawnDescriptor.rot, false);
            }
        }
        private void loadShip(Map map)
        {
            Log.Message("Loading ship");
            string file = Path.Combine(Path.Combine(GenFilePaths.SaveDataFolderPath, "Ships"), shipFactionName + ".rwship");

            if (!File.Exists(file))
            {
                Log.Error("File Doesnt exist");
                return;
            }

            //  Find.GameInitData.startedFromEntry = false;
            Scribe.loader.InitLoading(file);


            Scribe_Deep.Look(ref Current.Game.uniqueIDsManager, false, "uniqueIDsManager", new object[0]);
            Scribe_Deep.Look(ref Current.Game.outfitDatabase, false, "outfitDatabase", new object[0]);
            Scribe_Deep.Look(ref Current.Game.World.ideoManager, false, "ideo", new object[0]);

            List <Ideo> ideosListForReading = Find.IdeoManager.IdeosListForReading;


            int currentyear = 0;

            Scribe_Values.Look <int>(ref currentyear, "currentyear", 0);

            if (currentyear != 0)
            {
                currentyear += 2;
                if (currentyear <= int.MaxValue - 3600000)
                {
                    Find.TickManager.DebugSetTicksGame(Find.TickManager.TicksGame + currentyear * 3600000);
                }
            }


            Log.Message("techsave:" + Saveourships_settings.load_tech);
            if (Saveourships_settings.load_tech)
            {
                Scribe_Deep.Look(ref Current.Game.researchManager, false, "researchManager", new object[0]);
            }
            Log.Message("drugsave:" + Saveourships_settings.load_drug_policies);
            if (Saveourships_settings.load_drug_policies)
            {
                Scribe_Deep.Look(ref Current.Game.drugPolicyDatabase, false, "drugPolicyDatabase", new object[0]);
            }


            List <Pawn> oldpawns = new List <Pawn>();

            Scribe_Collections.Look <Pawn>(ref oldpawns, "oldpawns", LookMode.Deep);

            List <Building> ship = new List <Building>();

            Scribe_Collections.Look <Building>(ref ship, "buildings", LookMode.Deep);

            Scribe.loader.FinalizeLoading();

            if (ship == null)
            {
                Log.Error("ship null");
                return;
            }
            if (ship.Count == 0)
            {
                Log.Error("ship count zero");
                return;
            }

            IntVec3 spot   = MapGenerator.PlayerStartSpot;
            IntVec3 offset = spot - ship[0].Position;

            IntVec3 shipcoordmin = new IntVec3(ship[0].Position.ToVector3() + offset.ToVector3());
            IntVec3 shipcoordmax = new IntVec3(ship[0].Position.ToVector3() + offset.ToVector3());

            Log.Message("Shipfix");
            for (int i = 0; i < ship.Count; i++)
            {
                Building building = ship.ElementAt(i);
                building.Position += offset;
                if (shipcoordmax.x < building.Position.x)
                {
                    shipcoordmax.x = building.Position.x;
                }
                if (shipcoordmax.z < building.Position.z)
                {
                    shipcoordmax.z = building.Position.z;
                }
                if (shipcoordmin.x > building.Position.x)
                {
                    shipcoordmin.x = building.Position.x;
                }
                if (shipcoordmin.z > building.Position.z)
                {
                    shipcoordmin.z = building.Position.z;
                }
                building.SetFaction(Current.Game.World.factionManager.OfPlayer);

                if (building.def == ThingDefOf.Ship_ComputerCore)
                {
                    ship.RemoveAt(i);
                    i--;
                    continue;
                }
                if (building.def == ThingDefOf.Ship_CryptosleepCasket)
                {
                    Building_CryptosleepCasket cask = building as Building_CryptosleepCasket;
                    if (cask.HasAnyContents)
                    {
                        Pawn pawn = cask.ContainedThing as Pawn;
                        Log.Message("pawn.name:" + pawn.Name);
                        pawn.SetFaction(Current.Game.World.factionManager.OfPlayer);
                    }
                }
                Building_ShipReactor building_ShipReactor = new Building_ShipReactor();
                CompHibernatable     hibernatable         = building.TryGetComp <CompHibernatable>();
                if (hibernatable != null)
                {
                    hibernatable = new CompHibernatable();
                    hibernatable.Initialize(new CompProperties());
                    hibernatable.PostSpawnSetup(true);
                    building.InitializeComps();
                }
            }
            Log.Message("Shipfixend");

            foreach (Pawn pawn in oldpawns)
            {
                Log.Message("found world pawn:" + pawn.Name);
                pawn.SetFaction(Faction.OfAncients);
                pawn.health.SetDead();
                Current.Game.World.worldPawns.PassToWorld(pawn, PawnDiscardDecideMode.KeepForever);
            }

            Log.Message("setting terrain");
            // set terrain and remove walls etc
            try
            {
                shipcoordmax += new IntVec3(3, 0, 3);
                shipcoordmin -= new IntVec3(3, 0, 3);
                for (int i = shipcoordmin.x; i < shipcoordmax.x; i++)
                {
                    for (int z = shipcoordmin.z; z < shipcoordmax.z; z++)
                    {
                        IntVec3      point     = new IntVec3(i, 0, z);
                        int          cellindex = map.cellIndices.CellToIndex(point);
                        List <Thing> t         = map.thingGrid.ThingsAt(point).ToList();
                        foreach (Thing thing in t)
                        {
                            thing.Destroy();
                        }
                        map.terrainGrid.SetTerrain(point, TerrainDefOf.Gravel);
                    }
                }
            }catch (Exception e)
            {
                Log.Error(e.Message);
            }
            Log.Message("fixing fog");
            // fix fog
            try
            {
                shipcoordmax += new IntVec3(1, 0, 1);
                shipcoordmin -= new IntVec3(1, 0, 1);
                for (int i = shipcoordmin.x; i < shipcoordmax.x; i++)
                {
                    for (int z = shipcoordmin.z; z < shipcoordmax.z; z++)
                    {
                        IntVec3 point = new IntVec3(i, 0, z);
                        bool    v     = map.fogGrid.IsFogged(point);
                        if (v)
                        {
                            map.fogGrid.Unfog(point);
                        }
                        map.roofGrid.SetRoof(point, null);
                    }
                }
            }catch (Exception e)
            {
                Log.Error(e.Message);
            }
            // add ship to map
            Log.Message("loading ship building");
            try
            {
                new ThingMutator <Building>()
                .For <Building>(x => x.SpawnSetup(map, false))
                .SetAsHome <Building>()
                .UnsafeExecute(ship, Handler);
            }catch (Exception e)
            {
                Log.Message(e.Message);
            }

            Log.Message("Loading ship complete");
        }