New map ore balancing / Reduced item burn rate
This commit is contained in:
@@ -210,13 +210,7 @@ public class Maps implements Disposable{
|
||||
}}
|
||||
);
|
||||
|
||||
int index = 0;
|
||||
for(Block block : new Block[]{Blocks.oreCopper, Blocks.oreLead, Blocks.oreCoal, Blocks.oreTitanium, Blocks.oreThorium}){
|
||||
OreFilter filter = new OreFilter();
|
||||
filter.threshold += index ++ * 0.019f;
|
||||
filter.ore = block;
|
||||
filters.add(filter);
|
||||
}
|
||||
addDefaultOres(filters);
|
||||
|
||||
return filters;
|
||||
}else{
|
||||
@@ -224,6 +218,17 @@ public class Maps implements Disposable{
|
||||
}
|
||||
}
|
||||
|
||||
public void addDefaultOres(Array<GenerateFilter> filters){
|
||||
int index = 0;
|
||||
for(Block block : new Block[]{Blocks.oreCopper, Blocks.oreLead, Blocks.oreCoal, Blocks.oreTitanium, Blocks.oreThorium}){
|
||||
OreFilter filter = new OreFilter();
|
||||
filter.threshold += index ++ * 0.019f;
|
||||
filter.scl += index;
|
||||
filter.ore = block;
|
||||
filters.add(filter);
|
||||
}
|
||||
}
|
||||
|
||||
public String writeWaves(Array<SpawnGroup> groups){
|
||||
if(groups == null){
|
||||
return "[]";
|
||||
|
||||
@@ -8,7 +8,7 @@ import static io.anuke.mindustry.maps.filters.FilterOption.BlockOption;
|
||||
import static io.anuke.mindustry.maps.filters.FilterOption.oresOnly;
|
||||
|
||||
public class OreFilter extends GenerateFilter{
|
||||
public float scl = 40, threshold = 0.75f, octaves = 2f, falloff = 0.4f;
|
||||
public float scl = 23, threshold = 0.808f, octaves = 2f, falloff = 0.5f;
|
||||
public Block ore = Blocks.oreCopper;
|
||||
|
||||
{
|
||||
|
||||
@@ -2,15 +2,16 @@ package io.anuke.mindustry.maps.filters;
|
||||
|
||||
import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.mindustry.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.maps.filters.FilterOption.*;
|
||||
import io.anuke.mindustry.world.*;
|
||||
|
||||
import static io.anuke.mindustry.Vars.content;
|
||||
|
||||
public class OreMedianFilter extends GenerateFilter{
|
||||
float radius = 2;
|
||||
float percentile = 0.5f;
|
||||
IntArray blocks = new IntArray();
|
||||
public float radius = 2;
|
||||
public float percentile = 0.5f;
|
||||
|
||||
private IntArray blocks = new IntArray();
|
||||
|
||||
{
|
||||
buffered = true;
|
||||
@@ -22,13 +23,26 @@ public class OreMedianFilter extends GenerateFilter{
|
||||
|
||||
@Override
|
||||
public void apply(){
|
||||
if(in.ore == Blocks.spawn) return;
|
||||
|
||||
int cx = (in.x / 2) * 2;
|
||||
int cy = (in.y / 2) * 2;
|
||||
if(in.ore != Blocks.air){
|
||||
if(!(in.tile(cx + 1, cy).overlay() == in.ore && in.tile(cx, cy).overlay() == in.ore && in.tile(cx + 1, cy + 1).overlay() == in.ore && in.tile(cx, cy + 1).overlay() == in.ore &&
|
||||
!in.tile(cx + 1, cy).block().isStatic() && !in.tile(cx, cy).block().isStatic() && !in.tile(cx + 1, cy + 1).block().isStatic() && !in.tile(cx, cy + 1).block().isStatic())){
|
||||
in.ore = Blocks.air;
|
||||
}
|
||||
}
|
||||
|
||||
int rad = (int)radius;
|
||||
|
||||
blocks.clear();
|
||||
for(int x = -rad; x <= rad; x++){
|
||||
for(int y = -rad; y <= rad; y++){
|
||||
if(Mathf.dst2(x, y) > rad*rad) continue;
|
||||
|
||||
Tile tile = in.tile(in.x + x, in.y + y);
|
||||
if(tile.overlay() != Blocks.spawn)
|
||||
blocks.add(tile.overlay().id);
|
||||
}
|
||||
}
|
||||
@@ -36,8 +50,8 @@ public class OreMedianFilter extends GenerateFilter{
|
||||
blocks.sort();
|
||||
|
||||
int index = Math.min((int)(blocks.size * percentile), blocks.size - 1);
|
||||
int overlay = blocks.get(index), block = blocks.get(index);
|
||||
int overlay = blocks.get(index);
|
||||
|
||||
in.ore = content.block(overlay);
|
||||
in.ore = Vars.content.block(overlay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import io.anuke.arc.collection.*;
|
||||
import io.anuke.arc.math.*;
|
||||
import io.anuke.arc.math.geom.*;
|
||||
import io.anuke.arc.util.*;
|
||||
import io.anuke.arc.util.noise.*;
|
||||
import io.anuke.mindustry.content.*;
|
||||
import io.anuke.mindustry.io.*;
|
||||
import io.anuke.mindustry.maps.*;
|
||||
@@ -19,8 +18,6 @@ public class MapGenerator extends Generator{
|
||||
private Map map;
|
||||
private String mapName;
|
||||
private Array<Decoration> decorations = Array.with(new Decoration(Blocks.stone, Blocks.rock, 0.003f));
|
||||
/** 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.
|
||||
@@ -43,17 +40,6 @@ public class MapGenerator extends Generator{
|
||||
return this;
|
||||
}
|
||||
|
||||
public MapGenerator dist(float distortion){
|
||||
this.distortion = distortion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public MapGenerator dist(float distortion, boolean floor){
|
||||
this.distortion = distortion;
|
||||
this.distortFloor = floor;
|
||||
return this;
|
||||
}
|
||||
|
||||
{
|
||||
decor(new Decoration(Blocks.snow, Blocks.snowrock, 0.01), new Decoration(Blocks.ignarock, Blocks.pebbles, 0.03f));
|
||||
}
|
||||
@@ -100,28 +86,9 @@ public class MapGenerator extends Generator{
|
||||
}
|
||||
}
|
||||
|
||||
Simplex simplex = new Simplex(Mathf.random(99999));
|
||||
|
||||
for(int x = 0; x < width; x++){
|
||||
for(int y = 0; y < height; y++){
|
||||
final double scl = 10;
|
||||
Tile tile = tiles[x][y];
|
||||
int newX = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x, y) * distortion + x), 0, width - 1);
|
||||
int newY = Mathf.clamp((int)(simplex.octaveNoise2D(1, 1, 1.0 / scl, x + 9999, y + 9999) * distortion + y), 0, height - 1);
|
||||
|
||||
if(((tile.block() instanceof StaticWall
|
||||
&& tiles[newX][newY].block() instanceof StaticWall)
|
||||
|| (tile.block() == Blocks.air && !tiles[newX][newY].block().synthetic())
|
||||
|| (tiles[newX][newY].block() == Blocks.air && tile.block() instanceof StaticWall))){
|
||||
tile.setBlock(tiles[newX][newY].block());
|
||||
}
|
||||
|
||||
if(distortFloor){
|
||||
tile.setFloor(tiles[newX][newY].floor());
|
||||
if(tiles[newX][newY].overlay() != Blocks.spawn && tile.overlay() != Blocks.spawn){
|
||||
tile.setOverlay(tiles[newX][newY].overlay());
|
||||
}
|
||||
}
|
||||
|
||||
for(Decoration decor : decorations){
|
||||
if(x > 0 && y > 0 && (tiles[x - 1][y].block() == decor.wall || tiles[x][y - 1].block() == decor.wall)){
|
||||
|
||||
Reference in New Issue
Block a user