示例#1
0
        public override void Generate(Map map)
        {
            //if (!Find.World.HasCaves(map.Tile))
            //{
            //    return;
            //}
            this.directionNoise = new Perlin(0.0020500000100582838, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);
            MapGenFloatGrid elevation = MapGenerator.Elevation;
            BoolGrid        visited   = new BoolGrid(map);
            List <IntVec3>  group     = new List <IntVec3>();

            foreach (IntVec3 current in map.AllCells)
            {
                if (!visited[current] && this.IsRock(current, elevation, map))
                {
                    group.Clear();
                    map.floodFiller.FloodFill(current, (IntVec3 x) => this.IsRock(x, elevation, map), delegate(IntVec3 x)
                    {
                        visited[x] = true;
                        group.Add(x);
                    }, 2147483647, false, null);
                    this.Trim(group, map);
                    //this.RemoveSmallDisconnectedSubGroups(group, map);
                    if (group.Count >= 50)
                    {
                        this.DoOpenTunnels(group, map);
                        this.DoClosedTunnels(group, map);
                    }
                }
            }
        }
示例#2
0
        public override void Generate(Map map, GenStepParams parms)
        {
            var mapParent = map.Parent as MapParent_ZLevel;

            if (mapParent.hasCaves)
            {
                directionNoise = new Perlin(DirectionNoiseFrequency, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);
                MapGenFloatGrid elevation = MapGenerator.Elevation;
                BoolGrid        visited   = new BoolGrid(map);
                List <IntVec3>  group     = new List <IntVec3>();
                foreach (IntVec3 allCell in map.AllCells)
                {
                    if (!visited[allCell] && IsRock(allCell, elevation, map))
                    {
                        group.Clear();
                        map.floodFiller.FloodFill(allCell, (IntVec3 x) => IsRock(x, elevation, map), delegate(IntVec3 x)
                        {
                            visited[x] = true;
                            group.Add(x);
                        });
                        Trim(group, map);
                        RemoveSmallDisconnectedSubGroups(group, map);
                        if (group.Count >= MinRocksToGenerateAnyTunnel)
                        {
                            DoOpenTunnels(group, map);
                            DoClosedTunnels(group, map);
                        }
                    }
                }
            }
        }
示例#3
0
        public void BuildInsideWall(WallInCreator wallIn)
        {
            BoolGrid      pathable       = Bot.Main.MapAnalyzer.Pathable;
            ArrayBoolGrid walledPathable = new ArrayBoolGrid(pathable.Width(), pathable.Height());

            for (int x = 0; x < pathable.Width(); x++)
            {
                for (int y = 0; y < pathable.Height(); y++)
                {
                    if (!pathable[x, y])
                    {
                        walledPathable[x, y] = false;
                        continue;
                    }
                    bool blocked = false;
                    foreach (WallBuilding building in wallIn.Wall)
                    {
                        if (Math.Abs(building.Pos.X - x) <= building.Size.X / 2f &&
                            Math.Abs(building.Pos.Y - y) <= building.Size.Y / 2f)
                        {
                            blocked = true;
                            break;
                        }
                    }
                    walledPathable[x, y] = !blocked;
                }
            }
            LimitBuildArea = walledPathable.GetConnected(SC2Util.To2D(Bot.Main.MapAnalyzer.StartLocation));

            /*
             * DrawGrid(pathable, "Pathable");
             * DrawGrid(walledPathable, "WalledPathable");
             * DrawGrid(LimitBuildArea, "BuildArea");
             */
        }
示例#4
0
 public override void Generate(Map map, GenStepParams parms)
 {
     if (Find.World.HasCaves(map.Tile))
     {
         directionNoise = new Perlin(0.0020500000100582838, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);
         MapGenFloatGrid elevation = MapGenerator.Elevation;
         BoolGrid        visited   = new BoolGrid(map);
         List <IntVec3>  group     = new List <IntVec3>();
         foreach (IntVec3 allCell in map.AllCells)
         {
             if (!visited[allCell] && IsRock(allCell, elevation, map))
             {
                 group.Clear();
                 map.floodFiller.FloodFill(allCell, (IntVec3 x) => IsRock(x, elevation, map), delegate(IntVec3 x)
                 {
                     visited[x] = true;
                     group.Add(x);
                 });
                 Trim(group, map);
                 RemoveSmallDisconnectedSubGroups(group, map);
                 if (group.Count >= 300)
                 {
                     DoOpenTunnels(group, map);
                     DoClosedTunnels(group, map);
                 }
             }
         }
     }
 }
示例#5
0
        public static void DoOrderButton(WidgetRow widgetRow, Area areaBase)
        {
            if (!(areaBase is Area_Allowed area))
            {
                return;
            }
            List <Area> areas = area.Map.areaManager.AllAreas.FindAll(a => a is Area_Allowed);
            int         index = areas.IndexOf(area);

            if (widgetRow.ButtonIcon(TexButton.Clear, "TD.ClearEntireArea".Translate()))
            {
                BoolGrid grid = (BoolGrid)innerGridInfo.GetValue(area);
                grid.Clear();
                area.Invert(); area.Invert();                //this is stupid but easiest way to access Dirtier
            }
            if (index > 0)
            {
                if (widgetRow.ButtonIcon(TexButton.ReorderUp))
                {
                    Area other = areas[index - 1];
                    area.Map.GetComponent <MapComponent_AreaOrder>().Swap(area, other);
                }
            }
            else
            {
                widgetRow.GapButtonIcon();
            }
            if (index < areas.Count - 1 && widgetRow.ButtonIcon(TexButton.ReorderDown))
            {
                Area other = areas[index + 1];
                area.Map.GetComponent <MapComponent_AreaOrder>().Swap(area, other);
            }
        }
示例#6
0
        public override void Generate(Map map, GenStepParams parms)
        {
            if (!Find.World.HasCaves(map.Tile))
            {
                return;
            }
            this.directionNoise = new Perlin(0.0020500000100582838, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);
            MapGenFloatGrid elevation = MapGenerator.Elevation;
            BoolGrid        visited   = new BoolGrid(map);
            List <IntVec3>  group     = new List <IntVec3>();

            foreach (IntVec3 intVec in map.AllCells)
            {
                if (!visited[intVec] && this.IsRock(intVec, elevation, map))
                {
                    group.Clear();
                    map.floodFiller.FloodFill(intVec, (IntVec3 x) => this.IsRock(x, elevation, map), delegate(IntVec3 x)
                    {
                        visited[x] = true;
                        group.Add(x);
                    }, int.MaxValue, false, null);
                    this.Trim(group, map);
                    this.RemoveSmallDisconnectedSubGroups(group, map);
                    if (group.Count >= 300)
                    {
                        this.DoOpenTunnels(group, map);
                        this.DoClosedTunnels(group, map);
                    }
                }
            }
        }
        public static void MakeColony(params ColonyMakerFlag[] flags)
        {
            bool godMode = DebugSettings.godMode;

            DebugSettings.godMode            = true;
            Thing.allowDestroyNonDestroyable = true;
            if (FixedColonyAnimalsDebug.usedCells == null)
            {
                FixedColonyAnimalsDebug.usedCells = new BoolGrid(FixedColonyAnimalsDebug.Map);
            }
            else
            {
                FixedColonyAnimalsDebug.usedCells.ClearAndResizeTo(FixedColonyAnimalsDebug.Map);
            }
            FixedColonyAnimalsDebug.overRect = new CellRect(FixedColonyAnimalsDebug.Map.Center.x - 50, FixedColonyAnimalsDebug.Map.Center.z - 50, 100, 100);
            FixedColonyAnimalsDebug.DeleteAllSpawnedPawns();
            GenDebug.ClearArea(FixedColonyAnimalsDebug.overRect, Find.CurrentMap);
            if (flags.Contains(ColonyMakerFlag.Animals))
            {
                foreach (PawnKindDef pawnKindDef in from k in DefDatabase <PawnKindDef> .AllDefs
                         where k.RaceProps.Animal && k != InternalDefOf.GR_FleshFlies
                         select k)
                {
                    CellRect cellRect;
                    if (!FixedColonyAnimalsDebug.TryGetFreeRect(6, 3, out cellRect))
                    {
                        return;
                    }
                    cellRect = cellRect.ContractedBy(1);
                    foreach (IntVec3 c in cellRect)
                    {
                        FixedColonyAnimalsDebug.Map.terrainGrid.SetTerrain(c, TerrainDefOf.Concrete);
                    }
                    GenSpawn.Spawn(PawnGenerator.GeneratePawn(pawnKindDef, null), cellRect.Cells.ElementAt(0), FixedColonyAnimalsDebug.Map, WipeMode.Vanish);
                    IntVec3 intVec   = cellRect.Cells.ElementAt(1);
                    Pawn    deadpawn = (Pawn)GenSpawn.Spawn(PawnGenerator.GeneratePawn(pawnKindDef, null), intVec, FixedColonyAnimalsDebug.Map, WipeMode.Vanish);
                    deadpawn.Kill(null);
                    CompRottable compRottable = ((Corpse)intVec.GetThingList(Find.CurrentMap).First((Thing t) => t is Corpse)).TryGetComp <CompRottable>();
                    if (compRottable != null)
                    {
                        compRottable.RotProgress += 1200000f;
                    }
                    if (pawnKindDef.RaceProps.leatherDef != null)
                    {
                        GenSpawn.Spawn(pawnKindDef.RaceProps.leatherDef, cellRect.Cells.ElementAt(2), FixedColonyAnimalsDebug.Map, WipeMode.Vanish);
                    }
                    if (pawnKindDef.RaceProps.meatDef != null)
                    {
                        GenSpawn.Spawn(pawnKindDef.RaceProps.meatDef, cellRect.Cells.ElementAt(3), FixedColonyAnimalsDebug.Map, WipeMode.Vanish);
                    }
                }
            }

            FixedColonyAnimalsDebug.ClearAllHomeArea();
            FixedColonyAnimalsDebug.FillWithHomeArea(FixedColonyAnimalsDebug.overRect);
            DebugSettings.godMode            = godMode;
            Thing.allowDestroyNonDestroyable = false;
        }
