SpawnFireproofPowerConduitAt() public static method

public static SpawnFireproofPowerConduitAt ( IntVec3 position, OG_OutpostData &outpostData ) : void
position IntVec3
outpostData OG_OutpostData
return void
コード例 #1
0
        public static void GenerateStraightAlleyZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);

            // Spawn lamps.
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(4, 0, 2).RotatedBy(rotation), Color.white, ref outpostData);
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), Color.white, ref outpostData);
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), Color.white, ref outpostData);
            OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(6, 0, 8).RotatedBy(rotation), Color.white, ref outpostData);

            // Generate central paved alley.
            for (int zOffset = 0; zOffset < Genstep_GenerateOutpost.zoneSideSize; zOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            }

            // Generate concrete border and power conduit.
            for (int zOffset = 0; zOffset <= 10; zOffset++)
            {
                IntVec3 cell = rotatedOrigin + new IntVec3(4, 0, zOffset).RotatedBy(rotation);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete);

                cell = rotatedOrigin + new IntVec3(6, 0, zOffset).RotatedBy(rotation);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete);
            }
        }
コード例 #2
0
        private static void SpawnLaserFenceTwoPylons(IntVec3 laserFenceLeftOrigin, Rot4 rotation, int distanceBetweenPylons, ref OG_OutpostData outpostData)
        {
            OG_Common.TrySpawnLaserFencePylonAt(laserFenceLeftOrigin, ref outpostData);
            OG_Common.TrySpawnLaserFencePylonAt(laserFenceLeftOrigin + new IntVec3(0, 0, distanceBetweenPylons + 1).RotatedBy(rotation), ref outpostData);

            for (int zOffset = 0; zOffset <= 5; zOffset++)
            {
                IntVec3 position = laserFenceLeftOrigin + new IntVec3(0, 0, zOffset).RotatedBy(rotation);
                OG_Common.SpawnFireproofPowerConduitAt(position, ref outpostData);
                Find.TerrainGrid.SetTerrain(position, TerrainDefOf.Concrete);
            }
        }
コード例 #3
0
        public static void GenerateBatteryRoomZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, Rot4 linkedZoneRelativeRotation, ref OG_OutpostData outpostData)
        {
            IntVec3 origin        = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);

            OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, smallRoomWallOffset).RotatedBy(rotation), Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, rotation, TerrainDefOf.Concrete, null, ref outpostData);

            // Generate batteries.
            OG_Common.TrySpawnThingAt(OG_Util.CompactAutonomousGeneratorDef, null, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(smallRoomWallOffset + 4, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(smallRoomWallOffset + 2, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(smallRoomWallOffset + 4, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData);
            // Generate vertical alley and door.
            for (int zOffset = smallRoomWallOffset; zOffset <= Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset; zOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            }
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset - 1).RotatedBy(rotation), ref outpostData);
            // Generate horizontal alley, door, lamp and power conduits.
            if (linkedZoneRelativeRotation == Rot4.West)
            {
                for (int xOffset = smallRoomWallOffset - 1; xOffset <= Genstep_GenerateOutpost.zoneSideCenterOffset; xOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
                }
                OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(rotation), ref outpostData);
                OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.red, ref outpostData);
                for (int xOffset = 0; xOffset <= 1; xOffset++)
                {
                    OG_Common.SpawnFireproofPowerConduitAt(rotatedOrigin + new IntVec3(xOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(rotation), ref outpostData);
                }
            }
            else if (linkedZoneRelativeRotation == Rot4.East)
            {
                for (int xOffset = Genstep_GenerateOutpost.zoneSideCenterOffset; xOffset <= Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset; xOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
                }
                OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset - 1, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(rotation), ref outpostData);
                OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.red, ref outpostData);
                for (int xOffset = Genstep_GenerateOutpost.zoneSideSize - 2; xOffset <= Genstep_GenerateOutpost.zoneSideSize - 1; xOffset++)
                {
                    OG_Common.SpawnFireproofPowerConduitAt(rotatedOrigin + new IntVec3(xOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(rotation), ref outpostData);
                }
            }
        }
