private static void GenerateOneShootingLine(IntVec3 shootingPosition, Rot4 rotation, ref OG_OutpostData outpostData) { // Spawn floor. for (int xOffset = -1; xOffset <= 1; xOffset++) { for (int zOffset = -1; zOffset <= 9; zOffset++) { Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete); } } Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 2).RotatedBy(rotation), TerrainDef.Named("MetalTile")); Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 3).RotatedBy(rotation), TerrainDef.Named("PavedTile")); Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 4).RotatedBy(rotation), TerrainDef.Named("MetalTile")); Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 5).RotatedBy(rotation), TerrainDef.Named("PavedTile")); Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 6).RotatedBy(rotation), TerrainDef.Named("MetalTile")); Find.TerrainGrid.SetTerrain(shootingPosition + new IntVec3(0, 0, 7).RotatedBy(rotation), TerrainDef.Named("PavedTile")); // Spawn sandbags. OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(-1, 0, 0).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(-1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(0, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, shootingPosition + new IntVec3(1, 0, 0).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); // Spawn target. if (OG_Util.IsModActive("Misc. Training")) { OG_Common.TrySpawnThingAt(ThingDef.Named("ShootingRangeTarget"), null, shootingPosition + new IntVec3(0, 0, 8).RotatedBy(rotation), true, new Rot4(Rot4.South.AsInt + rotation.AsInt), ref outpostData); } else { OG_Common.TrySpawnWallAt(shootingPosition + new IntVec3(0, 0, 8).RotatedBy(rotation), ref outpostData); } }
public static void GenerateLaserFence(ZoneProperties[,] zoneMap, ref OG_OutpostData outpostData) { if (OG_Util.IsModActive("MiningCo. LaserFence") == false) { Log.Warning("MiningCo. OutpostGenerator: MiningCo. LaserFence mod is not active. Cannot generate laser fences."); return; } int horizontalZonesNumber = 0; int verticalZonesNumber = 0; if (outpostData.size == OG_OutpostSize.SmallOutpost) { horizontalZonesNumber = OG_SmallOutpost.horizontalZonesNumber; verticalZonesNumber = OG_SmallOutpost.verticalZonesNumber; GenerateLaseFenceForSmallOutpost(zoneMap, horizontalZonesNumber, verticalZonesNumber, ref outpostData); } else { horizontalZonesNumber = OG_BigOutpost.horizontalZonesNumber; verticalZonesNumber = OG_BigOutpost.verticalZonesNumber; GenerateLaseFenceForBigOutpost(zoneMap, horizontalZonesNumber, verticalZonesNumber, ref outpostData); } }
public static void GenerateWaterPoolZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData) { IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation); IntVec3 firstPatchCenter = rotatedOrigin + new IntVec3(4, 0, 4).RotatedBy(rotation); IntVec3 secondPatchCenter = rotatedOrigin + new IntVec3(7, 0, 7).RotatedBy(rotation); IntVec3 thirdPatchCenter = rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation); // Generate water patches. foreach (IntVec3 cell in GenRadial.RadialCellsAround(firstPatchCenter, 4.2f, true)) { Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Soil); } foreach (IntVec3 cell in GenRadial.RadialCellsAround(secondPatchCenter, 3.2f, true)) { Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Soil); } foreach (IntVec3 cell in GenRadial.RadialCellsAround(firstPatchCenter, 3.2f, true)) { Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterShallow")); } foreach (IntVec3 cell in GenRadial.RadialCellsAround(secondPatchCenter, 2f, true)) { Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterShallow")); } foreach (IntVec3 cell in GenRadial.RadialCellsAround(firstPatchCenter, 2f, true)) { Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterDeep")); } foreach (IntVec3 cell in GenRadial.RadialCellsAround(secondPatchCenter, 1f, true)) { Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterDeep")); } foreach (IntVec3 cell in GenRadial.RadialCellsAround(thirdPatchCenter, 1f, true)) { Find.TerrainGrid.SetTerrain(cell, TerrainDef.Named("WaterDeep")); } // Spawn fishing pier. if (OG_Util.IsModActive("FishIndustry")) { OG_Common.TrySpawnThingAt(ThingDef.Named("FishingPier"), null, rotatedOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), true, rotation, ref outpostData); } }
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); }
private void UpdateLord() { IntVec3 rallyPoint = IntVec3.Invalid; Log.Message("UpdateLord1"); // Check there is no already existing defense lord. if ((Find.LordManager.lords != null) && (Find.LordManager.lords.Count > 0)) { foreach (Lord lord in Find.LordManager.lords) { if ((lord.faction != null) && (lord.faction == OG_Util.FactionOfMiningCo)) { return; } } } Log.Message("UpdateLord2"); // Look for hostile in outpost perimeter. IntVec3 hostilePosition = FindHostileInPerimeter(); if (hostilePosition.IsValid) { Log.Message("UpdateLord2"); Area outpostArea = OG_Util.FindOutpostArea(); if ((outpostArea != null) && (outpostArea.ActiveCells.Contains(hostilePosition))) { Log.Message("UpdateLord4"); // Ennemy is inside outpost area. rallyPoint = hostilePosition; } else { Log.Message("UpdateLord5"); const int sectionsNumber = 100; Vector3 sectionVector = (this.outpostCenter - hostilePosition).ToVector3(); sectionVector = sectionVector / sectionsNumber; // Default value if OutpostArea does not exist (should not occur, just a safety...). rallyPoint = (hostilePosition.ToVector3() + sectionVector * 0.2f * (float)sectionsNumber).ToIntVec3(); for (int i = 1; i <= sectionsNumber; i++) { Vector3 potentialRallyPoint = hostilePosition.ToVector3() + sectionVector * i; if ((outpostArea != null) && (outpostArea.ActiveCells.Contains(potentialRallyPoint.ToIntVec3()))) { // Ensure rallyPoint is completely inside the outpost area. rallyPoint = (potentialRallyPoint + sectionVector * 0.1f * (float)sectionsNumber).ToIntVec3(); break; } } } } else { Log.Message("UpdateLord6"); // Look for damaged turret to defend. Rot4 turretRotation = Rot4.Invalid; IntVec3 turretPosition = IntVec3.Invalid; FindDamagedTurret(out turretPosition, out turretRotation); if (turretPosition.IsValid) { if (OG_Util.IsModActive("MiningCo. ForceField")) { // Look for nearest force field to cover behind. foreach (Thing thing in Find.ListerThings.ThingsOfDef(OG_Util.ForceFieldGeneratorDef)) { if (thing.Position.InHorDistOf(turretPosition, 23f)) { rallyPoint = thing.Position + new IntVec3(0, 0, -2).RotatedBy(thing.Rotation); break; } } } else { // Just go near the attacked turret. rallyPoint = turretPosition + new IntVec3(0, 0, -5).RotatedBy(turretRotation); } } } Log.Message("UpdateLord7"); if (rallyPoint.IsValid) { Log.Message("rallyPoint = " + rallyPoint.ToString()); // Generate defense lord. LordJob_Joinable_DefendOutpost lordJob = new LordJob_Joinable_DefendOutpost(rallyPoint); LordMaker.MakeNewLord(OG_Util.FactionOfMiningCo, lordJob); SoundDef soundDef = SoundDefOf.MessageSeriousAlert; // TODO: add a siren like in alert speaker! soundDef.PlayOneShot(rallyPoint); // Stop all pawns job. foreach (Pawn pawn in Find.MapPawns.AllPawns) { if ((pawn.Faction != null) && (pawn.Faction == OG_Util.FactionOfMiningCo) && (pawn.kindDef != OG_Util.OutpostTechnicianDef)) { pawn.ClearMind(); } } } }
public static void GenerateEntranchedZone(IntVec3 areaSouthWestOrigin, int zoneAbs, int zoneOrd, Rot4 rotation, ref OG_OutpostData outpostData) { IntVec3 rotatedOrigin = Zone.GetZoneRotatedOrigin(areaSouthWestOrigin, zoneAbs, zoneOrd, rotation); IntVec3 cell = rotatedOrigin; // Generate south west battery shelter. OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(0, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(3, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(0, 0, 3).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(3, 0, 3).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); for (int xOffset = 0; xOffset < 4; xOffset++) { for (int zOffset = 0; zOffset < 4; zOffset++) { cell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation); Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete); Find.RoofGrid.SetRoof(cell, OG_Util.IronedRoofDef); } } // Generate south east battery shelter. OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(7, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(10, 0, 0).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(7, 0, 3).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnWallAt(rotatedOrigin + new IntVec3(10, 0, 3).RotatedBy(rotation), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(8, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Battery, null, rotatedOrigin + new IntVec3(9, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); for (int xOffset = 7; xOffset < 11; xOffset++) { for (int zOffset = 0; zOffset < 4; zOffset++) { cell = rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation); Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete); Find.RoofGrid.SetRoof(cell, OG_Util.IronedRoofDef); } } // Generate central paved alley. for (int xOffset = 4; xOffset <= 6; xOffset++) { for (int zOffset = 0; zOffset < 7; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete); } } for (int zOffset = 0; zOffset < 7; zOffset++) { Find.TerrainGrid.SetTerrain(rotatedOrigin + new IntVec3(5, 0, zOffset).RotatedBy(rotation), TerrainDef.Named("PavedTile")); } // Generate north west force field. IntVec3 northWestOrigin = rotatedOrigin + new IntVec3(0, 0, 6).RotatedBy(rotation); for (int xOffset = 0; xOffset < 5; xOffset++) { for (int zOffset = 0; zOffset < 2; zOffset++) { Find.TerrainGrid.SetTerrain(northWestOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete); } } for (int xOffset = 1; xOffset <= 3; xOffset++) { Find.TerrainGrid.SetTerrain(northWestOrigin + new IntVec3(xOffset, 0, 2).RotatedBy(rotation), TerrainDefOf.Concrete); } OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northWestOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); for (int zOffset = -3; zOffset <= 3; zOffset++) { if ((zOffset == 1) && OG_Util.IsModActive("MiningCo. ForceField")) { // Do not spawn power conduit under force field as it generates a warning message. continue; } OG_Common.SpawnFireproofPowerConduitAt(northWestOrigin + new IntVec3(2, 0, zOffset).RotatedBy(rotation), ref outpostData); } if (OG_Util.IsModActive("MiningCo. ForceField")) { OG_Common.TrySpawnThingAt(OG_Util.ForceFieldGeneratorDef, null, northWestOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); } // Generate central sandbag. cell = rotatedOrigin + new IntVec3(5, 0, 7).RotatedBy(rotation); Find.TerrainGrid.SetTerrain(cell, TerrainDefOf.Concrete); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, cell, false, Rot4.Invalid, ref outpostData); // Generate north east force field. IntVec3 northEastOrigin = rotatedOrigin + new IntVec3(6, 0, 6).RotatedBy(rotation); for (int xOffset = 0; xOffset < 5; xOffset++) { for (int zOffset = 0; zOffset < 2; zOffset++) { Find.TerrainGrid.SetTerrain(northEastOrigin + new IntVec3(xOffset, 0, zOffset).RotatedBy(rotation), TerrainDefOf.Concrete); } } for (int xOffset = 1; xOffset <= 3; xOffset++) { Find.TerrainGrid.SetTerrain(northEastOrigin + new IntVec3(xOffset, 0, 2).RotatedBy(rotation), TerrainDefOf.Concrete); } OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(0, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(1, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(1, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(2, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(3, 0, 2).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(3, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); OG_Common.TrySpawnThingAt(ThingDefOf.Sandbags, null, northEastOrigin + new IntVec3(4, 0, 1).RotatedBy(rotation), false, Rot4.Invalid, ref outpostData); for (int zOffset = -3; zOffset <= 3; zOffset++) { if ((zOffset == 1) && OG_Util.IsModActive("MiningCo. ForceField")) { // Do not spawn power conduit under force field as it generates a warning message. continue; } OG_Common.SpawnFireproofPowerConduitAt(northEastOrigin + new IntVec3(2, 0, zOffset).RotatedBy(rotation), ref outpostData); } if (OG_Util.IsModActive("MiningCo. ForceField")) { OG_Common.TrySpawnThingAt(OG_Util.ForceFieldGeneratorDef, null, northEastOrigin + new IntVec3(2, 0, 1).RotatedBy(rotation), true, new Rot4(Rot4.North.AsInt + rotation.AsInt), ref outpostData); } }
private static void GeneratePawnApparelAndWeapon(ref Pawn pawn, PawnKindDef kindDef) { if (kindDef == OG_Util.OutpostOfficerDef) { GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Pants"), ThingDef.Named("Hyperweave"), pantColor); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_CollarShirt"), ThingDef.Named("Hyperweave"), shirtColor); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_VestPlate"), null, Color.black, false); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Duster"), ThingDef.Named("Hyperweave"), armorColor); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_CowboyHat"), ThingDef.Named("Hyperweave"), helmetColor); GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_SniperRifle")); } else if ((kindDef == OG_Util.OutpostHeavyGuardDef) || (kindDef == OG_Util.OutpostGuardDef)) { GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Pants"), ThingDef.Named("Synthread"), pantColor); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_BasicShirt"), ThingDef.Named("Synthread"), shirtColor); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_PowerArmor"), null, armorColor); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_PowerArmorHelmet"), null, helmetColor); if (kindDef == OG_Util.OutpostHeavyGuardDef) { GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_Minigun")); } else { GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_ChargeRifle")); } } else if (kindDef == OG_Util.OutpostScoutDef) { GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Pants"), ThingDef.Named("Synthread"), pantColor); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_BasicShirt"), ThingDef.Named("Synthread"), shirtColor); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_VestPlate"), null, Color.black, false); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_KevlarHelmet"), null, helmetColor); if (needParka) { GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Parka"), ThingDef.Named("Synthread"), armorColor); } GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_AssaultRifle")); } else if (kindDef == OG_Util.OutpostTechnicianDef) { GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Pants"), ThingDef.Named("Synthread"), colorCivilGrey); GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_CollarShirt"), ThingDef.Named("Synthread"), colorCivilGrey); if (OG_Util.IsModActive("MiningCo. MiningHelmet")) { GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("MiningHelmet"), null, Color.black, false); } else { if (Find.MapWorldSquare.temperature < 20f) { // Only give a tuque if temperature is low enough. GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Tuque"), ThingDef.Named("Synthread"), colorCivilGrey); } } if (needParka) { GeneratePawnApparel(ref pawn, kindDef.itemQuality, ThingDef.Named("Apparel_Parka"), ThingDef.Named("Synthread"), armorColor); } GeneratePawnWeapon(ref pawn, kindDef.itemQuality, ThingDef.Named("Gun_Pistol")); } }