示例#8
0
    private async void OnSizeChanged()
    {
        wasModified = false;
        await Task.Delay(5000);

        if (!wasModified && gridSize.x != 0 && gridSize.y != 0)
        {
            grid = new BoolGrid(grid, gridSize.x, gridSize.y);
        }
    }
示例#9
0
 private static void CheckInitDebugDrawGrid()
 {
     if (debugDrawGrid == null)
     {
         debugDrawGrid = new BoolGrid(Find.CurrentMap);
     }
     else if (!debugDrawGrid.MapSizeMatches(Find.CurrentMap))
     {
         debugDrawGrid.ClearAndResizeTo(Find.CurrentMap);
     }
 }
示例#10
0
 private static void CheckInitDebugDrawGrid()
 {
     if (StealAIDebugDrawer.debugDrawGrid == null)
     {
         StealAIDebugDrawer.debugDrawGrid = new BoolGrid(Find.VisibleMap);
     }
     else if (!StealAIDebugDrawer.debugDrawGrid.MapSizeMatches(Find.VisibleMap))
     {
         StealAIDebugDrawer.debugDrawGrid.ClearAndResizeTo(Find.VisibleMap);
     }
 }
示例#11
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="SlurryNet" /> class.
        /// </summary>
        /// <param name="map">The map.</param>
        public SlurryNet([NotNull] Map map)
        {
            _disjointSet = new BoolGrid(map);
            _connectors  = new List <SlurryNetComp>();
            _traders     = new List <ISlurryNetTrader>();
            _storage     = new List <ISlurryNetStorage>();
            Map          = map;
#if DEBUG
            _drawer = new CellBoolDrawer(i => _disjointSet[i], () => _color, i => _color, map.Size.x, map.Size.z);
#endif
        }
        private void TrySpawnCave2(IntVec3 c, List <IntVec3> cells, float dist, out List <IntVec3> CaveCells)
        {
            CaveCells = new List <IntVec3>();
            //	Log.Message("checking " + cells.Count + " cells for tunnels"); ;
            MapGenFloatGrid elevation = MapGenerator.Elevation;
            Map             map       = BaseGen.globalSettings.map;
            BoolGrid        visited   = new BoolGrid(map);
            List <IntVec3>  group     = new List <IntVec3>();

            Rand.PushState();
            directionNoise = new Perlin(0.0020500000100582838, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);
            //	directionNoise = new Perlin(0.0020500000100582838, 1, 1, 6, Rand.Int, QualityMode.Medium);
            //  directionNoise = new Perlin(0.0070000002160668373, 2.0, 0.5, 6, Rand.Range(0, int.MaxValue), QualityMode.High);
            Rand.PopState();
            foreach (IntVec3 allCell in cells)
            {
                if (allCell.DistanceTo(c) < dist)
                {
                    elevation[allCell] = 1f;
                }
                if (!visited[allCell] && allCell.Filled(map))
                {
                    //	Log.Message("checking " + allCell + " cells for tunnel");
                    group.Clear();
                    map.floodFiller.FloodFill(allCell, (IntVec3 x) => x.Filled(map), delegate(IntVec3 x)
                    {
                        visited[x] = true;
                        group.Add(x);
                    });
                    //	Log.Message("found " + group.Count + " cells for tunnel group");
                    Trim(group, map);
                    RemoveSmallDisconnectedSubGroups(group, map);
                    //	Log.Message("RemoveSmallDisconnectedSubGroups from group " + group.Count + " cells left");

                    if (group.Count >= 300)
                    {
                        //	Log.Message("making " + group.Count + " tunnels");
                        DoOpenTunnels(group, map);
                        DoClosedTunnels(group, map);
                        CaveCells.AddRange(group);
                    }
                }
            }

            foreach (IntVec3 allCell in cells)
            {
                if (!CaveCells.Contains(allCell) && visited[allCell])
                {
                    CaveCells.Add(allCell);
                    //	Log.Message("adding " + allCell + "co CaveCells, now contains " + CaveCells.Count);
                }
            }
        }
            public static void DrawFieldEdges(List <IntVec3> cells, Color color)
            {
                // swiped from GenDraw.DrawFieldEdges- we need to draw using a different shader to avoid being covered by fog
                var currentMap = Find.CurrentMap;
                var material   = MaterialPool.MatFrom(new MaterialRequest {
                    shader      = ShaderDatabase.MetaOverlay,
                    color       = color,
                    BaseTexPath = "UI/Overlays/TargetHighlight_Side"
                });

                material.mainTexture.wrapMode = TextureWrapMode.Clamp;
                if (fieldGrid == null)
                {
                    fieldGrid = new BoolGrid(currentMap);
                }
                else
                {
                    fieldGrid.ClearAndResizeTo(currentMap);
                }
                int x     = currentMap.Size.x;
                int z     = currentMap.Size.z;
                int count = cells.Count;

                for (int i = 0; i < count; i++)
                {
                    if (cells[i].InBounds(currentMap))
                    {
                        fieldGrid[cells[i].x, cells[i].z] = true;
                    }
                }
                for (int j = 0; j < count; j++)
                {
                    var intVec = cells[j];
                    if (intVec.InBounds(currentMap))
                    {
                        rotNeeded[0] = (intVec.z < z - 1 && !fieldGrid[intVec.x, intVec.z + 1]);
                        rotNeeded[1] = (intVec.x < x - 1 && !fieldGrid[intVec.x + 1, intVec.z]);
                        rotNeeded[2] = (intVec.z > 0 && !fieldGrid[intVec.x, intVec.z - 1]);
                        rotNeeded[3] = (intVec.x > 0 && !fieldGrid[intVec.x - 1, intVec.z]);
                        for (int k = 0; k < 4; k++)
                        {
                            if (rotNeeded[k])
                            {
                                Graphics.DrawMesh(MeshPool.plane10, intVec.ToVector3ShiftedWithAltitude(AltitudeLayer.MetaOverlays),
                                                  new Rot4(k).AsQuat, material, 0);
                            }
                        }
                    }
                }
            }
        public override void Generate(Map map, GenStepParams parms)
        {
            //make everything of evelation 0.9 so rocks will be placed there
            MapGenFloatGrid elevation = MapGenerator.Elevation;

            foreach (IntVec3 intVec in map.AllCells)
            {
                elevation[intVec] = 0.9f;
            }
            MapGenFloatGrid fertility = MapGenerator.Fertility;

            foreach (IntVec3 intVec2 in map.AllCells)
            {
                fertility[intVec2] = 0f;
            }

            //clear a edge as entry
            IntVec3 edgePoint = CellFinder.RandomEdgeCell(map);

            foreach (IntVec3 intVec3 in GenRadial.RadialCellsAround(edgePoint, 8f, true))
            {
                elevation[intVec3] = 0.1f;
            }

            //Create caves. This and the called methods are copied from the vanilla genstep_caves
            this.directionNoise = new Perlin(0.0020500000100582838, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);
            BoolGrid       visited = new BoolGrid(map);
            List <IntVec3> group   = new List <IntVec3>();

            foreach (IntVec3 intVec in map.AllCells)
            {
                if (!visited[intVec] && this.IsRock(intVec, elevation, map))
                {
                    group.Clear();
                    map.floodFiller.FloodFill(intVec, (IntVec3 x) => this.IsRock(x, elevation, map), delegate(IntVec3 x)
                    {
                        visited[x] = true;
                        group.Add(x);
                    }, int.MaxValue, false, null);
                    this.Trim(group, map);
                    this.RemoveSmallDisconnectedSubGroups(group, map);
                    if (group.Count >= 300)
                    {
                        this.DoOpenTunnels(group, map);
                        this.DoClosedTunnels(group, map);
                    }
                }
            }
        }
        public GasNet(IEnumerable <CompGas> connectors, Map map)
        {
            this.map = map;
            netGrid  = new BoolGrid(map);

#if DEBUG
            drawer = new CellBoolDrawer((index) => netGrid[index], () => color, (index) => color, map.Size.x,
                                        map.Size.z);
#endif

            foreach (var connector in connectors)
            {
                Register(connector);
            }
        }
        public void TrySpawnCave(IntVec3 c, List <IntVec3> cells, float dist, out List <IntVec3> CaveCells)
        {
            CaveCells = new List <IntVec3>();
            Map map = BaseGen.globalSettings.map;

            Rand.PushState();
            directionNoise = new Perlin(0.0020500000100582838, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);
            Rand.PopState();
            BoolGrid        visited   = new BoolGrid(map);
            MapGenFloatGrid elevation = new MapGenFloatGrid(map);
            List <IntVec3>  group     = new List <IntVec3>();

            foreach (IntVec3 allCell in CaveCells)
            {
                if (visited[allCell])
                {
                    //	Log.Message("been to "+ allCell + " already");
                }
                if (!IsRock(allCell, elevation, map))
                {
                    //	Log.Message(allCell + " is not rock");
                }
                if (allCell.DistanceTo(c) < dist && cells.Contains(c))
                {
                    elevation[allCell] = 1f;
                }
                if (!visited[allCell] && IsRock(allCell, elevation, map) && cells.Contains(c))
                {
                    group.Clear();
                    map.floodFiller.FloodFill(allCell, (IntVec3 x) => IsRock(x, elevation, map), delegate(IntVec3 x)
                    {
                        visited[x] = true;
                        group.Add(x);
                    });
                    //	Log.Message("TrySpawnCave at " + allCell + "containing " + group.Count + " cells");
                    Trim(group, map);
                    RemoveSmallDisconnectedSubGroups(group, map);
                    if (group.Count >= 30)
                    {
                        //	Log.Message("TrySpawnCave starting tunnel at " + allCell + "containing "+ group.Count + " cells");
                        DoOpenTunnels(group, map);
                        DoClosedTunnels(group, map);
                        CaveCells.AddRange(group);
                    }
                }
            }
        }
        public override void Generate(Map map, GenStepParams parms)
        {
            if (!Find.World.HasCaves(map.Tile))
            {
                return;
            }
            ModExt_Biome_GenStep_BetterCaves extCaves = map.Biome.GetModExtension <ModExt_Biome_GenStep_BetterCaves>();

            if (extCaves == null)
            {
                return;
            }
            this.extCaves    = extCaves;
            directionNoise   = new Perlin(DirectionNoiseFrequency, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);
            tunnelWidthNoise = new Perlin(TunnelWidthNoiseFrequency, 2.0, 0.5, 4, Rand.Int, QualityMode.Medium);
            tunnelWidthNoise = new ScaleBias(0.4, 1.0, tunnelWidthNoise);
            MapGenFloatGrid elevation = MapGenerator.Elevation;
            BoolGrid        visited   = new BoolGrid(map);
            List <IntVec3>  rockCells = new List <IntVec3>();

            foreach (IntVec3 cell in map.AllCells)
            {
                if (!visited[cell] && this.IsRock(cell, elevation, map))
                {
                    rockCells.Clear();
                    map.floodFiller.FloodFill(cell, (IntVec3 x) => IsRock(x, elevation, map), delegate(IntVec3 x)
                    {
                        visited[x] = true;
                        rockCells.Add(x);
                    });
                    Trim(rockCells, map);
                    RemoveSmallDisconnectedSubGroups(rockCells, map);
                    if (rockCells.Count >= extCaves.minRocksToGenerateAnyTunnel)
                    {
                        StartWithTunnel(rockCells, map);
                    }
                }
            }
            // Smooth caves after generation
            SmoothGenerated(map);
        }