コード例 #4
0
 private static void SpawnLaserFenceWithoutEntrance(IntVec3 laserFenceLeftOrigin, Rot4 rotation, ref OG_OutpostData outpostData)
 {
     // Note: the fence is orthogonal to the parameter rotation.
     for (int xOffset = 0; xOffset < Genstep_GenerateOutpost.zoneSideSize; xOffset++)
     {
         IntVec3 position = laserFenceLeftOrigin + new IntVec3(xOffset, 0, 0).RotatedBy(new Rot4(rotation.AsInt));
         if ((xOffset == 0) ||
             (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset) ||
             (xOffset == Genstep_GenerateOutpost.zoneSideSize - 1))
         {
             OG_Common.TrySpawnLaserFencePylonAt(position, ref outpostData);
         }
         OG_Common.SpawnFireproofPowerConduitAt(position, ref outpostData);
         Find.TerrainGrid.SetTerrain(position, TerrainDefOf.Concrete);
     }
 }
コード例 #5
0
        public static void GenerateSolarPanelZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, ref OG_OutpostData outpostData)
        {
            IntVec3 solarPanelZoneOrigin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd);

            OG_Common.TrySpawnThingAt(ThingDefOf.SolarGenerator, null, solarPanelZoneOrigin + new IntVec3(2, 0, 2), false, Rot4.North, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.SolarGenerator, null, solarPanelZoneOrigin + new IntVec3(7, 0, 2), false, Rot4.North, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.SolarGenerator, null, solarPanelZoneOrigin + new IntVec3(2, 0, 7), false, Rot4.North, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.SolarGenerator, null, solarPanelZoneOrigin + new IntVec3(7, 0, 7), false, Rot4.North, ref outpostData);
            OG_Common.SpawnFireproofPowerConduitAt(solarPanelZoneOrigin + new IntVec3(5, 0, 1), ref outpostData);
            OG_Common.SpawnFireproofPowerConduitAt(solarPanelZoneOrigin + new IntVec3(5, 0, 0), ref outpostData);
            OG_Common.SpawnFireproofPowerConduitAt(solarPanelZoneOrigin + new IntVec3(1, 0, 5), ref outpostData);
            OG_Common.SpawnFireproofPowerConduitAt(solarPanelZoneOrigin + new IntVec3(0, 0, 5), ref outpostData);
            OG_Common.SpawnFireproofPowerConduitAt(solarPanelZoneOrigin + new IntVec3(9, 0, 5), ref outpostData);
            OG_Common.SpawnFireproofPowerConduitAt(solarPanelZoneOrigin + new IntVec3(10, 0, 5), ref outpostData);
            OG_Common.SpawnFireproofPowerConduitAt(solarPanelZoneOrigin + new IntVec3(5, 0, 9), ref outpostData);
            OG_Common.SpawnFireproofPowerConduitAt(solarPanelZoneOrigin + new IntVec3(5, 0, 10), ref outpostData);
        }
コード例 #6
0
ファイル: OG_Common.cs プロジェクト: zombojoe/Rimworld
        public static void GenerateEmptyRoomAt(IntVec3 rotatedOrigin,
                                               int width,
                                               int height,
                                               Rot4 rotation,
                                               TerrainDef defaultFloorDef,
                                               TerrainDef interiorFloorDef,
                                               ref OG_OutpostData outpostData)
        {
            CellRect rect = new CellRect(rotatedOrigin.x, rotatedOrigin.z, width, height);

            if (rotation == Rot4.North)
            {
                rect = new CellRect(rotatedOrigin.x, rotatedOrigin.z, width, height);
            }
            else if (rotation == Rot4.East)
            {
                rect = new CellRect(rotatedOrigin.x, rotatedOrigin.z - width + 1, height, width);
            }
            else if (rotation == Rot4.South)
            {
                rect = new CellRect(rotatedOrigin.x - width + 1, rotatedOrigin.z - height + 1, width, height);
            }
            else
            {
                rect = new CellRect(rotatedOrigin.x - height + 1, rotatedOrigin.z, height, width);
            }
            // Generate 4 walls and power conduits.
            foreach (IntVec3 cell in rect.Cells)
            {
                if ((cell.x == rect.minX) || (cell.x == rect.maxX) || (cell.z == rect.minZ) || (cell.z == rect.maxZ))
                {
                    OG_Common.TrySpawnWallAt(cell, ref outpostData);
                    OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                }
            }
            // Trigger to unfog area when a pawn enters the room.
            SpawnRectTriggerUnfogArea(rect, ref outpostData.triggerIntrusion);
            // Generate roof.
            foreach (IntVec3 cell in rect.Cells)
            {
                Find.RoofGrid.SetRoof(cell, OG_Util.IronedRoofDef);
            }
            // Generate room default floor.
            if (defaultFloorDef != null)
            {
                foreach (IntVec3 cell in rect.ExpandedBy(1).Cells)
                {
                    TerrainDef terrain = Find.TerrainGrid.TerrainAt(cell);
                    if (terrain != TerrainDef.Named("PavedTile")) // Don't recover already spawned paved tile.
                    {
                        Find.TerrainGrid.SetTerrain(cell, defaultFloorDef);
                    }
                }
            }
            // Generate room interior floor.
            if (interiorFloorDef != null)
            {
                foreach (IntVec3 cell in rect.ContractedBy(1).Cells)
                {
                    Find.TerrainGrid.SetTerrain(cell, interiorFloorDef);
                }
            }
        }
