public static void GenerateMortarZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData) { IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation); // Spawn floor. for (int xOffset = 0; xOffset <= 10; xOffset++) { for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete); } } OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin); for (int xOffset = 7; xOffset <= 9; xOffset++) { for (int zOffset = 1; zOffset <= 3; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("MetalTile")); } } for (int xOffset = 6; xOffset <= 9; xOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, 2).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } // Spawn sandbags. for (int xOffset = 0; xOffset <= 4; xOffset++) { OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, rotatedOrigin + new IntVec3(xOffset, 0, 0).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, rotatedOrigin + new IntVec3(xOffset, 0, 10).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); } for (int xOffset = 6; xOffset <= 10; xOffset++) { OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, rotatedOrigin + new IntVec3(xOffset, 0, 10).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); } for (int zOffset = 0; zOffset <= 4; zOffset++) { OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, rotatedOrigin + new IntVec3(0, 0, zOffset).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); } for (int zOffset = 6; zOffset <= 10; zOffset++) { OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, rotatedOrigin + new IntVec3(0, 0, zOffset).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, rotatedOrigin + new IntVec3(10, 0, zOffset).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); } // Spawn mortars. OG_Common.TrySpawnThingAt(ThingDef.Named("Turret_MortarBomb"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Turret_MortarBomb"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Turret_MortarBomb"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Generate ammunition stockpile. for (int xOffset = 6; xOffset <= 10; xOffset++) { OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(xOffset, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(xOffset, 0, 4).RotatedBy(rotation), ref outpostData); } for (int zOffset = 0; zOffset <= 4; zOffset++) { OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(6, 0, zOffset).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(10, 0, zOffset).RotatedBy(rotation), ref outpostData); } for (int xOffset = 6; xOffset <= 10; xOffset++) { for (int zOffset = 0; zOffset <= 4; zOffset++) { Find.RoofGrid.SetRoof(rotatedOrigin + new IntVec3(10, 0, zOffset).RotatedBy(rotation), OG_Util.IronedRoofDef); } } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), ref outpostData); Building_Storage rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; foreach (IntVec3 cell in rack.OccupiedRect().Cells) { OG_Common.SpawnResourceAt(ThingDefOf.ArtilleryShell, ThingDefOf.ArtilleryShell.stackLimit, cell, true); } rack.GetStoreSettings().filter.SetDisallowAll(); rack.GetStoreSettings().filter.SetAllow(ThingDefOf.ArtilleryShell, true); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; foreach (IntVec3 cell in rack.OccupiedRect().Cells) { OG_Common.SpawnResourceAt(ThingDefOf.ArtilleryShell, ThingDefOf.ArtilleryShell.stackLimit, cell, true); } rack.GetStoreSettings().filter.SetDisallowAll(); rack.GetStoreSettings().filter.SetAllow(ThingDefOf.ArtilleryShell, true); rack.GetStoreSettings().Priority = StoragePriority.Critical; OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin); }