示例#18
0
文件: AntiMicro.cs 项目: evilz/TyrSc2
        private void DrawMap(string name, List <Point2D> locations)
        {
            BoolGrid pathable = Bot.Main.MapAnalyzer.Pathable;

            if (!Bot.Debug)
            {
                return;
            }

            int width  = Bot.Main.GameInfo.StartRaw.PathingGrid.Size.X;
            int height = Bot.Main.GameInfo.StartRaw.PathingGrid.Size.Y;

            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(width, height);
            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    if (pathable[x, y])
                    {
                        bmp.SetPixel(x, height - 1 - y, System.Drawing.Color.White);
                    }
                    else
                    {
                        bmp.SetPixel(x, height - 1 - y, System.Drawing.Color.Black);
                    }
                }
            }

            foreach (Managers.Base b in Bot.Main.BaseManager.Bases)
            {
                bmp.SetPixel((int)b.BaseLocation.Pos.X, height - 1 - (int)b.BaseLocation.Pos.Y, System.Drawing.Color.Blue);
            }

            foreach (Point2D location in locations)
            {
                bmp.SetPixel((int)location.X, height - 1 - (int)location.Y, System.Drawing.Color.Red);
            }

            bmp.Save(System.IO.Directory.GetCurrentDirectory() + "/data/" + name + ".png");
        }
        public OreNode(IntVec3 TR, IntVec3 DL, Map m, Color C, bool WithResource)
        {
            Size   = m.Size;
            Colour = C;


            boolGrid = new BoolGrid(m);

            Cells = CellRect.FromLimits(TR, DL).Cells.ToList <IntVec3>();



            if (WithResource)
            {
                this.AssignStone();
                this.AssignResource();
                this.AddToGrid();
            }
            else
            {
                this.RemoveFromGrid();
            }
        }
示例#20
0
 public QuarryGrid(Map map) : base(map)
 {
     boolGrid = new BoolGrid(map);
 }
        private void FindAdjacentRooms()
        {
            adjacentRooms.Clear();
            if (room.UsesOutdoorTemperature)
            {
                return;
            }
            Map            visibleMap = Find.VisibleMap;
            List <IntVec3> cells      = new List <IntVec3>();

            foreach (IntVec3 current in room.Cells)
            {
                cells.Add(current);
            }

            if (fieldGrid == null)
            {
                fieldGrid = new BoolGrid(visibleMap);
            }
            else
            {
                fieldGrid.ClearAndResizeTo(visibleMap);
            }

            int x     = visibleMap.Size.x;
            int z     = visibleMap.Size.z;
            int count = cells.Count;

            for (int i = 0; i < count; i++)
            {
                if (cells[i].InBounds(visibleMap))
                {
                    fieldGrid[cells[i].x, cells[i].z] = true;
                }
            }
            for (int j = 0; j < count; j++)
            {
                IntVec3 c = cells[j];
                if (c.InBounds(visibleMap))
                {
                    if (c.z < z - 1 && !fieldGrid[c.x, c.z + 1])
                    {
                        var door = Find.VisibleMap.thingGrid.ThingsAt(new IntVec3(c.x, c.y, c.z + 1)).ToList().Find(s => s.def.defName == "Door");
                        if (door != null)
                        {
                            adjacentRooms.Add(RegionAndRoomQuery.RoomAt(new IntVec3(c.x, c.y, c.z + 2), Map));
                        }
                    }
                    if (c.x < x - 1 && !fieldGrid[c.x + 1, c.z])
                    {
                        var door = Find.VisibleMap.thingGrid.ThingsAt(new IntVec3(c.x + 1, c.y, c.z)).ToList().Find(s => s.def.defName == "Door");
                        if (door != null)
                        {
                            adjacentRooms.Add(RegionAndRoomQuery.RoomAt(new IntVec3(c.x + 2, c.y, c.z), Map));
                        }
                    }
                    if (c.z > 0 && !fieldGrid[c.x, c.z - 1])
                    {
                        var door = Find.VisibleMap.thingGrid.ThingsAt(new IntVec3(c.x, c.y, c.z - 1)).ToList().Find(s => s.def.defName == "Door");
                        if (door != null)
                        {
                            adjacentRooms.Add(RegionAndRoomQuery.RoomAt(new IntVec3(c.x, c.y, c.z - 2), Map));
                        }
                    }
                    if (c.z > 0 && !fieldGrid[c.x - 1, c.z])
                    {
                        var door = Find.VisibleMap.thingGrid.ThingsAt(new IntVec3(c.x - 1, c.y, c.z)).ToList().Find(s => s.def.defName == "Door");
                        if (door != null)
                        {
                            adjacentRooms.Add(RegionAndRoomQuery.RoomAt(new IntVec3(c.x - 2, c.y, c.z), Map));
                        }
                    }
                }
            }
        }