コード例 #7
0
        public static void GeneratePlazaZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);

            // Generate paved floor.
            for (int xOffset = 3; xOffset <= 7; xOffset++)
            {
                for (int zOffset = 0; zOffset <= 10; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset), TerrainDef.Named("TileGranite"));
                }
            }
            for (int xOffset = 2; xOffset <= 8; xOffset++)
            {
                for (int zOffset = 1; zOffset <= 9; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset), TerrainDef.Named("TileGranite"));
                }
            }
            for (int xOffset = 1; xOffset <= 9; xOffset++)
            {
                for (int zOffset = 2; zOffset <= 8; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset), TerrainDef.Named("TileGranite"));
                }
            }
            for (int xOffset = 0; xOffset <= 10; xOffset++)
            {
                for (int zOffset = 3; zOffset <= 7; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset), TerrainDef.Named("TileGranite"));
                }
            }

            // Generate central paved alley.
            IntVec3 centralPylonPosition = rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset);

            for (int zOffset = 0; zOffset < Genstep_GenerateOutpost.zoneSideSize; zOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, zOffset), TerrainDef.Named("PavedTile"));
            }
            for (int xOffset = 0; xOffset < Genstep_GenerateOutpost.zoneSideSize; xOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset), TerrainDef.Named("PavedTile"));
            }
            foreach (IntVec3 cell in GenAdj.CellsAdjacent8Way(centralPylonPosition))
            {
                Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("PavedTile"));
            }

            // Generate pylon.
            OG_Common.TrySpawnWallAt(centralPylonPosition, ref outpostData);

            // Generate sandbags and power conduit.
            for (int rotationAsInt = 0; rotationAsInt < 4; rotationAsInt++)
            {
                Rot4    quarterRotation        = new Rot4(rotationAsInt);
                IntVec3 quarterSouthWestOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, quarterRotation);

                IntVec3 cell = quarterSouthWestOrigin + new IntVec3(0, 0, 4).RotatedBy(quarterRotation);
                OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                cell = quarterSouthWestOrigin + new IntVec3(0, 0, 3).RotatedBy(quarterRotation);
                OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                cell = quarterSouthWestOrigin + new IntVec3(1, 0, 3).RotatedBy(quarterRotation);
                OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                cell = quarterSouthWestOrigin + new IntVec3(1, 0, 2).RotatedBy(quarterRotation);
                OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                cell = quarterSouthWestOrigin + new IntVec3(2, 0, 2).RotatedBy(quarterRotation);
                OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                cell = quarterSouthWestOrigin + new IntVec3(2, 0, 1).RotatedBy(quarterRotation);
                OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                cell = quarterSouthWestOrigin + new IntVec3(3, 0, 1).RotatedBy(quarterRotation);
                OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                cell = quarterSouthWestOrigin + new IntVec3(3, 0, 0).RotatedBy(quarterRotation);
                OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                cell = quarterSouthWestOrigin + new IntVec3(4, 0, 0).RotatedBy(quarterRotation);
                OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                cell = quarterSouthWestOrigin + new IntVec3(5, 0, 0).RotatedBy(quarterRotation);
                OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
            }
        }
