Basic crater map / Spray tool / Crater floor / canProduce()

This commit is contained in:
Anuken
2019-01-22 23:02:04 -05:00
parent 55e1759b47
commit e9e2cd614d
23 changed files with 1213 additions and 1213 deletions

View File

@@ -138,7 +138,8 @@ public class MapTileData{
}
public enum DataPosition{
floor, wall, link, rotationTeam, elevation
floor, wall, link, rotationTeam,
@Deprecated elevation
}
public class TileDataMarker{

View File

@@ -18,6 +18,9 @@ public class MapGenerator extends Generator{
private Map map;
private String mapName;
/**How much the landscape is randomly distorted.*/
public float distortion = 3;
/**The amount of final enemy spawns used. -1 to use everything in the map.
* This amount of enemy spawns is selected randomly from the map.*/
public int enemySpawns = -1;
@@ -70,9 +73,8 @@ public class MapGenerator extends Generator{
for(int x = 0; x < data.width(); x++){
for(int y = 0; y < data.height(); y++){
final double scl = 10;
final int mag = 3;
int newX = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x, y) * mag + x), 0, data.width()-1);
int newY = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x + 9999, y + 9999) * mag + y), 0, data.height()-1);
int newX = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x, y) * distortion + x), 0, data.width()-1);
int newY = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x + 9999, y + 9999) * distortion + y), 0, data.height()-1);
if(tiles[newX][newY].block() != Blocks.spawn && !tiles[x][y].block().synthetic()&& !tiles[newX][newY].block().synthetic()){
tiles[x][y].setBlock(tiles[newX][newY].block());
}