Esempio n. 1
0
        // Token: 0x0600000B RID: 11 RVA: 0x00002324 File Offset: 0x00000524
        private void DrillNewLayer()
        {
            Messages.Message("Drilling complete", MessageTypeDefOf.PositiveEvent, true);
            MapParent mapParent = (MapParent)WorldObjectMaker.MakeWorldObject(DefDatabase <WorldObjectDef> .GetNamed("UndergroundMapParent", true));

            mapParent.Tile = Tile;
            Find.WorldObjects.Add(mapParent);
            connectedMapParent = (UndergroundMapParent)mapParent;
            CellRect cellRect = this.OccupiedRect();

            connectedMapParent.holeLocation = new IntVec3(cellRect.minX + 1, 0, cellRect.minZ + 1);
            string seedString = Find.World.info.seedString;

            Find.World.info.seedString = new System.Random().Next(0, 2147483646).ToString();
            connectedMap = MapGenerator.GenerateMap(Find.World.info.initialMapSize, mapParent, mapParent.MapGeneratorDef, mapParent.ExtraGenStepDefs, null);
            Find.World.info.seedString = seedString;
            connectedLift = GenSpawn.Spawn(ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("undergroundlift", true), Stuff), connectedMapParent.holeLocation, connectedMap, WipeMode.Vanish);
            connectedLift.SetFaction(Faction.OfPlayer, null);
            UndergroundManager undergroundManager = Map.components.Find((MapComponent item) => item is UndergroundManager) as UndergroundManager;

            undergroundManager.InsertLayer(connectedMapParent);
            bool flag = connectedLift is Building_SpawnedLift;

            if (flag)
            {
                ((Building_SpawnedLift)connectedLift).depth      = connectedMapParent.depth;
                ((Building_SpawnedLift)connectedLift).surfaceMap = Map;
            }
            else
            {
                Log.Warning("Spawned lift isn't deeprim's lift. Someone's editing this mod! And doing it badly!!! Very badly.", false);
            }
        }
Esempio n. 2
0
        public void SyncConnectedMap()
        {
            UndergroundManager   undergroundManager   = Map.components.Find((MapComponent item) => item is UndergroundManager) as UndergroundManager;
            UndergroundMapParent undergroundMapParent = undergroundManager.layersState[targetedLevel];

            connectedMapParent = undergroundMapParent;
            connectedMap       = undergroundMapParent.Map;
            connectedLift      = (from Building_SpawnedLift lift in connectedMap.listerBuildings.allBuildingsColonist where lift is Building_SpawnedLift select lift).FirstOrDefault();
        }
Esempio n. 3
0
        // Token: 0x0600000A RID: 10 RVA: 0x000022CC File Offset: 0x000004CC
        private void Abandon()
        {
            mode = 0;
            SyncConnectedMap();
            if (connectedMapParent != null)
            {
                connectedMapParent.AbandonLift(connectedLift);
            }
            connectedLift.Destroy(DestroyMode.Vanish);
            UndergroundManager undergroundManager = Map.components.Find((MapComponent item) => item is UndergroundManager) as UndergroundManager;

            undergroundManager.DestroyLayer(connectedMapParent);
            connectedMap       = null;
            connectedMapParent = null;
            connectedLift      = null;
            drillNew           = true;
        }
Esempio n. 4
0
        // Token: 0x0600000D RID: 13 RVA: 0x0000250C File Offset: 0x0000070C
        private void DrillToOldLayer()
        {
            UndergroundManager   undergroundManager   = Map.components.Find((MapComponent item) => item is UndergroundManager) as UndergroundManager;
            UndergroundMapParent undergroundMapParent = undergroundManager.layersState[targetedLevel];

            connectedMapParent = undergroundMapParent;
            connectedMap       = undergroundMapParent.Map;
            CellRect cellRect = this.OccupiedRect();
            IntVec3  intVec   = new IntVec3(cellRect.minX + 1, 0, cellRect.minZ + 1);

            connectedLift = GenSpawn.Spawn(ThingMaker.MakeThing(DefDatabase <ThingDef> .GetNamed("undergroundlift", true), Stuff), intVec, connectedMap, WipeMode.Vanish);
            connectedLift.SetFaction(Faction.OfPlayer, null);
            FloodFillerFog.FloodUnfog(intVec, connectedMap);
            bool flag = connectedLift is Building_SpawnedLift;

            if (flag)
            {
                ((Building_SpawnedLift)connectedLift).depth = connectedMapParent.depth;
            }
            else
            {
                Log.Warning("Spawned lift isn't deeprim's lift. Someone's editing this mod! And doing it badly!!! Very badly.", false);
            }
        }