コード例 #8
0
        public static void GenerateMainEntranceZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);
            IntVec3 cell          = rotatedOrigin;

            // Spawn concrete floor.
            for (int xOffset = -1; xOffset <= 11; xOffset++)
            {
                for (int zOffset = -1; zOffset <= 5; zOffset++)
                {
                    cell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation);
                    Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete);
                }
            }

            // Generate central paved alley.
            for (int xOffset = 4; xOffset <= 6; xOffset++)
            {
                for (int zOffset = 0; zOffset <= 10; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete);
                }
            }
            for (int zOffset = -1; zOffset <= 10; zOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            }

            // Generate south west turret.
            IntVec3 southWestOrigin = rotatedOrigin;

            for (int xOffset = 0; xOffset < 5; xOffset++)
            {
                for (int zOffset = 0; zOffset < 5; zOffset++)
                {
                    cell = southWestOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation);
                    if ((xOffset == 0) ||
                        (zOffset == 0))
                    {
                        OG_Common.TrySpawnWallAt(cell, ref outpostData);
                        OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                    }
                }
            }
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southWestOrigin + new IntVec3(1, 0, 4).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southWestOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southWestOrigin + new IntVec3(3, 0, 4).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southWestOrigin + new IntVec3(4, 0, 4).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southWestOrigin + new IntVec3(4, 0, 3).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(OG_Util.VulcanTurretDef, ThingDefOf.Steel, southWestOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);

            // Generate south east turret.
            IntVec3 southEastOrigin = rotatedOrigin;

            for (int xOffset = 6; xOffset < 11; xOffset++)
            {
                for (int zOffset = 0; zOffset < 5; zOffset++)
                {
                    cell = southEastOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation);
                    if ((xOffset == 10) ||
                        (zOffset == 0))
                    {
                        OG_Common.TrySpawnWallAt(cell, ref outpostData);
                        OG_Common.SpawnFireproofPowerConduitAt(cell, ref outpostData);
                    }
                }
            }
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southEastOrigin + new IntVec3(6, 0, 3).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southEastOrigin + new IntVec3(6, 0, 4).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southEastOrigin + new IntVec3(7, 0, 4).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southEastOrigin + new IntVec3(8, 0, 4).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, southEastOrigin + new IntVec3(9, 0, 4).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(OG_Util.VulcanTurretDef, ThingDefOf.Steel, southEastOrigin + new IntVec3(7, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);

            // Generate central door and power conduit.
            OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.SpawnFireproofPowerConduitAt(rotatedOrigin + new IntVec3(5, 0, 0).RotatedBy(rotation), ref outpostData);

            // Generate ironed roof.
            for (int xOffset = 0; xOffset <= 10; xOffset++)
            {
                for (int zOffset = 0; zOffset <= 4; zOffset++)
                {
                    Find.RoofGrid.SetRoof(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), OG_Util.IronedRoofDef);
                }
            }
        }
コード例 #9
0
        public static void GenerateEntranchedZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData)
        {
            IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation);
            IntVec3 cell          = rotatedOrigin;

            // Generate south west battery shelter.
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(0, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(3, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(0, 0, 3).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(3, 0, 3).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            for (int xOffset = 0; xOffset < 4; xOffset++)
            {
                for (int zOffset = 0; zOffset < 4; zOffset++)
                {
                    cell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation);
                    Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete);
                    Find.RoofGrid.SetRoof(cell, OG_Util.IronedRoofDef);
                }
            }

            // Generate south east battery shelter.
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(7, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(10, 0, 0).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(7, 0, 3).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(10, 0, 3).RotatedBy(rotation), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(9, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            for (int xOffset = 7; xOffset < 11; xOffset++)
            {
                for (int zOffset = 0; zOffset < 4; zOffset++)
                {
                    cell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation);
                    Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete);
                    Find.RoofGrid.SetRoof(cell, OG_Util.IronedRoofDef);
                }
            }

            // Generate central paved alley.
            for (int xOffset = 4; xOffset <= 6; xOffset++)
            {
                for (int zOffset = 0; zOffset < 7; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete);
                }
            }
            for (int zOffset = 0; zOffset < 7; zOffset++)
            {
                Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile"));
            }

            // Generate north west force field.
            IntVec3 northWestOrigin = rotatedOrigin + new IntVec3(0, 0, 6).RotatedBy(rotation);

            for (int xOffset = 0; xOffset < 5; xOffset++)
            {
                for (int zOffset = 0; zOffset < 2; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(northWestOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete);
                }
            }
            for (int xOffset = 1; xOffset <= 3; xOffset++)
            {
                Find.TerrainGrid.SetTerrain(northWestOrigin + new IntVec3(xOffset, 0, 2).RotatedBy(rotation), TerrainDefOf.Concrete);
            }
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            for (int zOffset = -3; zOffset <= 3; zOffset++)
            {
                if ((zOffset == 1) &&
                    OG_Util.IsModActive("MiningCo. ForceField"))
                {
                    // Do not spawn power conduit under force field as it generates a warning message.
                    continue;
                }
                OG_Common.SpawnFireproofPowerConduitAt(northWestOrigin + new IntVec3(2, 0, zOffset).RotatedBy(rotation), ref outpostData);
            }
            if (OG_Util.IsModActive("MiningCo. ForceField"))
            {
                OG_Common.TrySpawnThingAt(OG_Util.ForceFieldGeneratorDef, null, northWestOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            }

            // Generate central sandbag.
            cell = rotatedOrigin + new IntVec3(5, 0, 7).RotatedBy(rotation);
            Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData);

            // Generate north east force field.
            IntVec3 northEastOrigin = rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation);

            for (int xOffset = 0; xOffset < 5; xOffset++)
            {
                for (int zOffset = 0; zOffset < 2; zOffset++)
                {
                    Find.TerrainGrid.SetTerrain(northEastOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete);
                }
            }
            for (int xOffset = 1; xOffset <= 3; xOffset++)
            {
                Find.TerrainGrid.SetTerrain(northEastOrigin + new IntVec3(xOffset, 0, 2).RotatedBy(rotation), TerrainDefOf.Concrete);
            }
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData);
            for (int zOffset = -3; zOffset <= 3; zOffset++)
            {
                if ((zOffset == 1) &&
                    OG_Util.IsModActive("MiningCo. ForceField"))
                {
                    // Do not spawn power conduit under force field as it generates a warning message.
                    continue;
                }
                OG_Common.SpawnFireproofPowerConduitAt(northEastOrigin + new IntVec3(2, 0, zOffset).RotatedBy(rotation), ref outpostData);
            }
            if (OG_Util.IsModActive("MiningCo. ForceField"))
            {
                OG_Common.TrySpawnThingAt(OG_Util.ForceFieldGeneratorDef, null, northEastOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData);
            }
        }
