Beispiel #1
0
        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:
            // Roofs and 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);
            //}

            _ = new CellRect();
            _ = new List <IntVec3>();
            var splitRooms =
                FactionUtility.FourWaySplit(rp.rect, out var hallway, out var doorLocs, 2, HorizontalHallway);


            var hallwayParams = rp;

            hallwayParams.rect = hallway;

            foreach (var doorLoc in doorLocs)
            {
                var resolveParams3 = rp;
                resolveParams3.rect           = CellRect.SingleCell(doorLoc);
                resolveParams3.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker;
                BaseGen.symbolStack.Push("thing", resolveParams3);
            }

            var num = 0;

            foreach (var current in splitRooms.InRandomOrder())
            {
                num++;
                if (num < 2)
                {
                    var resolveParamsArtifactRoom = rp;
                    resolveParamsArtifactRoom.rect = current;
                    BaseGen.symbolStack.Push("roof", resolveParamsArtifactRoom);
                    BaseGen.symbolStack.Push("edgeWalls", resolveParamsArtifactRoom);
                    BaseGen.symbolStack.Push("agencyStorageArtifact", resolveParamsArtifactRoom);
                    UnfogRoomCenter(current.CenterCell);
                }

                var resolveParamsTemp = rp;
                resolveParamsTemp.rect = current;
                BaseGen.symbolStack.Push("roof", resolveParamsTemp);
                BaseGen.symbolStack.Push("edgeWalls", resolveParamsTemp);
                BaseGen.symbolStack.Push("storage", resolveParamsTemp);
                UnfogRoomCenter(current.CenterCell);
            }

            FactionUtility.RectReport(rp.rect);
        }
        public override void PassingParameters(ResolveParams rp)
        {
            var map = BaseGen.globalSettings.map;

            _ = new CellRect();
            _ = new List <IntVec3>();
            var splitRooms =
                FactionUtility.FourWaySplit(rp.rect, out var hallway, out var doorLocs, 2, HorizontalHallway);


            var hallwayParams = rp;

            hallwayParams.rect = hallway;

            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 current in splitRooms.InRandomOrder())
            {
                var resolveParamsTemp = rp;
                resolveParamsTemp.rect = current;
                //BaseGen.symbolStack.Push("agencyDoorsNSEW", resolveParamsTemp);
                BaseGen.symbolStack.Push("roof", resolveParamsTemp);
                BaseGen.symbolStack.Push("edgeWalls", resolveParamsTemp);
                BaseGen.symbolStack.Push("agencyFillWithTablesAndChairs", resolveParamsTemp);
                UnfogRoomCenter(current.CenterCell);
            }

            FactionUtility.RectReport(rp.rect);

            //Bring in Standard Pawns
            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.Settlement;
            float points = 500;

            resolveParams.pawnGroupMakerParams = new PawnGroupMakerParms
            {
                tile    = map.Tile,
                faction = rp.faction,
                points  = points
            };

            BaseGen.symbolStack.Push("pawnGroup", resolveParams);
        }
        public override void PassingParameters(ResolveParams rp)
        {
            var map = 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:
            // Roofs and 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);
            //}


            //BaseGen.symbolStack.Push("agencyDoorsNSEW", rp);

            _ = new CellRect();
            _ = new List <IntVec3>();
            var splitRooms =
                FactionUtility.FourWaySplit(rp.rect, out var hallway, out var doorLocs, 2, HorizontalHallway);


            var hallwayParams = rp;

            hallwayParams.rect = hallway;

            foreach (var doorLoc in doorLocs)
            {
                var resolveParams3 = rp;
                resolveParams3.rect           = CellRect.SingleCell(doorLoc);
                resolveParams3.singleThingDef = CthulhuFactionsDefOf.ROM_TemporaryDoorMarker;
                BaseGen.symbolStack.Push("thing", resolveParams3);
            }

            foreach (var current in splitRooms.InRandomOrder())
            {
                if (!spawnedChiefOffice)
                {
                    spawnedChiefOffice = true;
                    var resolveParamsOffice = rp;
                    resolveParamsOffice.rect = current;
                    BaseGen.symbolStack.Push("roof", resolveParamsOffice);
                    BaseGen.symbolStack.Push("edgeWalls", resolveParamsOffice);
                    BaseGen.symbolStack.Push("agencyChiefOffice", resolveParamsOffice);
                    UnfogRoomCenter(current.CenterCell);
                    continue;
                }

                var resolveParamsTemp = rp;
                resolveParamsTemp.rect = current;
                BaseGen.symbolStack.Push("roof", resolveParamsTemp);
                BaseGen.symbolStack.Push("edgeWalls", resolveParamsTemp);
                var resolveParamsTemp2 = rp;
                resolveParamsTemp2.rect = current.ContractedBy(2);
                BaseGen.symbolStack.Push("fillWithTypewriters", resolveParamsTemp2);
                UnfogRoomCenter(current.CenterCell);
            }

            spawnedChiefOffice = false;

            FactionUtility.RectReport(rp.rect);

            //Bring in Standard Pawns
            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.Settlement;
            float points = 500;

            resolveParams.pawnGroupMakerParams = new PawnGroupMakerParms
            {
                tile    = map.Tile,
                faction = rp.faction,
                points  = points
            };

            BaseGen.symbolStack.Push("pawnGroup", resolveParams);
        }
        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);
        }
Beispiel #8
0
        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);
        }