public override void PassingParameters(ResolveParams rp) { _ = BaseGen.globalSettings.map; //Faction values are read in reverse of their push. // Programmed like: Checkpoint doors -> Lobby -> Edge Walls -> Floor -> Clear // Read Like: Clear -> Floor -> Edge Walls -> Lobby -> Chokepoint doors // // Tip: // Doors must be defined in the program first to avoid region errors. //ROOF if (!rp.noRoof.HasValue || !rp.noRoof.Value) { BaseGen.symbolStack.Push("roof", rp); } //DOORS //ResolveParams resolveParams0 = rp; //BaseGen.symbolStack.Push("agencyDoorsNSEW", resolveParams0); //East Wing var eastParams = rp; _ = IntVec3.Invalid; eastParams.rect = FactionUtility.AdjacentRectMaker(rp.rect, Rot4.East, out var doorLoc, (int)RectSizeValues.HALLWAYLENGTH, (int)RectSizeValues.HALLWAYSIZE); var resolveParamsDoor1 = rp; resolveParamsDoor1.rect = CellRect.SingleCell(doorLoc); resolveParamsDoor1.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker; BaseGen.symbolStack.Push("thing", resolveParamsDoor1); BaseGen.symbolStack.Push("agencyContainmentWing", eastParams); //West Wing var westParams = rp; _ = IntVec3.Invalid; westParams.rect = FactionUtility.AdjacentRectMaker(rp.rect, Rot4.West, out var doorLoc2, (int)RectSizeValues.HALLWAYLENGTH, (int)RectSizeValues.HALLWAYSIZE); var resolveParamsDoor2 = rp; resolveParamsDoor2.rect = CellRect.SingleCell(doorLoc2); resolveParamsDoor2.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker; BaseGen.symbolStack.Push("thing", resolveParamsDoor2); BaseGen.symbolStack.Push("agencyInvestigationWing", westParams); //North Wing //Hallway var northParams = rp; _ = IntVec3.Invalid; northParams.rect = FactionUtility.AdjacentRectMaker(rp.rect, Rot4.North, out var doorLoc3, (int)RectSizeValues.HALLWAYSIZE, (int)RectSizeValues.HALLWAYLENGTH); _ = ThingMaker.MakeThing(CthulhuFactionsDefOf.ROM_TemporaryDoorMarker); var resolveParamsDoor3 = rp; resolveParamsDoor3.rect = CellRect.SingleCell(doorLoc3); resolveParamsDoor3.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker; BaseGen.symbolStack.Push("thing", resolveParamsDoor3); //More var northParams2 = northParams; _ = IntVec3.Invalid; northParams2.rect = FactionUtility.AdjacentRectMaker(northParams.rect, Rot4.North, out var doorLoc4, (int)RectSizeValues.HALLWAYSIZE, (int)RectSizeValues.HALLWAYLENGTH); var resolveParamsDoor4 = rp; resolveParamsDoor4.rect = CellRect.SingleCell(doorLoc4); resolveParamsDoor4.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker; BaseGen.symbolStack.Push("thing", resolveParamsDoor4); BaseGen.symbolStack.Push("edgeWalls", northParams); BaseGen.symbolStack.Push("floor", northParams); BaseGen.symbolStack.Push("agencyLivingQuartersWing", northParams2); //Fill Lobby BaseGen.symbolStack.Push("agencyFillLobby", rp); //CLEAR/FLOOR/WALLS var resolveParams2 = rp; resolveParams2.wallStuff = DefaultWallDef; BaseGen.symbolStack.Push("edgeWalls", resolveParams2); var resolveParams3 = rp; resolveParams3.floorDef = DefaultFloorDef; BaseGen.symbolStack.Push("floor", resolveParams3); //ResolveParams resolveParams5 = rp; //IntVec3 bldLoc = resolveParams0.rect.CenterCell; //Thing regBar = ThingMaker.MakeThing(ThingDefOf.TemporaryRegionBarrier); //GenSpawn.Spawn(regBar, bldLoc, map); //GenSpawn.Spawn(ThingMaker.MakeThing(ThingDef.Named("Factions_AgencySymbol"), null), bldLoc, map); //regBar.Destroy(DestroyMode.Vanish); }
public override void PostPassingParameters(ResolveParams rp) { rp.faction = Find.FactionManager.AllFactions.FirstOrDefault(x => x.def.defName == "TheAgency"); //BaseGen.symbolStack.Push("agencyDoorsNSEW", rp); // If we're wider, then we're horizontal. // This is later passed so we can have vertical hallways intersect our center. if (rp.rect.Width > rp.rect.Height) { greaterWidth = true; } var rectRots = new List <CellRectRot>(FactionUtility.AdjacentHallwayAreas(rp.rect, out var doorLocs)); foreach (var doorLoc in doorLocs) { var resolveParamsDoor = rp; resolveParamsDoor.rect = CellRect.SingleCell(doorLoc); resolveParamsDoor.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker; BaseGen.symbolStack.Push("thing", resolveParamsDoor); } foreach (var rectrot in rectRots.InRandomOrder()) { var current = rectrot.Rect; /////////////////////////// Containment Cells /////////////////////////// if (!spawnedCells) { spawnedCells = true; var resolveParamsCells = rp; resolveParamsCells.wallStuff = DefaultWallDef; resolveParamsCells.floorDef = DefaultFloorDef; resolveParamsCells.rect = current; //ROOF if (!rp.noRoof.HasValue || !rp.noRoof.Value) { BaseGen.symbolStack.Push("roof", resolveParamsCells); } //BaseGen.symbolStack.Push("agencyDoorsNSEW", resolveParamsCells); BaseGen.symbolStack.Push("edgeWalls", resolveParamsCells); if (greaterWidth) { if (rectrot.Rot == Rot4.West || rectrot.Rot == Rot4.East) { BaseGen.symbolStack.Push("agencyCellsH", resolveParamsCells); } else { BaseGen.symbolStack.Push("agencyCells", resolveParamsCells); } } else { if (rectrot.Rot == Rot4.North || rectrot.Rot == Rot4.South) { BaseGen.symbolStack.Push("agencyCells", resolveParamsCells); } else { BaseGen.symbolStack.Push("agencyCellsH", resolveParamsCells); } } BaseGen.symbolStack.Push("floor", resolveParamsCells); continue; } /////////////////////////// Storage /////////////////////////////// if (!spawnedStorage) { spawnedStorage = true; var resolveParamsCells = rp; resolveParamsCells.floorDef = DefaultFloorDef; resolveParamsCells.wallStuff = DefaultWallDef; resolveParamsCells.rect = current; //ROOF if (!rp.noRoof.HasValue || !rp.noRoof.Value) { BaseGen.symbolStack.Push("roof", resolveParamsCells); } BaseGen.symbolStack.Push("edgeWalls", resolveParamsCells); if (greaterWidth) { if (rectrot.Rot == Rot4.West || rectrot.Rot == Rot4.East) { BaseGen.symbolStack.Push("agencyStorageH", resolveParamsCells); } else { BaseGen.symbolStack.Push("agencyStorage", resolveParamsCells); } } else { if (rectrot.Rot == Rot4.North || rectrot.Rot == Rot4.South) { BaseGen.symbolStack.Push("agencyStorage", resolveParamsCells); } else { BaseGen.symbolStack.Push("agencyStorageH", resolveParamsCells); } } BaseGen.symbolStack.Push("floor", resolveParamsCells); continue; } ///////////////////////// MERF OPERATIONS ROOM ///////////////// //Lord singlePawnLord = rp.singlePawnLord ?? LordMaker.MakeNewLord(rp.faction, new LordJob_DefendBase(rp.faction, current.CenterCell), map, null); //ResolveParams resolveParams = rp; //resolveParams.rect = current.ContractedBy(2); //for (int i = 0; i < Rand.Range(4, 8); i++) //{ // Cthulhu.Utility.SpawnPawnsOfCountAt(PawnKindDef.Named("MERF"), resolveParams.rect.Cells.RandomElement<IntVec3>(), map, 1, rp.faction); //} //ROOF var resolveParamsMERF = rp; resolveParamsMERF.rect = current; resolveParamsMERF.floorDef = DefaultFloorDef; resolveParamsMERF.wallStuff = DefaultWallDef; //ROOF if (!rp.noRoof.HasValue || !rp.noRoof.Value) { BaseGen.symbolStack.Push("roof", resolveParamsMERF); } //BaseGen.symbolStack.Push("agencyDoorsNSEW", resolveParamsMERF); BaseGen.symbolStack.Push("edgeWalls", resolveParamsMERF); BaseGen.symbolStack.Push("agencyFillMERF", resolveParamsMERF); //BaseGen.symbolStack.Push("barracks", resolveParamsOffice); BaseGen.symbolStack.Push("floor", resolveParamsMERF); BaseGen.symbolStack.Push("clear", resolveParamsMERF); } spawnedCells = false; spawnedStorage = false; FactionUtility.RectReport(rp.rect); }
public override void PostPassingParameters(ResolveParams rp) { //BaseGen.symbolStack.Push("agencyDoorsNSEW", rp); // If we're wider, then we're horizontal. // This is later passed so we can have vertical hallways intersect our center. if (rp.rect.Width > rp.rect.Height) { greaterWidth = true; } _ = new List <IntVec3>(); var rectRots = new List <CellRectRot>(FactionUtility.AdjacentHallwayAreas(rp.rect, out var doorLocs)); foreach (var doorLoc in doorLocs) { var resolveParamsDoor = rp; resolveParamsDoor.rect = CellRect.SingleCell(doorLoc); resolveParamsDoor.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker; BaseGen.symbolStack.Push("thing", resolveParamsDoor); } foreach (var rectrot in rectRots.InRandomOrder()) { var current = rectrot.Rect; /////////////////////////// OFFICES /////////////////////////// if (!spawnedOffice) { spawnedOffice = true; var resolveParamsOffice = rp; resolveParamsOffice.wallStuff = DefaultWallDef; resolveParamsOffice.floorDef = DefaultFloorDef; resolveParamsOffice.rect = current; //ROOF if (!rp.noRoof.HasValue || !rp.noRoof.Value) { BaseGen.symbolStack.Push("roof", resolveParamsOffice); } //BaseGen.symbolStack.Push("agencyDoorsNSEW", resolveParamsOffice); BaseGen.symbolStack.Push("edgeWalls", resolveParamsOffice); if (greaterWidth) { if (rectrot.Rot == Rot4.West || rectrot.Rot == Rot4.East) { BaseGen.symbolStack.Push("agencyOfficeSpaceH", resolveParamsOffice); } else { BaseGen.symbolStack.Push("agencyOfficeSpace", resolveParamsOffice); } } else { if (rectrot.Rot == Rot4.North || rectrot.Rot == Rot4.South) { BaseGen.symbolStack.Push("agencyOfficeSpace", resolveParamsOffice); } else { BaseGen.symbolStack.Push("agencyOfficeSpaceH", resolveParamsOffice); } } BaseGen.symbolStack.Push("floor", resolveParamsOffice); BaseGen.symbolStack.Push("clear", resolveParamsOffice); continue; } /////////////////////////// RESEARCH /////////////////////////////// if (!spawnedResearchStation) { spawnedResearchStation = true; var resolveParamsLab = rp; resolveParamsLab.rect = current; resolveParamsLab.floorDef = DefaultFloorDef; resolveParamsLab.wallStuff = DefaultWallDef; //ROOF if (!rp.noRoof.HasValue || !rp.noRoof.Value) { BaseGen.symbolStack.Push("roof", resolveParamsLab); } //BaseGen.symbolStack.Push("agencyDoorsNSEW", resolveParamsLab); BaseGen.symbolStack.Push("edgeWalls", resolveParamsLab); BaseGen.symbolStack.Push("fillWithResearchBenches", resolveParamsLab); //BaseGen.symbolStack.Push("barracks", resolveParamsOffice); BaseGen.symbolStack.Push("floor", resolveParamsLab); BaseGen.symbolStack.Push("clear", resolveParamsLab); continue; } ///////////////////////// INTERROGATIONS ///////////////// //ROOF var resolveParamsTemp = rp; resolveParamsTemp.rect = current; resolveParamsTemp.wallStuff = DefaultWallDef; resolveParamsTemp.floorDef = DefaultFloorDef; BaseGen.symbolStack.Push("roof", resolveParamsTemp); //BaseGen.symbolStack.Push("agencyDoorsNSEW", resolveParamsTemp); BaseGen.symbolStack.Push("edgeWalls", resolveParamsTemp); if (greaterWidth) { if (rectrot.Rot == Rot4.West || rectrot.Rot == Rot4.East) { BaseGen.symbolStack.Push("agencyInterrogationsH", resolveParamsTemp); } else { BaseGen.symbolStack.Push("agencyInterrogations", resolveParamsTemp); } } else { if (rectrot.Rot == Rot4.North || rectrot.Rot == Rot4.South) { BaseGen.symbolStack.Push("agencyInterrogations", resolveParamsTemp); } else { BaseGen.symbolStack.Push("agencyInterrogationsH", resolveParamsTemp); } } BaseGen.symbolStack.Push("floor", resolveParamsTemp); BaseGen.symbolStack.Push("clear", resolveParamsTemp); } spawnedOffice = false; spawnedResearchStation = false; FactionUtility.RectReport(rp.rect); }
public override void PostPassingParameters(ResolveParams rp) { //BaseGen.symbolStack.Push("agencyDoorsNSEW", rp); // If we're wider, then we're horizontal. // This is later passed so we can have vertical hallways intersect our center. if (rp.rect.Width > rp.rect.Height) { greaterWidth = true; } _ = new List <IntVec3>(); var rectRots = new List <CellRectRot>(FactionUtility.AdjacentHallwayAreas(rp.rect, out var doorLocs)); foreach (var doorLoc in doorLocs) { var resolveParamsDoor = rp; resolveParamsDoor.rect = CellRect.SingleCell(doorLoc); resolveParamsDoor.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker; BaseGen.symbolStack.Push("thing", resolveParamsDoor); } foreach (var rectrot in rectRots.InRandomOrder()) { var current = rectrot.Rect; /////////////////////////// Sleeping Quarters /////////////////////////// //if (!spawnedCells) //{ // spawnedCells = true; var resolveParamsCells = rp; resolveParamsCells.wallStuff = DefaultWallDef; resolveParamsCells.floorDef = DefaultFloorDef; resolveParamsCells.rect = current; //ROOF if (!rp.noRoof.HasValue || !rp.noRoof.Value) { BaseGen.symbolStack.Push("roof", resolveParamsCells); } //BaseGen.symbolStack.Push("agencyDoorsNSEW", resolveParamsCells); BaseGen.symbolStack.Push("edgeWalls", resolveParamsCells); if (greaterWidth) { if (rectrot.Rot == Rot4.West || rectrot.Rot == Rot4.East) { BaseGen.symbolStack.Push("agencyBedroomsH", resolveParamsCells); } else { BaseGen.symbolStack.Push("agencyBedrooms", resolveParamsCells); } } else { if (rectrot.Rot == Rot4.North || rectrot.Rot == Rot4.South) { BaseGen.symbolStack.Push("agencyBedrooms", resolveParamsCells); } else { BaseGen.symbolStack.Push("agencyBedroomsH", resolveParamsCells); } } BaseGen.symbolStack.Push("floor", resolveParamsCells); // continue; //} /////////////////////////// Mess Hall /////////////////////////////// //if (!spawnedStorage) //{ // spawnedStorage = true; // ResolveParams resolveParamsCells = rp; // resolveParamsCells.wallStuff = defaultWallDef; // resolveParamsCells.floorDef = defaultFloorDef; // resolveParamsCells.rect = current; // ///ROOF // if (!rp.noRoof.HasValue || !rp.noRoof.Value) // BaseGen.symbolStack.Push("roof", resolveParamsCells); // BaseGen.symbolStack.Push("edgeWalls", resolveParamsCells); // if (greaterWidth) // { // if (rectrot.Rot == Rot4.West || rectrot.Rot == Rot4.East) // { // BaseGen.symbolStack.Push("agencyMessHallH", resolveParamsCells); // } // else BaseGen.symbolStack.Push("agencyMessHall", resolveParamsCells); // } // else // { // if (rectrot.Rot == Rot4.North || rectrot.Rot == Rot4.South) // { // BaseGen.symbolStack.Push("agencyMessHall", resolveParamsCells); // } // else BaseGen.symbolStack.Push("agencyMessHallH", resolveParamsCells); // } // BaseGen.symbolStack.Push("floor", resolveParamsCells); // continue; //} ///////////////////////// Manufacture ///////////////// /////ROOF //ResolveParams resolveParamsTemp = rp; //resolveParamsTemp.rect = current; //resolveParamsTemp.wallStuff = defaultWallDef; //resolveParamsTemp.floorDef = defaultFloorDef; //BaseGen.symbolStack.Push("roof", resolveParamsTemp); ////BaseGen.symbolStack.Push("agencyDoorsNSEW", resolveParamsTemp); //BaseGen.symbolStack.Push("edgeWalls", resolveParamsTemp); //if (greaterWidth) //{ // if (rectrot.Rot == Rot4.West || rectrot.Rot == Rot4.East) // { // BaseGen.symbolStack.Push("agencyInterrogationsH", resolveParamsTemp); // } // else BaseGen.symbolStack.Push("agencyInterrogations", resolveParamsTemp); //} //else //{ // if (rectrot.Rot == Rot4.North || rectrot.Rot == Rot4.South) // { // BaseGen.symbolStack.Push("agencyInterrogations", resolveParamsTemp); // } // else BaseGen.symbolStack.Push("agencyInterrogationsH", resolveParamsTemp); //} //BaseGen.symbolStack.Push("floor", resolveParamsTemp); } spawnedCells = false; spawnedStorage = false; FactionUtility.RectReport(rp.rect); }
public override void PassingParameters(ResolveParams rp) { var map = BaseGen.globalSettings.map; var @bool = Rand.Bool; var defTypewriter = "Estate_TableTypewriter"; var defBench = "SimpleResearchBench"; var defChair = "DiningChair"; var defLamp = "Jecrell_GasLamp"; var wallDef = ThingDefOf.Steel; var floorDef = TerrainDefOf.MetalTile; var lampDef = Utility.IsIndustrialAgeLoaded() ? ThingDef.Named(defLamp) : ThingDefOf.TorchLamp; var lampStuffDef = Utility.IsIndustrialAgeLoaded() ? ThingDefOf.Steel : null; var thingDef = rp.singleThingDef ?? (Utility.IsIndustrialAgeLoaded() ? ThingDef.Named(defTypewriter) : ThingDef.Named(defBench)); var chairDef = ThingDef.Named(defChair); var rot = !@bool ? Rot4.South : Rot4.West; var loc = rp.rect.CenterCell; if (!GenSpawn.WouldWipeAnythingWith(loc, rot, thingDef, map, x => x.def.category == ThingCategory.Building)) { var doorNear = false; foreach (var current2 in GenAdj.CellsOccupiedBy(loc, rot, thingDef.Size)) { if (!BaseGenUtility.AnyDoorAdjacentCardinalTo(current2, map)) { continue; } doorNear = true; break; } if (!doorNear) { //RESEARCH BENCH ThingDef stuff = null; if (thingDef.MadeFromStuff) { stuff = ThingDefOf.WoodLog; } var thing = ThingMaker.MakeThing(thingDef, stuff); thing.SetFaction(rp.faction); GenSpawn.Spawn(thing, loc, map, rot); if (thing.Spawned && thing.Position != IntVec3.Invalid) { //CHAIR var bld = thing as Building; //We need an interaction cell var thing2 = ThingMaker.MakeThing(chairDef, stuff); thing2.SetFaction(rp.faction); if (bld != null) { GenSpawn.Spawn(thing2, bld.InteractionCell, map, rot.Opposite); } } //Adjacent lamps var singleThingDef3 = Utility.IsIndustrialAgeLoaded() ? lampDef : ThingDefOf.TorchLamp; var thing3 = ThingMaker.MakeThing(singleThingDef3, lampStuffDef); var thingLoc = Utility.GetCornerPos(thing.OccupiedRect(), 0) + GenAdj.AdjacentCells[Rot4.West.AsInt]; GenSpawn.Spawn(thing3, thingLoc, map); } } UnfogRoomCenter(rp.rect.CenterCell); FactionUtility.RectReport(rp.rect); }
public override void PassingParameters(ResolveParams rp) { var map = BaseGen.globalSettings.map; //Manual Override this mofo var size = 9; var minX = rp.rect.CenterCell.x - size; _ = rp.rect.CenterCell.x + size; var minZ = rp.rect.CenterCell.z - size; _ = rp.rect.CenterCell.z + size; var rectOverride = new CellRect(minX, minZ - (int)RectSizeValues.BASEOFFSET, size, size); rp.rect = rectOverride; UnfogRoomCenter(rp.rect.CenterCell); //Bring in MERF var singlePawnLord = rp.singlePawnLord ?? LordMaker.MakeNewLord(rp.faction, new LordJob_DefendBase(rp.faction, rp.rect.CenterCell), map); var resolveParams = rp; resolveParams.rect = rp.rect.ExpandedBy(1); resolveParams.faction = rp.faction; resolveParams.singlePawnLord = singlePawnLord; resolveParams.pawnGroupKindDef = PawnGroupKindDefOf.Combat; //CthulhuFactionsDefOf.ROM_AgencyMERF; float points = 5000; resolveParams.pawnGroupMakerParams = new PawnGroupMakerParms { tile = map.Tile, faction = rp.faction, points = points }; BaseGen.symbolStack.Push("pawnGroup", resolveParams); var thingDef = ThingDefOf.Steel; var floorDef = TerrainDefOf.MetalTile; //Faction values are read in reverse of their push. // Programmed like: Checkpoint doors -> Lobby -> Edge Walls -> Floor -> Clear // Read Like: Clear -> Floor -> Edge Walls -> Lobby -> Chokepoint doors // // Tip: // Doors must be defined in the program first to avoid region errors. //ROOF if (!rp.noRoof.HasValue || !rp.noRoof.Value) { BaseGen.symbolStack.Push("roof", rp); } //DOORS var resolveParams0 = rp; BaseGen.symbolStack.Push("agencyDoorsNS", resolveParams0); //LOBBY VALUES var superParams = rp; _ = IntVec3.Invalid; superParams.rect = FactionUtility.AdjacentRectMaker(rp.rect, Rot4.North, out var doorLoc, (int)RectSizeValues.LOBBY, (int)RectSizeValues.LOBBYHEIGHT); var resolveParamsDoor = rp; resolveParamsDoor.rect = CellRect.SingleCell(doorLoc); resolveParamsDoor.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker; BaseGen.symbolStack.Push("thing", resolveParamsDoor); BaseGen.symbolStack.Push("agencyLobby", superParams); //CustomBaseUtility.replaceFloor(superParams, Utility.factionFloorStuff); //CustomBaseUtility.replaceWalls(superParams, Utility.factionWallStuff); //CLEAR/FLOOR/WALLS var resolveParams2 = rp; resolveParams2.wallStuff = thingDef; BaseGen.symbolStack.Push("edgeWalls", resolveParams2); var resolveParams3 = rp; resolveParams3.floorDef = floorDef; BaseGen.symbolStack.Push("floor", resolveParams3); BaseGen.symbolStack.Push("clear", resolveParams); //CustomBaseUtility.replaceFloor(resolveParams3, Utility.factionFloorStuff); //CustomBaseUtility.replaceWalls(resolveParams3, Utility.factionWallStuff); FactionUtility.RectReport(rp.rect); }