public override void Generate(Map map, GenStepParams parms)
 {
     DeepProfiler.Start("RebuildAllRegions");
     map.regionAndRoomUpdater.RebuildAllRegionsAndRooms();
     DeepProfiler.End();
     MapGenerator.PlayerStartSpot = CellFinderLoose.TryFindCentralCell(map, 7, 10, (IntVec3 x) => !x.Roofed(map));
 }
Ejemplo n.º 2
0
        public override void Generate(Map map, GenStepParams parms)
        {
            List <NeededRoad> neededRoads = CalculateNeededRoads(map);

            if (neededRoads.Count == 0)
            {
                return;
            }
            List <DrawCommand> list = new List <DrawCommand>();

            DeepProfiler.Start("RebuildAllRegions");
            map.regionAndRoomUpdater.RebuildAllRegionsAndRooms();
            DeepProfiler.End();
            TerrainDef rockDef      = BaseGenUtility.RegionalRockTerrainDef(map.Tile, beautiful: false);
            IntVec3    centerpoint  = CellFinderLoose.TryFindCentralCell(map, 3, 10);
            RoadDef    bestRoadType = DefDatabase <RoadDef> .AllDefs.Where((RoadDef rd) => neededRoads.Count((NeededRoad nr) => nr.road == rd) >= 2).MaxByWithFallback((RoadDef rd) => rd.priority);

            DrawCommand item;

            if (bestRoadType != null)
            {
                NeededRoad neededRoad = neededRoads[neededRoads.FindIndex((NeededRoad nr) => nr.road == bestRoadType)];
                neededRoads.RemoveAt(neededRoads.FindIndex((NeededRoad nr) => nr.road == bestRoadType));
                NeededRoad neededRoad2 = neededRoads[neededRoads.FindIndex((NeededRoad nr) => nr.road == bestRoadType)];
                neededRoads.RemoveAt(neededRoads.FindIndex((NeededRoad nr) => nr.road == bestRoadType));
                RoadPathingDef pathingDef = neededRoad.road.pathingMode;
                IntVec3        intVec     = FindRoadExitCell(map, neededRoad.angle, centerpoint, ref pathingDef);
                IntVec3        end        = FindRoadExitCell(map, neededRoad2.angle, intVec, ref pathingDef);
                Action         action     = PrepDrawRoad(map, rockDef, intVec, end, neededRoad.road, pathingDef, out centerpoint);
                item = new DrawCommand
                {
                    action  = action,
                    roadDef = bestRoadType
                };
                list.Add(item);
            }
            foreach (NeededRoad item2 in neededRoads)
            {
                RoadPathingDef pathingDef2 = item2.road.pathingMode;
                IntVec3        intVec2     = FindRoadExitCell(map, item2.angle, centerpoint, ref pathingDef2);
                if (!(intVec2 == IntVec3.Invalid))
                {
                    item = new DrawCommand
                    {
                        action  = PrepDrawRoad(map, rockDef, centerpoint, intVec2, item2.road, pathingDef2),
                        roadDef = item2.road
                    };
                    list.Add(item);
                }
            }
            foreach (DrawCommand item3 in list.OrderBy((DrawCommand dc) => dc.roadDef.priority))
            {
                if (item3.action != null)
                {
                    item3.action();
                }
            }
        }
