Removed ores near enemy spawns
This commit is contained in:
@@ -138,8 +138,7 @@ public class MapTileData{
|
||||
}
|
||||
|
||||
public enum DataPosition{
|
||||
floor, wall, link, rotationTeam,
|
||||
@Deprecated elevation
|
||||
floor, wall, link, rotationTeam, elevation
|
||||
}
|
||||
|
||||
public class TileDataMarker{
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.anuke.mindustry.maps.generators;
|
||||
import io.anuke.arc.collection.Array;
|
||||
import io.anuke.arc.math.Mathf;
|
||||
import io.anuke.arc.math.geom.Point2;
|
||||
import io.anuke.arc.util.Structs;
|
||||
import io.anuke.arc.util.noise.Simplex;
|
||||
import io.anuke.mindustry.content.Blocks;
|
||||
import io.anuke.mindustry.io.MapIO;
|
||||
@@ -10,6 +11,7 @@ import io.anuke.mindustry.maps.Map;
|
||||
import io.anuke.mindustry.maps.MapTileData;
|
||||
import io.anuke.mindustry.maps.MapTileData.TileDataMarker;
|
||||
import io.anuke.mindustry.world.Tile;
|
||||
import io.anuke.mindustry.world.blocks.OreBlock;
|
||||
import io.anuke.mindustry.world.blocks.storage.CoreBlock;
|
||||
|
||||
import static io.anuke.mindustry.Vars.*;
|
||||
@@ -90,6 +92,22 @@ public class MapGenerator extends Generator{
|
||||
for(int i = 0; i < enemySpawns; i++){
|
||||
Point2 point = enemies.get(i);
|
||||
tiles[point.x][point.y].setBlock(Blocks.spawn);
|
||||
|
||||
int rad = 10, frad = 12;
|
||||
|
||||
for(int x = rad; x <= rad; x++){
|
||||
for(int y = rad; y <= rad; y++){
|
||||
int wx = x + point.x, wy = y + point.y;
|
||||
double dst = Mathf.dst(x, y);
|
||||
if(dst < frad && Structs.inBounds(wx, wy, tiles) && (dst <= rad || Mathf.chance(0.5))){
|
||||
Tile tile = tiles[wx][wy];
|
||||
if(tile.floor() instanceof OreBlock){
|
||||
OreBlock block = (OreBlock)tile.floor();
|
||||
tile.setFloor(block.base);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class LegacyColorMapper implements ContentList{
|
||||
|
||||
@Override
|
||||
public void load(){
|
||||
defaultValue = new LegacyBlock(Blocks.stone, 0);
|
||||
defaultValue = new LegacyBlock(Blocks.stone, Blocks.air);
|
||||
|
||||
map("ff0000", Blocks.dirt, 0);
|
||||
map("00ff00", Blocks.stone, 0);
|
||||
@@ -44,17 +44,22 @@ public class LegacyColorMapper implements ContentList{
|
||||
map("83bc58", OreBlock.get(Blocks.stone, Items.thorium), 0);
|
||||
}
|
||||
|
||||
private void map(String color, Block block, int elevation){
|
||||
blockMap.put(Color.rgba8888(Color.valueOf(color)), new LegacyBlock(block, elevation));
|
||||
private void map(String color, Block block, Block wall){
|
||||
blockMap.put(Color.rgba8888(Color.valueOf(color)), new LegacyBlock(block, wall));
|
||||
}
|
||||
|
||||
//todo fix this, implement proper mapping w/ walls
|
||||
private void map(String color, Block block, int __TODO_fix_this){
|
||||
blockMap.put(Color.rgba8888(Color.valueOf(color)), new LegacyBlock(block, Blocks.air));
|
||||
}
|
||||
|
||||
public static class LegacyBlock{
|
||||
public final int elevation;
|
||||
public final Floor floor;
|
||||
public final Block wall;
|
||||
|
||||
public LegacyBlock(Block floor, int elevation){
|
||||
this.elevation = elevation;
|
||||
public LegacyBlock(Block floor, Block wall){
|
||||
this.floor = (Floor) floor;
|
||||
this.wall = wall;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user