示例#22
0
        //public static void DrawFieldEdges(List<IntVec3> cells, Color color)
        public static bool Prefix(List <IntVec3> cells, Color color)
        {
            if (!Settings.Get().fieldEdgesRedo)
            {
                return(true);
            }

            Map             currentMap = Find.CurrentMap;
            MaterialRequest req        = new MaterialRequest
            {
                shader      = ShaderDatabase.Transparent,
                color       = color,
                BaseTexPath = "TargetHighlight_Edge"
            };
            Material materialEdge = MaterialPool.MatFrom(req);

            materialEdge.GetTexture("_MainTex").wrapMode = TextureWrapMode.Clamp;

            req.BaseTexPath = "TargetHighlight_Edge2";
            Material materialEdge2 = MaterialPool.MatFrom(req);

            materialEdge2.GetTexture("_MainTex").wrapMode = TextureWrapMode.Clamp;

            req.BaseTexPath = "TargetHighlight_Edge3";
            Material materialEdge3 = MaterialPool.MatFrom(req);

            materialEdge3.GetTexture("_MainTex").wrapMode = TextureWrapMode.Clamp;

            req.BaseTexPath = "TargetHighlight_Edge4";
            Material materialEdge4 = MaterialPool.MatFrom(req);

            materialEdge4.GetTexture("_MainTex").wrapMode = TextureWrapMode.Clamp;

            req.BaseTexPath = "TargetHighlight_Corner";
            Material materialCorner = MaterialPool.MatFrom(req);

            materialCorner.GetTexture("_MainTex").wrapMode = TextureWrapMode.Clamp;
            if (fieldGrid == null)
            {
                fieldGrid = new BoolGrid(currentMap);
            }
            else
            {
                fieldGrid.ClearAndResizeTo(currentMap);
            }
            int x = currentMap.Size.x;
            int z = currentMap.Size.z;

            foreach (IntVec3 cell in cells)
            {
                if (cell.InBounds(currentMap))
                {
                    fieldGrid[cell.x, cell.z] = true;
                }
            }

            foreach (IntVec3 c in cells)
            {
                if (c.InBounds(currentMap))
                {
                    adjEmpty[0] = (c.z < z - 1 && !fieldGrid[c.x, c.z + 1]);                    //north
                    adjEmpty[1] = (c.x < x - 1 && !fieldGrid[c.x + 1, c.z]);                    //east
                    adjEmpty[2] = (c.z > 0 && !fieldGrid[c.x, c.z - 1]);                        //south
                    adjEmpty[3] = (c.x > 0 && !fieldGrid[c.x - 1, c.z]);                        //west

                    adjEmpty[4] = (c.x < x - 1 && c.z < z - 1 && !fieldGrid[c.x + 1, c.z + 1]); //northeast
                    adjEmpty[5] = (c.x < x - 1 && c.z > 0 && !fieldGrid[c.x + 1, c.z - 1]);     //southeast
                    adjEmpty[6] = (c.x > 0 && c.z > 0 && !fieldGrid[c.x - 1, c.z - 1]);         //southwest
                    adjEmpty[7] = (c.x > 0 && c.z < z - 1 && !fieldGrid[c.x - 1, c.z + 1]);     //northwest

                    //Count # of edges empty
                    int adjOrthEmpty = 0;
                    for (int i = 0; i < 4; i++)
                    {
                        if (adjEmpty[i])
                        {
                            adjOrthEmpty++;
                        }
                    }

                    Vector3 cellVector = c.ToVector3ShiftedWithAltitude(AltitudeLayer.MetaOverlays);
                    //Draw edges using texture png based on total # of edges
                    if (adjOrthEmpty == 4)
                    {
                        Graphics.DrawMesh(MeshPool.plane10, cellVector, Quaternion.identity, materialEdge4, 0);
                    }
                    else if (adjOrthEmpty == 3)
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            if (!adjEmpty[i])
                            {
                                Graphics.DrawMesh(MeshPool.plane10, cellVector, new Rot4(i).AsQuat, materialEdge3, 0);
                            }
                        }
                    }
                    else if (adjOrthEmpty == 2)
                    {
                        bool corner = false;
                        for (int i = 0; i < 4; i++)
                        {
                            if (adjEmpty[i] && adjEmpty[(i + 1) % 4])
                            {
                                Graphics.DrawMesh(MeshPool.plane10, cellVector, new Rot4(i).AsQuat, materialEdge2, 0);
                                corner = true;
                            }
                        }
                        //Opposite edges : just draw single edge twice
                        if (!corner)
                        {
                            for (int i = 0; i < 4; i++)
                            {
                                if (adjEmpty[i])
                                {
                                    Graphics.DrawMesh(MeshPool.plane10, cellVector, new Rot4(i).AsQuat, materialEdge, 0);
                                }
                            }
                        }
                    }
                    else if (adjOrthEmpty == 1)
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            if (adjEmpty[i])
                            {
                                Graphics.DrawMesh(MeshPool.plane10, cellVector, new Rot4(i).AsQuat, materialEdge, 0);
                            }
                        }
                    }

                    //Draw corner fill-ins
                    for (int i = 0; i < 4; i++)
                    {
                        if (adjEmpty[i + 4] && !adjEmpty[i] && !adjEmpty[(i + 1) % 4])
                        {
                            Graphics.DrawMesh(MeshPool.plane10, cellVector, new Rot4(i).AsQuat, materialCorner, 0);
                        }
                    }
                }
            }

            return(false);
        }
        public void Update()
        {
#if DEBUG
            var watch = System.Diagnostics.Stopwatch.StartNew();
#endif

            Map map = Find.Maps.Find(x => x.uniqueID == areaExtID.MapID);
            if (map == null)
            {
                return;
            }

            this.areaManager = map.areaManager;

            var innerAreas = InnerAreas;

            BoolGrid innerGrid = (BoolGrid)FieldInfos.innerGrid.GetValue(this);
            bool[]   arr       = (bool[])FieldInfos.boolGridArr.GetValue(innerGrid);

            BitArray arrBA = new BitArray(arr);
            if (innerAreas.Count > 0 && innerAreas.Any(x => x.Value == AreaExtOperator.Inclusion))
            {
                arrBA.SetAll(false);
            }
            else
            {
                arrBA.SetAll(true);
            }

            var areaNameBuilder = new StringBuilder();
            for (int i = 0; i < innerAreas.Count; ++i)
            {
                var kv = innerAreas[i];

                Area            area = kv.Key;
                AreaExtOperator op   = kv.Value;

                BitArray targetArrBA = GetAreaBitArray(area);
                if (op == AreaExtOperator.Inclusion)
                {
                    arrBA = arrBA.Or(targetArrBA);
                    if (i > 0)
                    {
                        areaNameBuilder.Append("+");
                    }
                }
                else if (op == AreaExtOperator.Exclusion)
                {
                    arrBA = arrBA.And(targetArrBA.Not());
                    areaNameBuilder.Append("-");
                }

                areaNameBuilder.Append(area.Label);
            }

            arrBA.CopyTo(arr, 0);
            FieldInfos.boolGridArr.SetValue(innerGrid, arr);
            FieldInfos.boolGridTrueCount.SetValue(innerGrid, arr.Count(x => x));

            cachedLabel = areaNameBuilder.ToString();

            if (innerAreas.Count == 1)
            {
                cachedColor = innerAreas[0].Key.Color;
            }
            else
            {
                cachedColor = Color.black;
            }

            initialized  = true;
            drawer.dirty = true;

#if DEBUG
            watch.Stop();
            Log.Message(string.Format("Update elapsed : {0}", watch.ElapsedMilliseconds));
#endif
        }
示例#24
0
        public static void DoOrderButton(WidgetRow widgetRow, Area areaBase)
        {
            if (!(areaBase is Area_Allowed area))
            {
                return;
            }
            List <Area> areas = area.Map.areaManager.AllAreas.FindAll(a => a is Area_Allowed);
            int         index = areas.IndexOf(area);

            if (widgetRow.ButtonIcon(TexButton.Clear, "TD.ClearEntireArea".Translate()))
            {
                BoolGrid grid = (BoolGrid)innerGridInfo.GetValue(area);
                grid.Clear();
                area.Invert(); area.Invert();                //this is stupid but easiest way to access Dirtier
            }

            var comp = area.Map.GetComponent <MapComponent_AreaOrder>();

            if (Mod.settings.areaForTypes)
            {
                //Animals checkbox
                bool forAnimals = !comp.notForAnimals.Contains(area);
                if (widgetRow.Checkbox(ref forAnimals))
                {
                    if (forAnimals)
                    {
                        comp.notForAnimals.Remove(area);
                    }
                    else
                    {
                        comp.notForAnimals.Add(area);
                    }
                }

                //Colonists checkbox
                bool forColonists = !comp.notForColonists.Contains(area);
                if (widgetRow.Checkbox(ref forColonists))
                {
                    if (forColonists)
                    {
                        comp.notForColonists.Remove(area);
                    }
                    else
                    {
                        comp.notForColonists.Add(area);
                    }
                }
            }

            //re-order up
            if (index > 0)
            {
                if (widgetRow.ButtonIcon(TexButton.ReorderUp))
                {
                    Area other = areas[index - 1];
                    comp.Swap(area, other);
                }
            }
            else
            {
                widgetRow.Gap(WidgetRow.IconSize);
            }

            //re-order down
            if (index < areas.Count - 1)
            {
                if (widgetRow.ButtonIcon(TexButton.ReorderDown))
                {
                    Area other = areas[index + 1];
                    comp.Swap(area, other);
                }
            }
            else
            {
                widgetRow.Gap(WidgetRow.IconSize);
            }
        }