Ejemplo n.º 3
0
        public override void Generate(Map map)
        {
            List <GenStep_Roads.NeededRoad> neededRoads = this.CalculateNeededRoads(map);

            if (neededRoads.Count == 0)
            {
                return;
            }
            List <GenStep_Roads.DrawCommand> list = new List <GenStep_Roads.DrawCommand>();

            DeepProfiler.Start("RebuildAllRegions");
            map.regionAndRoomUpdater.RebuildAllRegionsAndRooms();
            DeepProfiler.End();
            TerrainDef rockDef      = BaseGenUtility.RegionalRockTerrainDef(map.Tile, false);
            IntVec3    intVec       = CellFinderLoose.TryFindCentralCell(map, 3, 10, null);
            RoadDef    bestRoadType = (from rd in DefDatabase <RoadDef> .AllDefs
                                       where neededRoads.Count((GenStep_Roads.NeededRoad nr) => nr.road == rd) >= 2
                                       select rd).MaxByWithFallback((RoadDef rd) => rd.priority, null);

            if (bestRoadType != null)
            {
                GenStep_Roads.NeededRoad neededRoad = neededRoads[neededRoads.FindIndex((GenStep_Roads.NeededRoad nr) => nr.road == bestRoadType)];
                neededRoads.RemoveAt(neededRoads.FindIndex((GenStep_Roads.NeededRoad nr) => nr.road == bestRoadType));
                GenStep_Roads.NeededRoad neededRoad2 = neededRoads[neededRoads.FindIndex((GenStep_Roads.NeededRoad nr) => nr.road == bestRoadType)];
                neededRoads.RemoveAt(neededRoads.FindIndex((GenStep_Roads.NeededRoad nr) => nr.road == bestRoadType));
                RoadPathingDef pathingMode = neededRoad.road.pathingMode;
                IntVec3        intVec2     = this.FindRoadExitCell(map, neededRoad.angle, intVec, ref pathingMode);
                IntVec3        end         = this.FindRoadExitCell(map, neededRoad2.angle, intVec2, ref pathingMode);
                Action         action      = this.PrepDrawRoad(map, rockDef, intVec2, end, neededRoad.road, pathingMode, out intVec);
                list.Add(new GenStep_Roads.DrawCommand
                {
                    action  = action,
                    roadDef = bestRoadType
                });
            }
            foreach (GenStep_Roads.NeededRoad current in neededRoads)
            {
                RoadPathingDef pathingMode2 = current.road.pathingMode;
                IntVec3        intVec3      = this.FindRoadExitCell(map, current.angle, intVec, ref pathingMode2);
                if (!(intVec3 == IntVec3.Invalid))
                {
                    list.Add(new GenStep_Roads.DrawCommand
                    {
                        action  = this.PrepDrawRoad(map, rockDef, intVec, intVec3, current.road, pathingMode2),
                        roadDef = current.road
                    });
                }
            }
            foreach (GenStep_Roads.DrawCommand current2 in from dc in list
                     orderby dc.roadDef.priority
                     select dc)
            {
                if (current2.action != null)
                {
                    current2.action();
                }
            }
        }
Ejemplo n.º 4
0
 public void fixLava()
 {
     //set so the area people land in will most likely not be lava.
     if (this.map.Biome.defName == "TKKN_VolcanicFlow")
     {
         IntVec3 centerSpot = CellFinderLoose.TryFindCentralCell(map, 10, 15, (IntVec3 x) => !x.Roofed(map));
         int     num        = GenRadial.NumCellsInRadius(23);
         for (int i = 0; i < num; i++)
         {
             this.map.terrainGrid.SetTerrain(centerSpot + GenRadial.RadialPattern[i], TerrainDefOf.TKKN_LavaRock_RoughHewn);
         }
     }
 }
Ejemplo n.º 5
0
 public void spawnOasis()
 {
     if (this.map.Biome.defName == "TKKN_Oasis")
     {
         //spawn a big ol cold spring
         IntVec3 springSpot = CellFinderLoose.TryFindCentralCell(map, 10, 15, (IntVec3 x) => !x.Roofed(map));
         Spring  spring     = (Spring)ThingMaker.MakeThing(ThingDef.Named("TKKN_OasisSpring"), null);
         GenSpawn.Spawn(spring, springSpot, map);
     }
     if (Rand.Value < .001f)
     {
         this.spawnOasis();
     }
 }
        public static bool Prefix(Map map)
        {
            ModExt_Biome_FeatureControl extFtControl = map.Biome.GetModExtension <ModExt_Biome_FeatureControl>();

            if (extFtControl == null || extFtControl.overwriteRoof != RoofOverwriteType.FullStable)
            {
                return(true);
            }
            DeepProfiler.Start("RebuildAllRegions");
            map.regionAndRoomUpdater.RebuildAllRegionsAndRooms();
            DeepProfiler.End();
            MapGenerator.PlayerStartSpot = CellFinderLoose.TryFindCentralCell(map, 7, MinRoomCellCount, (IntVec3 x) => x.CloseToEdge(map, MaxDistanceToEdge));
            return(false);
        }