public static GetZoneOrigin ( IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd ) : IntVec3 | ||
areaSouthWestOrigin | IntVec3 | |
zoneAbs | int | |
zoneOrd | int | |
Résultat | IntVec3 |
public static void GenerateWarfieldEffects(ZoneProperties[,] zoneMap, int horizontalZonesNumber, int verticalZonesNumber, OG_OutpostData outpostData) { bool battleZoneIsFound = false; int battleZoneAbs = 0; int battleZoneOrd = 0; if (outpostData.battleOccured == false) { return; } battleZoneIsFound = GetBattleZoneAbsAndOrd(zoneMap, horizontalZonesNumber, verticalZonesNumber, out battleZoneAbs, out battleZoneOrd); if (battleZoneIsFound == false) { Log.Warning("MiningCo. OutpostGenerator: failed to find an appropriate zone to generate warfield."); return; } Building_WarfieldGenerator warfieldGenerator = ThingMaker.MakeThing(ThingDef.Named("WarfieldGenerator")) as Building_WarfieldGenerator; warfieldGenerator.battleZoneAbs = battleZoneAbs; warfieldGenerator.battleZoneOrd = battleZoneOrd; warfieldGenerator.outpostData = outpostData; IntVec3 warfieldCenter = Zone.GetZoneOrigin(outpostData.areaSouthWestOrigin, battleZoneAbs, battleZoneOrd) + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset); GenSpawn.Spawn(warfieldGenerator, warfieldCenter); }
public static void GenerateSamSiteZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, ref OG_OutpostData outpostData) { IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); // Spawn SAM site surrounded by sandbags. IntVec3 samSitePosition = origin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset); OG_Common.TrySpawnThingAt(OG_Util.SamSiteDef, null, samSitePosition, false, Rot4.Invalid, ref outpostData); CellRect sandbagRect = new CellRect(origin.x + 3, origin.z + 3, 5, 5); foreach (IntVec3 cell in sandbagRect.Cells) { if ((cell.x == sandbagRect.minX) || (cell.x == sandbagRect.maxX) || (cell.z == sandbagRect.minZ) || (cell.z == sandbagRect.maxZ)) { OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData); } } for (int rotationAsInt = Rot4.North.AsInt; rotationAsInt <= Rot4.West.AsInt; rotationAsInt++) { IntVec3 sandbagPosition = samSitePosition + new IntVec3(0, 0, 3).RotatedBy(new Rot4(rotationAsInt)); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, sandbagPosition, false, Rot4.Invalid, ref outpostData); foreach (IntVec3 cell in GenAdj.CellsAdjacent8Way(sandbagPosition)) { Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete); } } // Generate concrete ground. CellRect concreteRect = new CellRect(origin.x + 2, origin.z + 2, 7, 7); foreach (IntVec3 cell in concreteRect.Cells) { Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete); } }
public static void GenerateSmallRoomWeaponRoom(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, smallRoomWallOffset).RotatedBy(rotation), Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, rotation, TerrainDefOf.Concrete, TerrainDef.Named("MetalTile"), ref outpostData); // Spawn weapon racks, weapons and lamps. Building_Storage rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 4, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 2, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.white, ref outpostData); // Spawn 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); }
public static void GenerateMediumRoomLaboratory(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), 9, 9, rotation, TerrainDefOf.Concrete, TerrainDef.Named("MetalTile"), ref outpostData); // Spawn research bench. OG_Common.TrySpawnThingAt(ThingDef.Named("HiTechResearchBench"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 5).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 5).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); // Spawn tool cabinet and uranium. OG_Common.TrySpawnThingAt(ThingDef.Named("ToolCabinet"), null, rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); IntVec3 studyObjectPosition = rotatedOrigin + new IntVec3(3, 0, 5).RotatedBy(rotation); Find.TerrainGrid.SetTerrain(studyObjectPosition, TerrainDef.Named("SterileTile")); OG_Common.SpawnResourceAt(ThingDef.Named("Uranium"), Rand.RangeInclusive(5, 18), studyObjectPosition, true); // Spawn lamps, heater and coolers. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(3, 0, 3).RotatedBy(rotation), Color.blue, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(1, 0, 5).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); // Spawn vertical alley and doors. for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData); }
public static void GenerateMediumRoomPrison(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), 5, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), 3, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(6, 0, 1).RotatedBy(rotation), 5, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData); // Spawn prisoner beds. OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn lamps, heaters and coolers. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(7, 0, 8).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 8).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 2).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 8).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); // Spawn vertical alley and door. for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(4, 0, 3).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(6, 0, 7).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData); }
public static void GenerateMediumRoomWarehouse(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData) { const int stockWidth = 3; const int stockHeight = 3; IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), 9, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData); // Spawn metal stock and lamp. OG_Common.TrySpawnResourceStock(rotatedOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), rotation, ThingDefOf.Steel, stockWidth, stockHeight, 0.6f, 10, 55); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), Color.white, ref outpostData); // Spawn wood stock and lamp. OG_Common.TrySpawnResourceStock(rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), rotation, ThingDefOf.WoodLog, stockWidth, stockHeight, 0.8f, 20, 75); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(8, 0, 2).RotatedBy(rotation), Color.white, ref outpostData); // Spawn gold stock and lamp. OG_Common.TrySpawnResourceStock(rotatedOrigin + new IntVec3(2, 0, 6).RotatedBy(rotation), rotation, ThingDefOf.Gold, stockWidth, stockHeight, 0.3f, 2, 25); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), Color.white, ref outpostData); // Spawn plasteel stock and lamp. OG_Common.TrySpawnResourceStock(rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation), rotation, ThingDefOf.Plasteel, stockWidth, stockHeight, 0.5f, 5, 35); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(8, 0, 8).RotatedBy(rotation), Color.white, ref outpostData); // Spawn vertical and horizontal alley and doors. for (int xOffset = 2; xOffset <= 8; xOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, 5).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData); }
public static void GenerateMediumRoomKitchen(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), 9, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData); // Spawn table and stools. OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); for (int xOffset = 2; xOffset <= 4; xOffset++) { for (int zOffset = 2; zOffset <= 5; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("WoodPlankFloor")); } } // Spawn cook stoves and brewery. OG_Common.TrySpawnThingAt(ThingDef.Named("ElectricStove"), null, rotatedOrigin + new IntVec3(8, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("ElectricStove"), null, rotatedOrigin + new IntVec3(8, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); for (int xOffset = 7; xOffset <= 8; xOffset++) { for (int zOffset = 2; zOffset <= 8; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("SterileTile")); Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset + 4).RotatedBy(rotation), TerrainDef.Named("SterileTile")); } } OG_Common.TrySpawnThingAt(ThingDef.Named("Brewery"), null, rotatedOrigin + new IntVec3(3, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); for (int xOffset = 2; xOffset <= 4; xOffset++) { for (int zOffset = 7; zOffset <= 8; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("SterileTile")); } } // Spawn lamps, heater and coolers. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(2, 0, 5).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(8, 0, 5).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(9, 0, 4).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(9, 0, 6).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); // Spawn vertical alley and doors. for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData); }
public static void GenerateMediumRoomWeaponRoom(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), 9, 9, rotation, TerrainDefOf.Concrete, null, ref outpostData); // Spawn weapon racks, weapons and lamps. Building_Storage rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(2, 0, 5).RotatedBy(rotation), Color.red, ref outpostData); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(8, 0, 5).RotatedBy(rotation), Color.red, ref outpostData); // Spawn vertical alley and doors. for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData); }
public static void GenerateMediumRoomRecRoom(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), 9, 9, rotation, TerrainDefOf.Concrete, TerrainDef.Named("WoodPlankFloor"), ref outpostData); // Spawn billiard table, chess table and chairs. OG_Common.TrySpawnThingAt(ThingDef.Named("BilliardsTable"), ThingDefOf.WoodLog, rotatedOrigin + new IntVec3(3, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("ChessTable"), ThingDefOf.WoodLog, rotatedOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); for (int xOffset = 2; xOffset <= 4; xOffset++) { for (int zOffset = 4; zOffset <= 8; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("CarpetGreen")); } } // Spawn television and armchairs. OG_Common.TrySpawnThingAt(ThingDef.Named("MegascreenTelevision"), null, rotatedOrigin + new IntVec3(7, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Armchair"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(6, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Armchair"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(7, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Armchair"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(8, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Armchair"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Armchair"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(7, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Armchair"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(8, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); for (int xOffset = 6; xOffset <= 8; xOffset++) { for (int zOffset = 4; zOffset <= 8; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("CarpetDark")); } } // Spawn lamps, heater and coolers. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(8, 0, 2).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(7, 0, 2).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(8, 0, 3).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(7, 0, 1).RotatedBy(rotation), new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(3, 0, 9).RotatedBy(rotation), new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn vertical alley and doors. for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData); }
public static void GenerateBigRoomHydroponics(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, TerrainDef.Named("SterileTile"), ref outpostData); // Spawn doors. OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 10).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(10, 0, 5).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(0, 0, 5).RotatedBy(rotation), ref outpostData); // Spawn sun lamp. OG_Common.TrySpawnThingAt(ThingDef.Named("SunLamp"), null, rotatedOrigin + new IntVec3(5, 0, 5).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); // Spawn hydroponics basins. Building_PlantGrower hydroponics = OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), true, rotation, ref outpostData) as Building_PlantGrower; hydroponics.SetPlantDefToGrow(ThingDef.Named("PlantStrawberry")); hydroponics = OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), true, rotation, ref outpostData) as Building_PlantGrower; hydroponics.SetPlantDefToGrow(ThingDef.Named("PlantCorn")); hydroponics = OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(4, 0, 2).RotatedBy(rotation), true, rotation, ref outpostData) as Building_PlantGrower; hydroponics.SetPlantDefToGrow(ThingDef.Named("PlantCorn")); hydroponics = OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), true, rotation, ref outpostData) as Building_PlantGrower; hydroponics.SetPlantDefToGrow(ThingDef.Named("PlantCorn")); hydroponics = OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(7, 0, 2).RotatedBy(rotation), true, rotation, ref outpostData) as Building_PlantGrower; hydroponics.SetPlantDefToGrow(ThingDef.Named("PlantCorn")); hydroponics = OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(9, 0, 2).RotatedBy(rotation), true, rotation, ref outpostData) as Building_PlantGrower; hydroponics.SetPlantDefToGrow(ThingDef.Named("PlantStrawberry")); OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(1, 0, 7).RotatedBy(rotation), true, rotation, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(3, 0, 7).RotatedBy(rotation), true, rotation, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), true, rotation, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(6, 0, 7).RotatedBy(rotation), true, rotation, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(7, 0, 7).RotatedBy(rotation), true, rotation, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("HydroponicsBasin"), null, rotatedOrigin + new IntVec3(9, 0, 7).RotatedBy(rotation), true, rotation, ref outpostData); // Spawn heaters and coolers. OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(2, 0, 9).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(8, 0, 9).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(2, 0, 0).RotatedBy(rotation), new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(8, 0, 0).RotatedBy(rotation), new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(2, 0, 10).RotatedBy(rotation), new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(8, 0, 10).RotatedBy(rotation), new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin); }
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); } } }
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); }
public static void GenerateDropZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, ref OG_OutpostData outpostData) { IntVec3 dropZoneOrigin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); IntVec3 sandbagsOrigin = dropZoneOrigin + new IntVec3(1, 0, 1); CellRect rect = new CellRect(sandbagsOrigin.x, sandbagsOrigin.z, 9, 9); foreach (IntVec3 cell in rect.Cells) { if (((cell.x == rect.minX) || (cell.x == rect.maxX) || (cell.z == rect.minZ) || (cell.z == rect.maxZ)) && ((cell.x != rect.CenterCell.x) && (cell.z != rect.CenterCell.z))) { OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.North, ref outpostData); } Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete); } OG_Common.GenerateHorizontalAndVerticalPavedAlleys(dropZoneOrigin); OG_Common.TrySpawnThingAt(ThingDef.Named("OrbitalTradeBeacon"), null, rect.CenterCell, false, Rot4.North, ref outpostData); Find.TerrainGrid.SetTerrain(rect.CenterCell, TerrainDef.Named("MetalTile")); outpostData.dropZoneCenter = rect.CenterCell; }
public static void GenerateBigRoomLivingRoom(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, null, ref outpostData); // Spawn table and stools. OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn NPD, hoppers and lamp. OG_Common.TrySpawnThingAt(ThingDefOf.NutrientPasteDispenser, null, rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(2, 0, 6).RotatedBy(rotation), TerrainDef.Named("PavedTile")); Building_Storage hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; hopper.GetStoreSettings().Priority = StoragePriority.Critical; hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; hopper.GetStoreSettings().Priority = StoragePriority.Critical; hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; hopper.GetStoreSettings().Priority = StoragePriority.Critical; OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), Color.white, ref outpostData); // Spawn TV and dining chairs. OG_Common.TrySpawnThingAt(ThingDef.Named("TubeTelevision"), null, rotatedOrigin + new IntVec3(8, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn lamp and temperature control. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(6, 0, 4).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 3).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 3).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 1).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin); }
public static void GenerateSmallRoomBarracks(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, smallRoomWallOffset).RotatedBy(rotation), Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, rotation, TerrainDefOf.Concrete, TerrainDef.Named("WoodPlankFloor"), ref outpostData); // Spawn beds, lamp and temperature control. OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.WoodLog, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.WoodLog, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.WoodLog, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.WoodLog, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.WoodLog, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 4, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 3).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 6, 0, smallRoomWallOffset + 3).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); // Spawn 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); }
public static IntVec3 GetZoneRotatedOrigin(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation) { IntVec3 zoneOrigin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); IntVec3 zoneRotatedOrigin = zoneOrigin; if (rotation == Rot4.North) { zoneRotatedOrigin = zoneOrigin; } else if (rotation == Rot4.East) { zoneRotatedOrigin = zoneOrigin + new IntVec3(0, 0, Genstep_GenerateOutpost.zoneSideSize - 1); } else if (rotation == Rot4.South) { zoneRotatedOrigin = zoneOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideSize - 1, 0, Genstep_GenerateOutpost.zoneSideSize - 1); } else if (rotation == Rot4.West) { zoneRotatedOrigin = zoneOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideSize - 1, 0, 0); } return(zoneRotatedOrigin); }
public static void GenerateBigRoomPrison(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, null, ref outpostData); // Spawn table and stools. OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn lamp and temperature control. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(7, 0, 9).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 9).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(7, 0, 10).RotatedBy(rotation), new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(9, 0, 10).RotatedBy(rotation), new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn prison cells' walls, door, bed, lamp and vent. // Cell 1. OG_Common.GenerateEmptyRoomAt(rotatedOrigin, 5, 5, rotation, TerrainDefOf.Concrete, null, ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), ref outpostData); Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(2, 0, 5).RotatedBy(rotation), TerrainDef.Named("PavedTile")); Thing bed = OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.WoodLog, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); //(bed as Building_Bed).ForPrisoners = true; // TODO: can't do it while generating map... OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.SpawnVentAt(rotatedOrigin + new IntVec3(1, 0, 4).RotatedBy(rotation), new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Cell 2. OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(6, 0, 0).RotatedBy(rotation), 5, 5, rotation, TerrainDefOf.Concrete, null, ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(8, 0, 4).RotatedBy(rotation), ref outpostData); Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(7, 0, 5).RotatedBy(rotation), TerrainDef.Named("PavedTile")); bed = OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.WoodLog, rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); //(bed as Building_Bed).ForPrisoners = true; // TODO: can't do it while generating map... OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(9, 0, 1).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.SpawnVentAt(rotatedOrigin + new IntVec3(9, 0, 4).RotatedBy(rotation), new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin); }
public static Building_OutpostCommandConsole GenerateCommandRoomZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 cardinal, Rot4 linkedZoneRelativeRotation, ref OG_OutpostData outpostData) { Building_OutpostCommandConsole CommandConsole = null; IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, cardinal); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, smallRoomWallOffset).RotatedBy(cardinal), Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, cardinal, TerrainDefOf.Concrete, null, ref outpostData); // Spawn command console. CommandConsole = OG_Common.TrySpawnThingAt(OG_Util.OutpostCommandConsoleDef, null, rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset + 2).RotatedBy(cardinal), true, new Rot4(Rot4.South.AsInt + cardinal.AsInt), ref outpostData) as Building_OutpostCommandConsole; // Generate vertical alley. for (int zOffset = smallRoomWallOffset; zOffset < Genstep_GenerateOutpost.zoneSideCenterOffset; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, zOffset).RotatedBy(cardinal), TerrainDef.Named("PavedTile")); } // Generate horizontal alley, door and lamp. if (linkedZoneRelativeRotation == Rot4.West) { for (int xOffset = smallRoomWallOffset - 2; xOffset <= Genstep_GenerateOutpost.zoneSideCenterOffset; xOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(cardinal), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(cardinal), ref outpostData); } else if (linkedZoneRelativeRotation == Rot4.East) { for (int xOffset = Genstep_GenerateOutpost.zoneSideCenterOffset; xOffset <= Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset + 1; xOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(cardinal), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(Genstep_GenerateOutpost.zoneSideSize - smallRoomWallOffset - 1, 0, Genstep_GenerateOutpost.zoneSideCenterOffset).RotatedBy(cardinal), ref outpostData); } OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 1).RotatedBy(cardinal), Color.red, ref outpostData); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 1).RotatedBy(cardinal), Color.red, ref outpostData); return(CommandConsole); }
public static void GenerateSmallRoomMedibay(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(smallRoomWallOffset, 0, smallRoomWallOffset).RotatedBy(rotation), Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, Genstep_GenerateOutpost.zoneSideSize - 2 * smallRoomWallOffset, rotation, TerrainDefOf.Concrete, TerrainDef.Named("CarpetBlue"), ref outpostData); // Spawn medbeds and lamp. OG_Common.TrySpawnThingAt(ThingDef.Named("HospitalBed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("HospitalBed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("HospitalBed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("HospitalBed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 5).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnResourceAt(ThingDefOf.Medicine, Rand.RangeInclusive(7, 32), rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 3).RotatedBy(rotation)); Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(smallRoomWallOffset + 1, 0, smallRoomWallOffset + 3).RotatedBy(rotation), TerrainDef.Named("MetalTile")); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 4, 0, smallRoomWallOffset + 3).RotatedBy(rotation), Color.blue, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 5, 0, smallRoomWallOffset + 3).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(smallRoomWallOffset + 6, 0, smallRoomWallOffset + 3).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); // Spawn 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); }
public static void GenerateBigRoomWarehouse(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData) { const int stockWidth = 4; const int stockHeight = 4; IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation); OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, null, ref outpostData); // Spawn metal stock and lamp. OG_Common.TrySpawnResourceStock(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), rotation, ThingDefOf.Steel, stockWidth, stockHeight, 0.6f, 10, 55); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), Color.white, ref outpostData); // Spawn wood stock and lamp. OG_Common.TrySpawnResourceStock(rotatedOrigin + new IntVec3(6, 0, 1).RotatedBy(rotation), rotation, ThingDefOf.WoodLog, stockWidth, stockHeight, 0.8f, 20, 75); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(9, 0, 1).RotatedBy(rotation), Color.white, ref outpostData); // Spawn gold stock and lamp. OG_Common.TrySpawnResourceStock(rotatedOrigin + new IntVec3(1, 0, 6).RotatedBy(rotation), rotation, ThingDefOf.Gold, stockWidth, stockHeight, 0.3f, 2, 25); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(1, 0, 9).RotatedBy(rotation), Color.white, ref outpostData); // Spawn plasteel stock and lamp. OG_Common.TrySpawnResourceStock(rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation), rotation, ThingDefOf.Plasteel, stockWidth, stockHeight, 0.5f, 5, 35); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(9, 0, 9).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin); }
public static Building_OrbitalRelay GenerateOrbitalRelayZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, ref OG_OutpostData outpostData) { Building_OrbitalRelay orbitalRelay = null; IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); // Spawn orbital relay. IntVec3 orbitalRelayPosition = origin + new IntVec3(Genstep_GenerateOutpost.zoneSideCenterOffset, 0, Genstep_GenerateOutpost.zoneSideCenterOffset); orbitalRelay = OG_Common.TrySpawnThingAt(OG_Util.OrbitalRelayDef, null, orbitalRelayPosition, false, Rot4.Invalid, ref outpostData) as Building_OrbitalRelay; // Spawn sandbags. OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(3, 0, 2), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(2, 0, 2), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(2, 0, 3), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(2, 0, 7), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(2, 0, 8), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(3, 0, 8), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(7, 0, 8), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(8, 0, 8), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(8, 0, 7), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(8, 0, 3), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(8, 0, 2), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, origin + new IntVec3(7, 0, 2), false, Rot4.Invalid, ref outpostData); // Generate concrete ground. foreach (IntVec3 cell in GenRadial.RadialPatternInRadius(2.8f)) { Find.TerrainGrid.SetTerrain(orbitalRelayPosition + cell, TerrainDefOf.Concrete); } return(orbitalRelay); }
public static void GenerateMediumRoomMedibay(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), 9, 9, rotation, TerrainDefOf.Concrete, TerrainDef.Named("SterileTile"), ref outpostData); // Spawn cryptosleep caskets and vitals monitors. OG_Common.TrySpawnThingAt(ThingDefOf.CryptosleepCasket, null, rotatedOrigin + new IntVec3(2, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("VitalsMonitor"), null, rotatedOrigin + new IntVec3(4, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.CryptosleepCasket, null, rotatedOrigin + new IntVec3(2, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("VitalsMonitor"), null, rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.CryptosleepCasket, null, rotatedOrigin + new IntVec3(8, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("VitalsMonitor"), null, rotatedOrigin + new IntVec3(6, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.CryptosleepCasket, null, rotatedOrigin + new IntVec3(8, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("VitalsMonitor"), null, rotatedOrigin + new IntVec3(6, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); // Spawn medicine and lamp. OG_Common.SpawnResourceAt(ThingDefOf.Medicine, Rand.RangeInclusive(14, 48), rotatedOrigin + new IntVec3(8, 0, 5).RotatedBy(rotation)); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(2, 0, 5).RotatedBy(rotation), Color.blue, ref outpostData); // Spawn heaters and coolers. OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(2, 0, 6).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(1, 0, 4).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(1, 0, 6).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); // Spawn vertical alley and doors. for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData); }
public void GenerateWarfield(int battleZoneAbs, int battleZoneOrd, OG_OutpostData outpostData) { // Get a random hostile faction. int securityForcesCorpseNumber = Rand.Range(2, 4); int hostilesCorpseNumber = 0; FactionDef hostileFactionDef = null; Faction hostileFaction = null; float hostileFactionSelector = Rand.Value; if (hostileFactionSelector < 0.25f) { hostileFactionDef = FactionDefOf.Tribe; hostileFaction = Find.FactionManager.FirstFactionOfDef(hostileFactionDef); hostilesCorpseNumber = Rand.Range(6, 8); } else if (hostileFactionSelector < 0.5f) { hostileFactionDef = FactionDefOf.Pirate; hostileFaction = Find.FactionManager.FirstFactionOfDef(hostileFactionDef); hostilesCorpseNumber = Rand.Range(3, 5); } else if (hostileFactionSelector < 0.75f) { hostileFactionDef = FactionDefOf.SpacerHostile; hostileFaction = Find.FactionManager.FirstFactionOfDef(hostileFactionDef); hostilesCorpseNumber = Rand.Range(3, 5); } else { hostileFactionDef = FactionDefOf.Mechanoid; hostileFaction = Find.FactionManager.FirstFactionOfDef(hostileFactionDef); hostilesCorpseNumber = Rand.Range(1, 3); } // Spawn corpses. IntVec3 zoneOrigin = Zone.GetZoneOrigin(outpostData.areaSouthWestOrigin, battleZoneAbs, battleZoneOrd); for (int corpseIndex = 0; corpseIndex < securityForcesCorpseNumber + hostilesCorpseNumber; corpseIndex++) { int tries = 3; // Max 3 tries per corpse. bool validPositionIsFound = false; IntVec3 corpsePosition = new IntVec3(); for (int tryIndex = 0; tryIndex < tries; tryIndex++) { corpsePosition = zoneOrigin + new IntVec3(Rand.Range(1, Genstep_GenerateOutpost.zoneSideSize - 1), 0, Rand.Range(1, Genstep_GenerateOutpost.zoneSideSize - 1)); if (corpsePosition.GetEdifice() == null) { validPositionIsFound = true; break; } } if (validPositionIsFound == false) { continue; } // Generate the corpse according to the faction. Pawn corpse = null; if (corpseIndex < securityForcesCorpseNumber) { corpse = PawnGenerator.GeneratePawn(OG_Util.OutpostScoutDef, OG_Util.FactionOfMAndCo); } else { float pawnKindSelector = Rand.Value; PawnKindDef corpseKindDef = null; if (hostileFactionDef == FactionDefOf.Tribe) { if (pawnKindSelector < 0.4f) { corpseKindDef = PawnKindDef.Named("TribalWarrior"); } else if (pawnKindSelector < 0.8f) { corpseKindDef = PawnKindDef.Named("TribalArcher"); } else { corpseKindDef = PawnKindDef.Named("TribalChief"); } } else if (hostileFactionDef == FactionDefOf.Pirate) { if (pawnKindSelector < 0.25f) { corpseKindDef = PawnKindDef.Named("Drifter"); } else if (pawnKindSelector < 0.50f) { corpseKindDef = PawnKindDef.Named("Scavenger"); } else if (pawnKindSelector < 0.75f) { corpseKindDef = PawnKindDef.Named("Thrasher"); } else { corpseKindDef = PawnKindDef.Named("Pirate"); } } else if (hostileFactionDef == FactionDefOf.SpacerHostile) { if (pawnKindSelector < 0.25f) { corpseKindDef = PawnKindDef.Named("SpaceSoldier"); } else if (pawnKindSelector < 0.50f) { corpseKindDef = PawnKindDef.Named("MercenaryGunner"); } else if (pawnKindSelector < 0.75f) { corpseKindDef = PawnKindDef.Named("GrenadierDestructive"); } else { corpseKindDef = PawnKindDef.Named("MercenaryElite"); } } else if (hostileFactionDef == FactionDefOf.Mechanoid) { if (pawnKindSelector < 0.6f) { corpseKindDef = PawnKindDef.Named("Scyther"); } else { corpseKindDef = PawnKindDef.Named("Centipede"); } } corpse = PawnGenerator.GeneratePawn(corpseKindDef, hostileFaction); } GenSpawn.Spawn(corpse, corpsePosition); // Damage the weapon so the warfield effect is not too exploitable (otherwise, player can get good guns at game start). if (corpse.equipment.Primary != null) { corpse.equipment.Primary.HitPoints = (int)(Rand.Range(0.05f, 0.30f) * corpse.equipment.Primary.MaxHitPoints); } // "Kill the corpse". HealthUtility.GiveInjuriesToKill(corpse); // Make it rotten if outpost is abandonned. if (this.outpostData.isInhabited == false) { List <Thing> thingsList = corpsePosition.GetThingList(); foreach (Thing thing in thingsList) { if (thing.def.defName.Contains("Corpse")) { CompRottable rotComp = thing.TryGetComp <CompRottable>(); if (rotComp != null) { rotComp.rotProgress = 20f * GenDate.TicksPerDay; // 20 days so the corpse is dessicated. } } } } } // Destroy some sandbags in the zone. List <Thing> sandbagsList = Find.ListerThings.ThingsOfDef(ThingDefOf.Sandbags); for (int sandbagIndex = sandbagsList.Count - 1; sandbagIndex >= 0; sandbagIndex--) { Thing sandbag = sandbagsList[sandbagIndex]; if (sandbag.Position.InHorDistOf(this.Position, Genstep_GenerateOutpost.zoneSideSize / 2f) && (Rand.Value < 0.1f)) { // Manually spawn sandbag rubble and use Vanish instead of Kill to avoid spawning ugly metal remains. GenSpawn.Spawn(ThingDef.Named("SandbagRubble"), sandbag.Position); sandbag.Destroy(DestroyMode.Vanish); } } }
public static void GenerateBigRoomBarracks(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, TerrainDef.Named("CarpetGreen"), ref outpostData); // Spawn doors. OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 10).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(10, 0, 5).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(0, 0, 5).RotatedBy(rotation), ref outpostData); // Spawn beds. OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Bed"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); // Generate shower room. for (int xOffset = 6; xOffset <= 9; xOffset++) { OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(xOffset, 0, 4).RotatedBy(rotation), ref outpostData); } for (int zOffset = 1; zOffset <= 4; zOffset++) { OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(6, 0, zOffset).RotatedBy(rotation), ref outpostData); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), ref outpostData); 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("SterileTile")); } } for (int xOffset = 6; xOffset <= 8; xOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, 2).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } // Spawn lamps. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(4, 0, 6).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(9, 0, 2).RotatedBy(rotation), Color.white, ref outpostData); // Spawn heaters and coolers. OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(1, 0, 9).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 9).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 9).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 9).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin); }
public static void GenerateOutpost(OG_OutpostData outpostDataParameter) { outpostData = outpostDataParameter; outpostData.triggerIntrusion = null; outpostData.outpostThingList = new List <Thing>(); // Reset zoneMap. for (int zoneOrd = 0; zoneOrd < verticalZonesNumber; zoneOrd++) { for (int zoneAbs = 0; zoneAbs < horizontalZonesNumber; zoneAbs++) { zoneMap[zoneOrd, zoneAbs] = new ZoneProperties(ZoneType.NotYetGenerated, Rot4.North, Rot4.North); } } // Clear the whole area and remove any roof. CellRect rect = new CellRect(outpostData.areaSouthWestOrigin.x - 1, outpostData.areaSouthWestOrigin.z - 1, areaSideLength + 2, areaSideLength + 2); foreach (IntVec3 cell in rect.Cells) { Find.RoofGrid.SetRoof(cell, null); List <Thing> thingList = cell.GetThingList(); for (int j = thingList.Count - 1; j >= 0; j--) { Thing thing = thingList[j]; if (thing.def.destroyable) { thing.Destroy(DestroyMode.Vanish); } } } // Create the intrusion trigger. outpostData.triggerIntrusion = (TriggerIntrusion)ThingMaker.MakeThing(ThingDef.Named("TriggerIntrusion")); GenSpawn.Spawn(outpostData.triggerIntrusion, rect.CenterCell); GenerateOutpostLayout(); // TODO: debug. Display the generated layout. /*for (int zoneOrd = 0; zoneOrd < verticalZonesNumber; zoneOrd++) * { * for (int zoneAbs = 0; zoneAbs < horizontalZonesNumber; zoneAbs++) * { * ZoneProperties zone = zoneMap[zoneOrd, zoneAbs]; * Log.Message("Layout: zoneMap[" + zoneOrd + "," + zoneAbs + "] => " + zone.zoneType.ToString() + "," + zone.rotation.ToString() + "," + zone.linkedZoneRelativeRotation.ToString()); * } * }*/ GenerateOutpostZones(outpostData.areaSouthWestOrigin); IntVec3 mainRoomZoneOrigin = Zone.GetZoneOrigin(outpostData.areaSouthWestOrigin, mainRoomZoneAbs, mainRoomZoneOrd); OG_Common.GenerateSas(mainRoomZoneOrigin + new IntVec3(5, 0, 10), Rot4.North, 3, smallRoomWallOffset * 2, ref outpostData); OG_Common.GenerateSas(mainRoomZoneOrigin + new IntVec3(10, 0, 5), Rot4.East, 3, smallRoomWallOffset * 2, ref outpostData); OG_Common.GenerateSas(mainRoomZoneOrigin + new IntVec3(5, 0, 0), Rot4.South, 3, smallRoomWallOffset * 2, ref outpostData); OG_Common.GenerateSas(mainRoomZoneOrigin + new IntVec3(0, 0, 5), Rot4.West, 3, smallRoomWallOffset * 2, ref outpostData); // Generate laser fences. OG_LaserFence.GenerateLaserFence(zoneMap, ref outpostData); // Generate battle remains. OG_WarfieldEffects.GenerateWarfieldEffects(zoneMap, horizontalZonesNumber, verticalZonesNumber, outpostData); // Damage outpost to reflect its history. OG_RuinEffects.GenerateRuinEffects(ref outpostData); // Don't generate permanent inhabitants for small outposts. Those are just used as a shack by exploration teams. // Initialize command console data. outpostData.outpostThingList = OG_Util.RefreshThingList(outpostData.outpostThingList); commandConsole.outpostThingList = outpostData.outpostThingList.ListFullCopy <Thing>(); commandConsole.dropZoneCenter = outpostData.dropZoneCenter; // Initialize intrusion trigger data. outpostData.triggerIntrusion.commandConsole = commandConsole; SendWelcomeLetter(outpostData); }
public static void GenerateBigRoomRefectory(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, TerrainDef.Named("CarpetDark"), ref outpostData); // Spawn doors. OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 10).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(10, 0, 5).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(0, 0, 5).RotatedBy(rotation), ref outpostData); // Spawn table and dining chairs. OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(3, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(4, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 4).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("DiningChair"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn NPD, hoppers and lamp. OG_Common.TrySpawnThingAt(ThingDefOf.NutrientPasteDispenser, null, rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); Building_Storage hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; hopper.GetStoreSettings().Priority = StoragePriority.Critical; OG_Common.SpawnResourceAt(ThingDefOf.RawPotatoes, ThingDefOf.RawPotatoes.stackLimit, rotatedOrigin + new IntVec3(4, 0, 9).RotatedBy(rotation), true); hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; hopper.GetStoreSettings().Priority = StoragePriority.Critical; OG_Common.SpawnResourceAt(ThingDef.Named("RawCorn"), ThingDef.Named("RawCorn").stackLimit, rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), true); hopper = OG_Common.TrySpawnThingAt(ThingDefOf.Hopper, null, rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; hopper.GetStoreSettings().Priority = StoragePriority.Critical; OG_Common.SpawnResourceAt(ThingDef.Named("RawBerries"), ThingDef.Named("RawBerries").stackLimit, rotatedOrigin + new IntVec3(4, 0, 7).RotatedBy(rotation), true); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(4, 0, 6).RotatedBy(rotation), Color.white, ref outpostData); for (int xOffset = 1; xOffset <= 4; xOffset++) { for (int zOffset = 6; zOffset <= 9; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("SterileTile")); } } // Generate food racks. for (int xOffset = 6; xOffset <= 9; xOffset++) { for (int zOffset = 6; zOffset <= 9; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("SterileTile")); } } OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(6, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 6).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(OG_Util.FoodRackDef, ThingDefOf.Steel, rotatedOrigin + new IntVec3(9, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); for (int xOffset = 6; xOffset <= 7; xOffset++) { for (int zOffset = 6; zOffset <= 9; zOffset++) { IntVec3 cell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation); OG_Common.SpawnResourceAt(ThingDefOf.MealSurvivalPack, ThingDefOf.MealSurvivalPack.stackLimit, cell, true); } } for (int zOffset = 6; zOffset <= 9; zOffset++) { IntVec3 cell = rotatedOrigin + new IntVec3(9, 0, zOffset).RotatedBy(rotation); OG_Common.SpawnResourceAt(ThingDefOf.Beer, ThingDefOf.Beer.stackLimit, cell, true); } // Spawn lamp and temperature control. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(6, 0, 4).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(9, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 2).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 1).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(10, 0, 2).RotatedBy(rotation), new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin); }
public static Building_OutpostCommandConsole GenerateBigRoomCommandRoom(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData) { Building_OutpostCommandConsole commandConsole = null; IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation); OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, TerrainDef.Named("CarpetDark"), ref outpostData); // Spawn doors. OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 10).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(10, 0, 5).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(0, 0, 5).RotatedBy(rotation), ref outpostData); // Spawn weapon racks. Building_Storage rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; rack = OG_Common.TrySpawnThingAt(ThingDefOf.EquipmentRack, ThingDefOf.Steel, rotatedOrigin + new IntVec3(1, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData) as Building_Storage; OG_Common.TrySpawnWeaponOnRack(rack); rack.GetStoreSettings().filter.SetAllow(ThingCategoryDef.Named("WeaponsMelee"), false); rack.GetStoreSettings().Priority = StoragePriority.Critical; // Spawn lamps. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(9, 0, 9).RotatedBy(rotation), Color.white, ref outpostData); // Spawn table and stools. OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(7, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("Stool"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("TableShort"), ThingDefOf.Steel, rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn outpost command console, battery and spare parts cabinet. OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(1, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(OG_Util.SparePartsCabinetDef, null, rotatedOrigin + new IntVec3(1, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnResourceAt(ThingDefOf.Component, 10, rotatedOrigin + new IntVec3(1, 0, 7).RotatedBy(rotation), true); OG_Common.SpawnResourceAt(ThingDefOf.Component, 10, rotatedOrigin + new IntVec3(1, 0, 6).RotatedBy(rotation), true); commandConsole = OG_Common.TrySpawnThingAt(OG_Util.OutpostCommandConsoleDef, null, rotatedOrigin + new IntVec3(3, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData) as Building_OutpostCommandConsole; // Spawn workbenches. OG_Common.TrySpawnThingAt(ThingDef.Named("TableMachining"), null, rotatedOrigin + new IntVec3(7, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("ElectricSmithy"), null, rotatedOrigin + new IntVec3(9, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); // Spawn heaters and coolers. OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(1, 0, 4).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(1, 0, 0).RotatedBy(rotation), new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); // Spawn floor and tactical computer. for (int xOffset = 0; xOffset <= 10; xOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, 5).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } CellRect rect = new CellRect(origin.x + 3, origin.z + 3, 5, 5); foreach (IntVec3 cell in rect) { Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("PavedTile")); } foreach (IntVec3 cell in rect.ContractedBy(1)) { Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("CarpetRed")); } if (OG_Util.IsModActive("Misc. Incidents")) { OG_Common.TrySpawnThingAt(ThingDef.Named("TacticalComputer"), null, rotatedOrigin + new IntVec3(5, 0, 5).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); } return(commandConsole); }
public static void GenerateBigRoomBatteryRoom(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ZoneProperties[,] zoneMap, ref OG_OutpostData outpostData) { IntVec3 origin = Zone.GetZoneOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd); IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation); OG_Common.GenerateEmptyRoomAt(rotatedOrigin, Genstep_GenerateOutpost.zoneSideSize, Genstep_GenerateOutpost.zoneSideSize, rotation, TerrainDefOf.Concrete, TerrainDef.Named("MetalTile"), ref outpostData); // Spawn doors. OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 10).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(10, 0, 5).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(0, 0, 5).RotatedBy(rotation), ref outpostData); // Spawn generators. OG_Common.TrySpawnThingAt(OG_Util.CompactAutonomousGeneratorDef, null, rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(OG_Util.CompactAutonomousGeneratorDef, null, rotatedOrigin + new IntVec3(1, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(OG_Util.CompactAutonomousGeneratorDef, null, rotatedOrigin + new IntVec3(8, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn batteries. OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(1, 0, 3).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(1, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(3, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.East.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(9, 0, 7).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(7, 0, 9).RotatedBy(rotation), true, new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); // Spawn power controller. OG_Common.TrySpawnThingAt(ThingDef.Named("MultiAnalyzer"), null, rotatedOrigin + new IntVec3(7, 0, 2).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); // Spawn lamp and vents. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(3, 0, 7).RotatedBy(rotation), Color.blue, ref outpostData); for (int cardinalAsInt = 0; cardinalAsInt < 4; cardinalAsInt++) { Rot4 cardinal = new Rot4(cardinalAsInt); int adjacentZoneAbs = 0; int adjacentZoneOrd = 0; Zone.GetAdjacentZone(zoneAbs, zoneOrd, cardinal, out adjacentZoneAbs, out adjacentZoneOrd); if (zoneMap[adjacentZoneOrd, adjacentZoneAbs].zoneType == ZoneType.SolarPanelZone) { if (cardinal == Rot4.North) { OG_Common.SpawnVentAt(origin + new IntVec3(4, 0, 10), Rot4.North, ref outpostData); OG_Common.SpawnVentAt(origin + new IntVec3(6, 0, 10), Rot4.North, ref outpostData); } else if (cardinal == Rot4.East) { OG_Common.SpawnVentAt(origin + new IntVec3(10, 0, 4), Rot4.East, ref outpostData); OG_Common.SpawnVentAt(origin + new IntVec3(10, 0, 6), Rot4.East, ref outpostData); } else if (cardinal == Rot4.South) { OG_Common.SpawnVentAt(origin + new IntVec3(4, 0, 0), Rot4.South, ref outpostData); OG_Common.SpawnVentAt(origin + new IntVec3(6, 0, 0), Rot4.West, ref outpostData); } else if (cardinal == Rot4.West) { OG_Common.SpawnVentAt(origin + new IntVec3(0, 0, 4), Rot4.West, ref outpostData); OG_Common.SpawnVentAt(origin + new IntVec3(0, 0, 6), Rot4.West, ref outpostData); } } } OG_Common.GenerateHorizontalAndVerticalPavedAlleys(origin); }
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); }
public static void GenerateMediumRoomBarn(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); OG_Common.GenerateEmptyRoomAt(rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), 9, 9, rotation, TerrainDefOf.Concrete, TerrainDefOf.Soil, ref outpostData); // Generate animal feed room. for (int xOffset = 2; xOffset <= 4; xOffset++) { OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(xOffset, 0, 5).RotatedBy(rotation), ref outpostData); } for (int zOffset = 2; zOffset <= 5; zOffset++) { OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(4, 0, zOffset).RotatedBy(rotation), ref outpostData); } IntVec3 doorPosition = rotatedOrigin + new IntVec3(4, 0, 3).RotatedBy(rotation); OG_Common.SpawnDoorAt(doorPosition, ref outpostData); Find.TerrainGrid.SetTerrain(doorPosition, TerrainDef.Named("PavedTile")); for (int xOffset = 2; xOffset <= 3; xOffset++) { for (int zOffset = 2; zOffset <= 4; zOffset++) { IntVec3 fridgeCell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation); Find.TerrainGrid.SetTerrain(fridgeCell, TerrainDef.Named("SterileTile")); if ((zOffset == 2) || (zOffset == 4)) { Thing hayStack = ThingMaker.MakeThing(ThingDef.Named("Hay")); hayStack.stackCount = ThingDef.Named("Hay").stackLimit; GenSpawn.Spawn(hayStack, fridgeCell); } } } // Spawn animal beds. OG_Common.TrySpawnThingAt(ThingDef.Named("AnimalBed"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(2, 0, 6).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("AnimalBed"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(2, 0, 8).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("AnimalBed"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(4, 0, 8).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("AnimalBed"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(6, 0, 8).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("AnimalBed"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(8, 0, 8).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("AnimalBed"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(8, 0, 6).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("AnimalBed"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(8, 0, 4).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("AnimalBed"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(8, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDef.Named("AnimalBed"), ThingDef.Named("Cloth"), rotatedOrigin + new IntVec3(6, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); // Spawn lamp, heater and coolers. OG_Common.TrySpawnLampAt(rotatedOrigin + new IntVec3(6, 0, 5).RotatedBy(rotation), Color.white, ref outpostData); OG_Common.TrySpawnHeaterAt(rotatedOrigin + new IntVec3(8, 0, 5).RotatedBy(rotation), ref outpostData); Building_Cooler cooler = OG_Common.SpawnCoolerAt(rotatedOrigin + new IntVec3(1, 0, 3).RotatedBy(rotation), new Rot4(Rot4.West.AsInt + rotation.AsInt), ref outpostData); cooler.compTempControl.targetTemperature = 5f; // Spawn vertical alley and doors. for (int zOffset = 0; zOffset <= 10; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 1).RotatedBy(rotation), ref outpostData); OG_Common.SpawnDoorAt(rotatedOrigin + new IntVec3(5, 0, 9).RotatedBy(rotation), ref outpostData); }