示例#25
0
        public override void Generate(Map map)
        {
            if (!map.TileInfo.WaterCovered)
            {
                map.regionAndRoomUpdater.Enabled = false;
                float num = 0.7f;
                List <RoofThreshold> list          = new List <RoofThreshold>();
                RoofThreshold        roofThreshold = new RoofThreshold();
                roofThreshold.roofDef    = RoofDefOf.RoofRockThick;
                roofThreshold.minGridVal = (float)(num * 1.1399999856948853);
                list.Add(roofThreshold);
                RoofThreshold roofThreshold2 = new RoofThreshold();
                roofThreshold2.roofDef    = RoofDefOf.RoofRockThin;
                roofThreshold2.minGridVal = (float)(num * 1.0399999618530273);
                list.Add(roofThreshold2);
                MapGenFloatGrid elevation = MapGenerator.Elevation;
                MapGenFloatGrid caves     = MapGenerator.Caves;
                foreach (IntVec3 allCell in map.AllCells)
                {
                    float num2 = elevation[allCell];
                    if (num2 > num)
                    {
                        if (caves[allCell] <= 0.0)
                        {
                            ThingDef def = GenStep_RocksFromGrid.RockDefAt(allCell);
                            GenSpawn.Spawn(def, allCell, map);
                        }
                        int num3 = 0;
                        while (num3 < list.Count)
                        {
                            if (!(num2 > list[num3].minGridVal))
                            {
                                num3++;
                                continue;
                            }
                            map.roofGrid.SetRoof(allCell, list[num3].roofDef);
                            break;
                        }
                    }
                }
                BoolGrid       visited  = new BoolGrid(map);
                List <IntVec3> toRemove = new List <IntVec3>();
                foreach (IntVec3 allCell2 in map.AllCells)
                {
                    if (!visited[allCell2] && this.IsNaturalRoofAt(allCell2, map))
                    {
                        toRemove.Clear();
                        map.floodFiller.FloodFill(allCell2, (IntVec3 x) => this.IsNaturalRoofAt(x, map), delegate(IntVec3 x)
                        {
                            visited[x] = true;
                            toRemove.Add(x);
                        }, 2147483647, false, null);
                        if (toRemove.Count < 20)
                        {
                            for (int i = 0; i < toRemove.Count; i++)
                            {
                                map.roofGrid.SetRoof(toRemove[i], null);
                            }
                        }
                    }
                }
                GenStep_ScatterLumpsMineable genStep_ScatterLumpsMineable = new GenStep_ScatterLumpsMineable();
                float num4 = 10f;
                switch (Find.WorldGrid[map.Tile].hilliness)
                {
                case Hilliness.Flat:
                    num4 = 4f;
                    break;

                case Hilliness.SmallHills:
                    num4 = 8f;
                    break;

                case Hilliness.LargeHills:
                    num4 = 11f;
                    break;

                case Hilliness.Mountainous:
                    num4 = 15f;
                    break;

                case Hilliness.Impassable:
                    num4 = 16f;
                    break;
                }
                genStep_ScatterLumpsMineable.countPer10kCellsRange = new FloatRange(num4, num4);
                genStep_ScatterLumpsMineable.Generate(map);
                map.regionAndRoomUpdater.Enabled = true;
            }
        }
        public override void Generate(Map map, GenStepParams parms)
        {
            if (!map.TileInfo.WaterCovered)
            {
                map.regionAndRoomUpdater.Enabled = false;
                float num = 0.7f;
                List <GenStep_RocksFromGrid.RoofThreshold> list = new List <GenStep_RocksFromGrid.RoofThreshold>();
                list.Add(new GenStep_RocksFromGrid.RoofThreshold
                {
                    roofDef    = RoofDefOf.RoofRockThick,
                    minGridVal = num * 1.14f
                });
                list.Add(new GenStep_RocksFromGrid.RoofThreshold
                {
                    roofDef    = RoofDefOf.RoofRockThin,
                    minGridVal = num * 1.04f
                });
                MapGenFloatGrid elevation = MapGenerator.Elevation;
                MapGenFloatGrid caves     = MapGenerator.Caves;
                foreach (IntVec3 intVec in map.AllCells)
                {
                    float num2 = elevation[intVec];
                    if (num2 > num)
                    {
                        if (caves[intVec] <= 0f)
                        {
                            ThingDef def = GenStep_RocksFromGrid.RockDefAt(intVec);
                            GenSpawn.Spawn(def, intVec, map, WipeMode.Vanish);
                        }
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (num2 > list[i].minGridVal)
                            {
                                map.roofGrid.SetRoof(intVec, list[i].roofDef);
                                break;
                            }
                        }
                    }
                }
                BoolGrid       visited  = new BoolGrid(map);
                List <IntVec3> toRemove = new List <IntVec3>();
                foreach (IntVec3 intVec2 in map.AllCells)
                {
                    if (!visited[intVec2])
                    {
                        if (this.IsNaturalRoofAt(intVec2, map))
                        {
                            toRemove.Clear();
                            map.floodFiller.FloodFill(intVec2, (IntVec3 x) => this.IsNaturalRoofAt(x, map), delegate(IntVec3 x)
                            {
                                visited[x] = true;
                                toRemove.Add(x);
                            }, int.MaxValue, false, null);
                            if (toRemove.Count < 20)
                            {
                                for (int j = 0; j < toRemove.Count; j++)
                                {
                                    map.roofGrid.SetRoof(toRemove[j], null);
                                }
                            }
                        }
                    }
                }
                GenStep_ScatterLumpsMineable genStep_ScatterLumpsMineable = new GenStep_ScatterLumpsMineable();
                genStep_ScatterLumpsMineable.maxValue = this.maxMineableValue;
                float num3 = 10f;
                switch (Find.WorldGrid[map.Tile].hilliness)
                {
                case Hilliness.Flat:
                    num3 = 4f;
                    break;

                case Hilliness.SmallHills:
                    num3 = 8f;
                    break;

                case Hilliness.LargeHills:
                    num3 = 11f;
                    break;

                case Hilliness.Mountainous:
                    num3 = 15f;
                    break;

                case Hilliness.Impassable:
                    num3 = 16f;
                    break;
                }
                genStep_ScatterLumpsMineable.countPer10kCellsRange = new FloatRange(num3, num3);
                genStep_ScatterLumpsMineable.Generate(map, parms);
                map.regionAndRoomUpdater.Enabled = true;
            }
        }