コード例 #10
0
        private static void SpawnLaserFenceWithEntrance(IntVec3 laserFenceLeftOrigin, Rot4 rotation, int entranceWidth, ref OG_OutpostData outpostData)
        {
            // Note1: the fence is orthogonal to the parameter rotation.
            // Note2: the entrance width must be an odd number.
            int entranceWidthOffset = 1 + (entranceWidth / 2);

            for (int xOffset = 0; xOffset < Genstep_GenerateOutpost.zoneSideSize; xOffset++)
            {
                IntVec3 position = laserFenceLeftOrigin + new IntVec3(xOffset, 0, 0).RotatedBy(new Rot4(rotation.AsInt));
                if ((xOffset == 0) ||
                    (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset - entranceWidthOffset) ||
                    (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset + entranceWidthOffset) ||
                    (xOffset == Genstep_GenerateOutpost.zoneSideSize - 1))
                {
                    LaserFence.Building_LaserFencePylon pylon = OG_Common.TrySpawnLaserFencePylonAt(position, ref outpostData);
                    if (pylon != null)
                    {
                        if (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset - entranceWidthOffset)
                        {
                            if (rotation == Rot4.North)
                            {
                                pylon.ToggleEastFenceStatus();
                            }
                            else if (rotation == Rot4.East)
                            {
                                pylon.ToggleSouthFenceStatus();
                            }
                            else if (rotation == Rot4.South)
                            {
                                pylon.ToggleWestFenceStatus();
                            }
                            else if (rotation == Rot4.West)
                            {
                                pylon.ToggleNorthFenceStatus();
                            }
                            pylon.SwitchLaserFence();
                        }
                        if (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset + entranceWidthOffset)
                        {
                            if (rotation == Rot4.North)
                            {
                                pylon.ToggleWestFenceStatus();
                            }
                            else if (rotation == Rot4.East)
                            {
                                pylon.ToggleNorthFenceStatus();
                            }
                            else if (rotation == Rot4.South)
                            {
                                pylon.ToggleEastFenceStatus();
                            }
                            else if (rotation == Rot4.West)
                            {
                                pylon.ToggleSouthFenceStatus();
                            }
                            pylon.SwitchLaserFence();
                        }
                    }
                }
                OG_Common.SpawnFireproofPowerConduitAt(position, ref outpostData);
                Find.TerrainGrid.SetTerrain(position, TerrainDefOf.Concrete);
                if (xOffset == Genstep_GenerateOutpost.zoneSideCenterOffset)
                {
                    Find.TerrainGrid.SetTerrain(position, TerrainDef.Named("PavedTile"));
                }
            }
        }