示例#27
0
        public static void MakeColony(params ColonyMakerFlag[] flags)
        {
            bool godMode = DebugSettings.godMode;

            DebugSettings.godMode            = true;
            Thing.allowDestroyNonDestroyable = true;
            if (Autotests_ColonyMaker.usedCells == null)
            {
                Autotests_ColonyMaker.usedCells = new BoolGrid(Autotests_ColonyMaker.Map);
            }
            else
            {
                Autotests_ColonyMaker.usedCells.ClearAndResizeTo(Autotests_ColonyMaker.Map);
            }
            Autotests_ColonyMaker.overRect = new CellRect(Autotests_ColonyMaker.Map.Center.x - 50, Autotests_ColonyMaker.Map.Center.z - 50, 100, 100);
            Autotests_ColonyMaker.DeleteAllSpawnedPawns();
            GenDebug.ClearArea(Autotests_ColonyMaker.overRect, Find.VisibleMap);
            if (flags.Contains(ColonyMakerFlag.Animals))
            {
                foreach (PawnKindDef current in from k in DefDatabase <PawnKindDef> .AllDefs
                         where k.RaceProps.Animal
                         select k)
                {
                    CellRect cellRect;
                    if (!Autotests_ColonyMaker.TryGetFreeRect(6, 3, out cellRect))
                    {
                        return;
                    }
                    cellRect = cellRect.ContractedBy(1);
                    foreach (IntVec3 current2 in cellRect)
                    {
                        Autotests_ColonyMaker.Map.terrainGrid.SetTerrain(current2, TerrainDefOf.Concrete);
                    }
                    GenSpawn.Spawn(PawnGenerator.GeneratePawn(current, null), cellRect.Cells.ElementAt(0), Autotests_ColonyMaker.Map);
                    IntVec3 intVec = cellRect.Cells.ElementAt(1);
                    Pawn    p      = (Pawn)GenSpawn.Spawn(PawnGenerator.GeneratePawn(current, null), intVec, Autotests_ColonyMaker.Map);
                    HealthUtility.DamageUntilDead(p);
                    Corpse       thing        = (Corpse)intVec.GetThingList(Find.VisibleMap).First((Thing t) => t is Corpse);
                    CompRottable compRottable = thing.TryGetComp <CompRottable>();
                    if (compRottable != null)
                    {
                        compRottable.RotProgress += 1200000f;
                    }
                    if (current.RaceProps.leatherDef != null)
                    {
                        GenSpawn.Spawn(current.RaceProps.leatherDef, cellRect.Cells.ElementAt(2), Autotests_ColonyMaker.Map);
                    }
                    if (current.RaceProps.meatDef != null)
                    {
                        GenSpawn.Spawn(current.RaceProps.meatDef, cellRect.Cells.ElementAt(3), Autotests_ColonyMaker.Map);
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.ConduitGrid))
            {
                Designator_Build designator_Build = new Designator_Build(ThingDefOf.PowerConduit);
                for (int i = Autotests_ColonyMaker.overRect.minX; i < Autotests_ColonyMaker.overRect.maxX; i++)
                {
                    for (int j = Autotests_ColonyMaker.overRect.minZ; j < Autotests_ColonyMaker.overRect.maxZ; j += 7)
                    {
                        designator_Build.DesignateSingleCell(new IntVec3(i, 0, j));
                    }
                }
                for (int k2 = Autotests_ColonyMaker.overRect.minZ; k2 < Autotests_ColonyMaker.overRect.maxZ; k2++)
                {
                    for (int l = Autotests_ColonyMaker.overRect.minX; l < Autotests_ColonyMaker.overRect.maxX; l += 7)
                    {
                        designator_Build.DesignateSingleCell(new IntVec3(l, 0, k2));
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.PowerPlants))
            {
                List <ThingDef> list = new List <ThingDef>
                {
                    ThingDefOf.SolarGenerator,
                    ThingDefOf.WindTurbine
                };
                for (int m = 0; m < 8; m++)
                {
                    if (Autotests_ColonyMaker.TryMakeBuilding(list[m % list.Count]) == null)
                    {
                        Log.Message("Could not make solar generator.");
                        break;
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.Batteries))
            {
                for (int n = 0; n < 6; n++)
                {
                    Thing thing2 = Autotests_ColonyMaker.TryMakeBuilding(ThingDefOf.Battery);
                    if (thing2 == null)
                    {
                        Log.Message("Could not make battery.");
                        break;
                    }
                    ((Building_Battery)thing2).GetComp <CompPowerBattery>().AddEnergy(999999f);
                }
            }
            if (flags.Contains(ColonyMakerFlag.WorkTables))
            {
                IEnumerable <ThingDef> enumerable = from def in DefDatabase <ThingDef> .AllDefs
                                                    where typeof(Building_WorkTable).IsAssignableFrom(def.thingClass)
                                                    select def;
                foreach (ThingDef current3 in enumerable)
                {
                    Thing thing3 = Autotests_ColonyMaker.TryMakeBuilding(current3);
                    if (thing3 == null)
                    {
                        Log.Message("Could not make worktable: " + current3.defName);
                        break;
                    }
                    Building_WorkTable building_WorkTable = thing3 as Building_WorkTable;
                    if (building_WorkTable != null)
                    {
                        foreach (RecipeDef current4 in building_WorkTable.def.AllRecipes)
                        {
                            building_WorkTable.billStack.AddBill(current4.MakeNewBill());
                        }
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.AllBuildings))
            {
                IEnumerable <ThingDef> enumerable2 = from def in DefDatabase <ThingDef> .AllDefs
                                                     where def.category == ThingCategory.Building && def.designationCategory != null
                                                     select def;
                foreach (ThingDef current5 in enumerable2)
                {
                    if (current5 != ThingDefOf.PowerConduit)
                    {
                        if (Autotests_ColonyMaker.TryMakeBuilding(current5) == null)
                        {
                            Log.Message("Could not make building: " + current5.defName);
                            break;
                        }
                    }
                }
            }
            CellRect rect;

            if (!Autotests_ColonyMaker.TryGetFreeRect(33, 33, out rect))
            {
                Log.Error("Could not get wallable rect");
            }
            rect = rect.ContractedBy(1);
            if (flags.Contains(ColonyMakerFlag.AllItems))
            {
                List <ThingDef> itemDefs = (from def in DefDatabase <ThingDef> .AllDefs
                                            where DebugThingPlaceHelper.IsDebugSpawnable(def) && def.category == ThingCategory.Item
                                            select def).ToList <ThingDef>();
                Autotests_ColonyMaker.FillWithItems(rect, itemDefs);
            }
            else if (flags.Contains(ColonyMakerFlag.ItemsRawFood))
            {
                List <ThingDef> list2 = new List <ThingDef>();
                list2.Add(ThingDefOf.RawPotatoes);
                Autotests_ColonyMaker.FillWithItems(rect, list2);
            }
            if (flags.Contains(ColonyMakerFlag.Filth))
            {
                foreach (IntVec3 current6 in rect)
                {
                    GenSpawn.Spawn(ThingDefOf.FilthDirt, current6, Autotests_ColonyMaker.Map);
                }
            }
            if (flags.Contains(ColonyMakerFlag.ItemsWall))
            {
                CellRect         cellRect2         = rect.ExpandedBy(1);
                Designator_Build designator_Build2 = new Designator_Build(ThingDefOf.Wall);
                designator_Build2.SetStuffDef(ThingDefOf.WoodLog);
                foreach (IntVec3 current7 in cellRect2.EdgeCells)
                {
                    designator_Build2.DesignateSingleCell(current7);
                }
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsMany))
            {
                Autotests_ColonyMaker.MakeColonists(15, Autotests_ColonyMaker.overRect.CenterCell);
            }
            else if (flags.Contains(ColonyMakerFlag.ColonistOne))
            {
                Autotests_ColonyMaker.MakeColonists(1, Autotests_ColonyMaker.overRect.CenterCell);
            }
            if (flags.Contains(ColonyMakerFlag.Fire))
            {
                CellRect cellRect3;
                if (!Autotests_ColonyMaker.TryGetFreeRect(30, 30, out cellRect3))
                {
                    Log.Error("Could not get free rect for fire.");
                }
                ThingDef plantTreeOak = ThingDefOf.PlantTreeOak;
                foreach (IntVec3 current8 in cellRect3)
                {
                    GenSpawn.Spawn(plantTreeOak, current8, Autotests_ColonyMaker.Map);
                }
                foreach (IntVec3 current9 in cellRect3)
                {
                    if (current9.x % 7 == 0 && current9.z % 7 == 0)
                    {
                        GenExplosion.DoExplosion(current9, Find.VisibleMap, 3.9f, DamageDefOf.Flame, null, -1, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false);
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsHungry))
            {
                Autotests_ColonyMaker.DoToColonists(0.4f, delegate(Pawn col)
                {
                    col.needs.food.CurLevel = Mathf.Max(0f, Rand.Range(-0.05f, 0.05f));
                });
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsTired))
            {
                Autotests_ColonyMaker.DoToColonists(0.4f, delegate(Pawn col)
                {
                    col.needs.rest.CurLevel = Mathf.Max(0f, Rand.Range(-0.05f, 0.05f));
                });
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsInjured))
            {
                Autotests_ColonyMaker.DoToColonists(0.4f, delegate(Pawn col)
                {
                    DamageDef def = (from d in DefDatabase <DamageDef> .AllDefs
                                     where d.externalViolence
                                     select d).RandomElement <DamageDef>();
                    col.TakeDamage(new DamageInfo(def, 10, -1f, null, null, null, DamageInfo.SourceCategory.ThingOrUnknown));
                });
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsDiseased))
            {
                foreach (HediffDef current10 in from d in DefDatabase <HediffDef> .AllDefs
                         where d.hediffClass != typeof(Hediff_AddedPart) && (d.HasComp(typeof(HediffComp_Immunizable)) || d.HasComp(typeof(HediffComp_GrowthMode)))
                         select d)
                {
                    Pawn     pawn = PawnGenerator.GeneratePawn(Faction.OfPlayer.def.basicMemberKind, Faction.OfPlayer);
                    CellRect cellRect4;
                    Autotests_ColonyMaker.TryGetFreeRect(1, 1, out cellRect4);
                    GenSpawn.Spawn(pawn, cellRect4.CenterCell, Autotests_ColonyMaker.Map);
                    pawn.health.AddHediff(current10, null, null);
                }
            }
            if (flags.Contains(ColonyMakerFlag.Beds))
            {
                IEnumerable <ThingDef> source = from def in DefDatabase <ThingDef> .AllDefs
                                                where def.thingClass == typeof(Building_Bed)
                                                select def;
                int freeColonistsCount = Autotests_ColonyMaker.Map.mapPawns.FreeColonistsCount;
                for (int num = 0; num < freeColonistsCount; num++)
                {
                    if (Autotests_ColonyMaker.TryMakeBuilding(source.RandomElement <ThingDef>()) == null)
                    {
                        Log.Message("Could not make beds.");
                        break;
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.Stockpiles))
            {
                Designator_ZoneAddStockpile_Resources designator_ZoneAddStockpile_Resources = new Designator_ZoneAddStockpile_Resources();
                foreach (StoragePriority priority in Enum.GetValues(typeof(StoragePriority)))
                {
                    CellRect cellRect5;
                    Autotests_ColonyMaker.TryGetFreeRect(7, 7, out cellRect5);
                    cellRect5 = cellRect5.ContractedBy(1);
                    designator_ZoneAddStockpile_Resources.DesignateMultiCell(cellRect5.Cells);
                    Zone_Stockpile zone_Stockpile = (Zone_Stockpile)Autotests_ColonyMaker.Map.zoneManager.ZoneAt(cellRect5.CenterCell);
                    zone_Stockpile.settings.Priority = priority;
                }
            }
            if (flags.Contains(ColonyMakerFlag.GrowingZones))
            {
                Zone_Growing dummyZone = new Zone_Growing(Autotests_ColonyMaker.Map.zoneManager);
                foreach (ThingDef current11 in from d in DefDatabase <ThingDef> .AllDefs
                         where d.plant != null && GenPlant.CanSowOnGrower(d, dummyZone)
                         select d)
                {
                    CellRect cellRect6;
                    if (!Autotests_ColonyMaker.TryGetFreeRect(6, 6, out cellRect6))
                    {
                        Log.Error("Could not get growing zone rect.");
                    }
                    cellRect6 = cellRect6.ContractedBy(1);
                    foreach (IntVec3 current12 in cellRect6)
                    {
                        Autotests_ColonyMaker.Map.terrainGrid.SetTerrain(current12, TerrainDefOf.Soil);
                    }
                    Designator_ZoneAdd_Growing designator_ZoneAdd_Growing = new Designator_ZoneAdd_Growing();
                    designator_ZoneAdd_Growing.DesignateMultiCell(cellRect6.Cells);
                    Zone_Growing zone_Growing = (Zone_Growing)Autotests_ColonyMaker.Map.zoneManager.ZoneAt(cellRect6.CenterCell);
                    zone_Growing.SetPlantDefToGrow(current11);
                }
                dummyZone.Delete();
            }
            Autotests_ColonyMaker.ClearAllHomeArea();
            Autotests_ColonyMaker.FillWithHomeArea(Autotests_ColonyMaker.overRect);
            DebugSettings.godMode            = godMode;
            Thing.allowDestroyNonDestroyable = false;
        }
示例#28
0
        public static void MakeColony(params ColonyMakerFlag[] flags)
        {
            bool godMode = DebugSettings.godMode;

            DebugSettings.godMode            = true;
            Thing.allowDestroyNonDestroyable = true;
            if (usedCells == null)
            {
                usedCells = new BoolGrid(Map);
            }
            else
            {
                usedCells.ClearAndResizeTo(Map);
            }
            IntVec3 center  = Map.Center;
            int     minX    = center.x - 50;
            IntVec3 center2 = Map.Center;

            overRect = new CellRect(minX, center2.z - 50, 100, 100);
            DeleteAllSpawnedPawns();
            GenDebug.ClearArea(overRect, Find.CurrentMap);
            if (flags.Contains(ColonyMakerFlag.Animals))
            {
                foreach (PawnKindDef item in from k in DefDatabase <PawnKindDef> .AllDefs
                         where k.RaceProps.Animal
                         select k)
                {
                    if (!TryGetFreeRect(6, 3, out CellRect result))
                    {
                        return;
                    }
                    result = result.ContractedBy(1);
                    foreach (IntVec3 item2 in result)
                    {
                        Map.terrainGrid.SetTerrain(item2, TerrainDefOf.Concrete);
                    }
                    GenSpawn.Spawn(PawnGenerator.GeneratePawn(item), result.Cells.ElementAt(0), Map);
                    IntVec3 intVec = result.Cells.ElementAt(1);
                    Pawn    p      = (Pawn)GenSpawn.Spawn(PawnGenerator.GeneratePawn(item), intVec, Map);
                    HealthUtility.DamageUntilDead(p);
                    Corpse       thing        = (Corpse)intVec.GetThingList(Find.CurrentMap).First((Thing t) => t is Corpse);
                    CompRottable compRottable = thing.TryGetComp <CompRottable>();
                    if (compRottable != null)
                    {
                        compRottable.RotProgress += 1200000f;
                    }
                    if (item.RaceProps.leatherDef != null)
                    {
                        GenSpawn.Spawn(item.RaceProps.leatherDef, result.Cells.ElementAt(2), Map);
                    }
                    if (item.RaceProps.meatDef != null)
                    {
                        GenSpawn.Spawn(item.RaceProps.meatDef, result.Cells.ElementAt(3), Map);
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.ConduitGrid))
            {
                Designator_Build designator_Build = new Designator_Build(ThingDefOf.PowerConduit);
                for (int i = overRect.minX; i < overRect.maxX; i++)
                {
                    for (int j = overRect.minZ; j < overRect.maxZ; j += 7)
                    {
                        designator_Build.DesignateSingleCell(new IntVec3(i, 0, j));
                    }
                }
                for (int l = overRect.minZ; l < overRect.maxZ; l++)
                {
                    for (int m = overRect.minX; m < overRect.maxX; m += 7)
                    {
                        designator_Build.DesignateSingleCell(new IntVec3(m, 0, l));
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.PowerPlants))
            {
                List <ThingDef> list = new List <ThingDef>();
                list.Add(ThingDefOf.SolarGenerator);
                list.Add(ThingDefOf.WindTurbine);
                List <ThingDef> list2 = list;
                for (int n = 0; n < 8; n++)
                {
                    if (TryMakeBuilding(list2[n % list2.Count]) == null)
                    {
                        Log.Message("Could not make solar generator.");
                        break;
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.Batteries))
            {
                for (int num = 0; num < 6; num++)
                {
                    Thing thing2 = TryMakeBuilding(ThingDefOf.Battery);
                    if (thing2 == null)
                    {
                        Log.Message("Could not make battery.");
                        break;
                    }
                    ((Building_Battery)thing2).GetComp <CompPowerBattery>().AddEnergy(999999f);
                }
            }
            if (flags.Contains(ColonyMakerFlag.WorkTables))
            {
                IEnumerable <ThingDef> enumerable = from def in DefDatabase <ThingDef> .AllDefs
                                                    where typeof(Building_WorkTable).IsAssignableFrom(def.thingClass)
                                                    select def;
                foreach (ThingDef item3 in enumerable)
                {
                    Thing thing3 = TryMakeBuilding(item3);
                    if (thing3 == null)
                    {
                        Log.Message("Could not make worktable: " + item3.defName);
                        break;
                    }
                    Building_WorkTable building_WorkTable = thing3 as Building_WorkTable;
                    if (building_WorkTable != null)
                    {
                        foreach (RecipeDef allRecipe in building_WorkTable.def.AllRecipes)
                        {
                            building_WorkTable.billStack.AddBill(allRecipe.MakeNewBill());
                        }
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.AllBuildings))
            {
                IEnumerable <ThingDef> enumerable2 = from def in DefDatabase <ThingDef> .AllDefs
                                                     where def.category == ThingCategory.Building && def.BuildableByPlayer
                                                     select def;
                foreach (ThingDef item4 in enumerable2)
                {
                    if (item4 != ThingDefOf.PowerConduit)
                    {
                        Thing thing4 = TryMakeBuilding(item4);
                        if (thing4 == null)
                        {
                            Log.Message("Could not make building: " + item4.defName);
                            break;
                        }
                    }
                }
            }
            if (!TryGetFreeRect(33, 33, out CellRect result2))
            {
                Log.Error("Could not get wallable rect");
            }
            result2 = result2.ContractedBy(1);
            if (flags.Contains(ColonyMakerFlag.AllItems))
            {
                List <ThingDef> itemDefs = (from def in DefDatabase <ThingDef> .AllDefs
                                            where DebugThingPlaceHelper.IsDebugSpawnable(def) && def.category == ThingCategory.Item
                                            select def).ToList();
                FillWithItems(result2, itemDefs);
            }
            else if (flags.Contains(ColonyMakerFlag.ItemsRawFood))
            {
                List <ThingDef> list3 = new List <ThingDef>();
                list3.Add(ThingDefOf.RawPotatoes);
                FillWithItems(result2, list3);
            }
            if (flags.Contains(ColonyMakerFlag.Filth))
            {
                foreach (IntVec3 item5 in result2)
                {
                    GenSpawn.Spawn(ThingDefOf.Filth_Dirt, item5, Map);
                }
            }
            if (flags.Contains(ColonyMakerFlag.ItemsWall))
            {
                CellRect         cellRect          = result2.ExpandedBy(1);
                Designator_Build designator_Build2 = new Designator_Build(ThingDefOf.Wall);
                designator_Build2.SetStuffDef(ThingDefOf.WoodLog);
                foreach (IntVec3 edgeCell in cellRect.EdgeCells)
                {
                    designator_Build2.DesignateSingleCell(edgeCell);
                }
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsMany))
            {
                MakeColonists(15, overRect.CenterCell);
            }
            else if (flags.Contains(ColonyMakerFlag.ColonistOne))
            {
                MakeColonists(1, overRect.CenterCell);
            }
            if (flags.Contains(ColonyMakerFlag.Fire))
            {
                if (!TryGetFreeRect(30, 30, out CellRect result3))
                {
                    Log.Error("Could not get free rect for fire.");
                }
                ThingDef plant_TreeOak = ThingDefOf.Plant_TreeOak;
                foreach (IntVec3 item6 in result3)
                {
                    GenSpawn.Spawn(plant_TreeOak, item6, Map);
                }
                foreach (IntVec3 item7 in result3)
                {
                    IntVec3 current9 = item7;
                    if (current9.x % 7 == 0 && current9.z % 7 == 0)
                    {
                        GenExplosion.DoExplosion(current9, Find.CurrentMap, 3.9f, DamageDefOf.Flame, null);
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsHungry))
            {
                DoToColonists(0.4f, delegate(Pawn col)
                {
                    col.needs.food.CurLevel = Mathf.Max(0f, Rand.Range(-0.05f, 0.05f));
                });
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsTired))
            {
                DoToColonists(0.4f, delegate(Pawn col)
                {
                    col.needs.rest.CurLevel = Mathf.Max(0f, Rand.Range(-0.05f, 0.05f));
                });
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsInjured))
            {
                DoToColonists(0.4f, delegate(Pawn col)
                {
                    DamageDef def2 = (from d in DefDatabase <DamageDef> .AllDefs
                                      where d.ExternalViolenceFor(null)
                                      select d).RandomElement();
                    col.TakeDamage(new DamageInfo(def2, 10f));
                });
            }
            if (flags.Contains(ColonyMakerFlag.ColonistsDiseased))
            {
                foreach (HediffDef item8 in from d in DefDatabase <HediffDef> .AllDefs
                         where d.hediffClass != typeof(Hediff_AddedPart) && (d.HasComp(typeof(HediffComp_Immunizable)) || d.HasComp(typeof(HediffComp_GrowthMode)))
                         select d)
                {
                    Pawn pawn = PawnGenerator.GeneratePawn(Faction.OfPlayer.def.basicMemberKind, Faction.OfPlayer);
                    TryGetFreeRect(1, 1, out CellRect result4);
                    GenSpawn.Spawn(pawn, result4.CenterCell, Map);
                    pawn.health.AddHediff(item8);
                }
            }
            if (flags.Contains(ColonyMakerFlag.Beds))
            {
                IEnumerable <ThingDef> source = from def in DefDatabase <ThingDef> .AllDefs
                                                where def.thingClass == typeof(Building_Bed)
                                                select def;
                int freeColonistsCount = Map.mapPawns.FreeColonistsCount;
                for (int num2 = 0; num2 < freeColonistsCount; num2++)
                {
                    if (TryMakeBuilding(source.RandomElement()) == null)
                    {
                        Log.Message("Could not make beds.");
                        break;
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.Stockpiles))
            {
                Designator_ZoneAddStockpile_Resources designator_ZoneAddStockpile_Resources = new Designator_ZoneAddStockpile_Resources();
                IEnumerator enumerator11 = Enum.GetValues(typeof(StoragePriority)).GetEnumerator();
                try
                {
                    while (enumerator11.MoveNext())
                    {
                        StoragePriority priority = (StoragePriority)enumerator11.Current;
                        TryGetFreeRect(7, 7, out CellRect result5);
                        result5 = result5.ContractedBy(1);
                        designator_ZoneAddStockpile_Resources.DesignateMultiCell(result5.Cells);
                        Zone_Stockpile zone_Stockpile = (Zone_Stockpile)Map.zoneManager.ZoneAt(result5.CenterCell);
                        zone_Stockpile.settings.Priority = priority;
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator11 as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
            }
            if (flags.Contains(ColonyMakerFlag.GrowingZones))
            {
                Zone_Growing dummyZone = new Zone_Growing(Map.zoneManager);
                Map.zoneManager.RegisterZone(dummyZone);
                foreach (ThingDef item9 in from d in DefDatabase <ThingDef> .AllDefs
                         where d.plant != null && PlantUtility.CanSowOnGrower(d, dummyZone)
                         select d)
                {
                    if (!TryGetFreeRect(6, 6, out CellRect result6))
                    {
                        Log.Error("Could not get growing zone rect.");
                    }
                    result6 = result6.ContractedBy(1);
                    foreach (IntVec3 item10 in result6)
                    {
                        Map.terrainGrid.SetTerrain(item10, TerrainDefOf.Soil);
                    }
                    Designator_ZoneAdd_Growing designator_ZoneAdd_Growing = new Designator_ZoneAdd_Growing();
                    designator_ZoneAdd_Growing.DesignateMultiCell(result6.Cells);
                    (Map.zoneManager.ZoneAt(result6.CenterCell) as Zone_Growing)?.SetPlantDefToGrow(item9);
                }
                dummyZone.Delete();
            }
            ClearAllHomeArea();
            FillWithHomeArea(overRect);
            DebugSettings.godMode            = godMode;
            Thing.allowDestroyNonDestroyable = false;
        }
示例#29
0
        public override void OnStart(Bot bot)
        {
            MicroControllers.Add(new StayByCannonsController());
            MicroControllers.Add(new FleeCyclonesController());
            MicroControllers.Add(new SentryController()
            {
                FleeEnemies = false, UseHallucaination = true
            });
            MicroControllers.Add(new DodgeBallController());
            MicroControllers.Add(new TargetUnguardedBuildingsController());
            MicroControllers.Add(new StutterController());
            MicroControllers.Add(new KillTargetController(UnitTypes.SCV)
            {
                MaxDist = 4
            });
            MicroControllers.Add(new KillTargetController(UnitTypes.SCV, true));

            if (SkipNatural)
            {
                foreach (Base b in bot.BaseManager.Bases)
                {
                    if (b == Main)
                    {
                        continue;
                    }
                    if (SC2Util.DistanceSq(b.BaseLocation.Pos, Main.BaseLocation.Pos) >= 50 * 50)
                    {
                        continue;
                    }
                    BuildingPlacement.ReservedBuilding reservedExpand = new BuildingPlacement.ReservedBuilding();
                    reservedExpand.Pos  = b.BaseLocation.Pos;
                    reservedExpand.Type = UnitTypes.NEXUS;
                    bot.buildingPlacer.ReservedLocation.Add(reservedExpand);
                }
            }

            foreach (WorkerDefenseTask task in WorkerDefenseTask.Tasks)
            {
                task.OnlyDefendInsideMain = true;
            }

            bot.TargetManager.PrefferDistant = false;

            RampDefensePos = new PotentialHelper(MainDefensePos, 4).To(bot.MapAnalyzer.GetMainRamp()).Get();

            if (Bot.Main.EnemyRace == Race.Terran)
            {
                WallIn.CreateReaperWall(new List <uint> {
                    UnitTypes.GATEWAY, UnitTypes.PYLON, UnitTypes.CYBERNETICS_CORE
                });
                WallIn.ReserveSpace();
            }

            NaturalCannonDefensePos = NaturalDefensePos;

            if (Bot.Main.EnemyRace == Race.Zerg && !SkipNatural)
            {
                NaturalWall.CreateFullNatural(new List <uint>()
                {
                    UnitTypes.GATEWAY, UnitTypes.GATEWAY, UnitTypes.PYLON, UnitTypes.GATEWAY
                });
                NaturalWall.ReserveSpace();

                if (NaturalWall.Wall.Count >= 4)
                {
                    if (bot.Map == MapEnum.Acropolis ||
                        bot.Map == MapEnum.Thunderbird)
                    {
                        WallBuilding temp = NaturalWall.Wall[3];
                        NaturalWall.Wall[3]     = NaturalWall.Wall[0];
                        NaturalWall.Wall[0]     = temp;
                        NaturalCannonDefensePos = new PotentialHelper(NaturalDefensePos, 4).To(Natural.BaseLocation.Pos).Get();
                    }
                    MainAndNatural = Bot.Main.MapAnalyzer.FindMainAndNaturalArea(NaturalWall);
                }
            }

            Set += ProtossBuildUtil.Pylons(() => Count(UnitTypes.PYLON) > 0 && Count(UnitTypes.CYBERNETICS_CORE) > 0);
            Set += ExpandBuildings();
            Set += Units();
            Set += MainBuildList();
        }
示例#30
0
        public override void Generate(Map map)
        {
            if (map.TileInfo.WaterCovered)
            {
                return;
            }
            map.regionAndRoomUpdater.Enabled = false;
            float num = 0.7f;
            List <RoofThreshold> list = new List <RoofThreshold>();

            list.Add(new RoofThreshold
            {
                roofDef    = RoofDefOf.RoofRockThick,
                minGridVal = num * 1.14f
            });
            list.Add(new RoofThreshold
            {
                roofDef    = RoofDefOf.RoofRockThin,
                minGridVal = num * 1.04f
            });
            MapGenFloatGrid elevation = MapGenerator.Elevation;

            foreach (IntVec3 current in map.AllCells)
            {
                float num2 = elevation[current];
                if (num2 > num)
                {
                    ThingDef def = GenStep_RocksFromGrid.RockDefAt(current);
                    GenSpawn.Spawn(def, current, map);
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (num2 > list[i].minGridVal)
                        {
                            map.roofGrid.SetRoof(current, list[i].roofDef);
                            break;
                        }
                    }
                }
            }
            BoolGrid       visited  = new BoolGrid(map);
            List <IntVec3> toRemove = new List <IntVec3>();

            foreach (IntVec3 current2 in map.AllCells)
            {
                if (!visited[current2])
                {
                    if (this.IsNaturalRoofAt(current2, map))
                    {
                        toRemove.Clear();
                        map.floodFiller.FloodFill(current2, (IntVec3 x) => this.IsNaturalRoofAt(x, map), delegate(IntVec3 x)
                        {
                            visited[x] = true;
                            toRemove.Add(x);
                        }, false);
                        if (toRemove.Count < 20)
                        {
                            for (int j = 0; j < toRemove.Count; j++)
                            {
                                map.roofGrid.SetRoof(toRemove[j], null);
                            }
                        }
                    }
                }
            }
            GenStep_ScatterLumpsMineable genStep_ScatterLumpsMineable = new GenStep_ScatterLumpsMineable();
            float num3 = 10f;

            // Use RA values here
            var defExtension = def.GetModExtension <GenStepExtension>() ?? new GenStepExtension();

            switch (Find.WorldGrid[map.Tile].hilliness)
            {
            case Hilliness.Flat:
                num3 = defExtension.FlatMineablesPer10kCells;
                break;

            case Hilliness.SmallHills:
                num3 = defExtension.SmallHillsMineablesPer10kCells;
                break;

            case Hilliness.LargeHills:
                num3 = defExtension.LargeHillsMineablesPer10kCells;
                break;

            case Hilliness.Mountainous:
                num3 = defExtension.MountainousMineablesPer10kCells;
                break;

            case Hilliness.Impassable:
                num3 = 16f;
                break;
            }
            genStep_ScatterLumpsMineable.countPer10kCellsRange = new FloatRange(num3, num3);
            genStep_ScatterLumpsMineable.Generate(map);
            map.regionAndRoomUpdater.Enabled = true;
        }