コード例 #11
0
 private static void GenerateLaseFenceForBigOutpost(ZoneProperties[,] zoneMap, int horizontalZonesNumber, int verticalZonesNumber, ref OG_OutpostData outpostData)
 {
     for (int zoneOrd = 0; zoneOrd < verticalZonesNumber; zoneOrd++)
     {
         for (int zoneAbs = 0; zoneAbs < horizontalZonesNumber; zoneAbs++)
         {
             ZoneProperties zone              = zoneMap[zoneOrd, zoneAbs];
             IntVec3        zoneOrigin        = Zone.GetZoneOrigin(outpostData.areaSouthWestOrigin, zoneAbs, zoneOrd);
             IntVec3        zoneRotatedOrigin = Zone.GetZoneRotatedOrigin(outpostData.areaSouthWestOrigin, zoneAbs, zoneOrd, zone.rotation);
             if (zone.zoneType == ZoneType.MainEntrance)
             {
                 SpawnLaserFenceTwoPylons(zoneRotatedOrigin + new IntVec3(0, 0, 5).RotatedBy(zone.rotation), new Rot4(Rot4.North.AsInt + zone.rotation.AsInt), 4, ref outpostData);
                 SpawnLaserFenceTwoPylons(zoneRotatedOrigin + new IntVec3(10, 0, 5).RotatedBy(zone.rotation), new Rot4(Rot4.North.AsInt + zone.rotation.AsInt), 4, ref outpostData);
             }
             else if (zone.zoneType == ZoneType.SecondaryEntrance)
             {
                 SpawnLaserFenceThreePylons(zoneRotatedOrigin, new Rot4(Rot4.North.AsInt + zone.rotation.AsInt), 4, ref outpostData);
                 SpawnLaserFenceThreePylons(zoneRotatedOrigin + new IntVec3(10, 0, 0).RotatedBy(zone.rotation), new Rot4(Rot4.North.AsInt + zone.rotation.AsInt), 4, ref outpostData);
                 OG_Common.SpawnFireproofPowerConduitAt(zoneRotatedOrigin + new IntVec3(0, 0, -1).RotatedBy(zone.rotation), ref outpostData);
                 OG_Common.SpawnFireproofPowerConduitAt(zoneRotatedOrigin + new IntVec3(10, 0, -1).RotatedBy(zone.rotation), ref outpostData);
             }
             else
             {
                 if (zoneOrd == 0)
                 {
                     if (Zone.IsZoneMediumRoom(zone.zoneType))
                     {
                         SpawnLaserFenceTwoPylons(zoneOrigin, Rot4.East, 2, ref outpostData);
                         SpawnLaserFenceTwoPylons(zoneOrigin + new IntVec3(7, 0, 0), Rot4.East, 2, ref outpostData);
                     }
                     else
                     {
                         SpawnLaserFenceThreePylons(zoneOrigin, Rot4.East, 4, ref outpostData);
                     }
                 }
                 if (zoneOrd == verticalZonesNumber - 1)
                 {
                     if (Zone.IsZoneMediumRoom(zone.zoneType))
                     {
                         SpawnLaserFenceTwoPylons(zoneOrigin + new IntVec3(0, 0, 10), Rot4.East, 2, ref outpostData);
                         SpawnLaserFenceTwoPylons(zoneOrigin + new IntVec3(7, 0, 10), Rot4.East, 2, ref outpostData);
                     }
                     else
                     {
                         SpawnLaserFenceThreePylons(zoneOrigin + new IntVec3(0, 0, 10), Rot4.East, 4, ref outpostData);
                     }
                 }
                 if (zoneAbs == 0)
                 {
                     if (Zone.IsZoneMediumRoom(zone.zoneType))
                     {
                         SpawnLaserFenceTwoPylons(zoneOrigin, Rot4.North, 2, ref outpostData);
                         SpawnLaserFenceTwoPylons(zoneOrigin + new IntVec3(0, 0, 7), Rot4.North, 2, ref outpostData);
                     }
                     else
                     {
                         SpawnLaserFenceThreePylons(zoneOrigin, Rot4.North, 4, ref outpostData);
                     }
                 }
                 if (zoneAbs == horizontalZonesNumber - 1)
                 {
                     if (Zone.IsZoneMediumRoom(zone.zoneType))
                     {
                         SpawnLaserFenceTwoPylons(zoneOrigin + new IntVec3(10, 0, 0), Rot4.North, 2, ref outpostData);
                         SpawnLaserFenceTwoPylons(zoneOrigin + new IntVec3(10, 0, 7), Rot4.North, 2, ref outpostData);
                     }
                     else
                     {
                         SpawnLaserFenceThreePylons(zoneOrigin + new IntVec3(10, 0, 0), Rot4.North, 4, ref outpostData);
                     }
                 }
             }
         }
     }
 }