New map / Better filters / Sand boulders

This commit is contained in:
Anuken
2019-07-26 18:59:33 -04:00
parent 2bdfaef2d9
commit c4157d2ec8
16 changed files with 1110 additions and 1051 deletions

View File

@@ -203,6 +203,10 @@ public class Maps implements Disposable{
new ScatterFilter(){{
flooronto = Blocks.ice;
block = Blocks.snowrock;
}},
new ScatterFilter(){{
flooronto = Blocks.sand;
block = Blocks.sandBoulder;
}}
);

View File

@@ -2,28 +2,29 @@ package io.anuke.mindustry.maps.filters;
import io.anuke.arc.math.Mathf;
import io.anuke.mindustry.content.Blocks;
import io.anuke.mindustry.editor.MapGenerateDialog.*;
import io.anuke.mindustry.maps.filters.FilterOption.BlockOption;
import io.anuke.mindustry.maps.filters.FilterOption.SliderOption;
import io.anuke.mindustry.world.Block;
import static io.anuke.mindustry.maps.filters.FilterOption.floorsOnly;
import static io.anuke.mindustry.maps.filters.FilterOption.*;
public class BlendFilter extends GenerateFilter{
float radius = 2f;
Block flooronto = Blocks.stone, floor = Blocks.ice;
Block block = Blocks.stone, floor = Blocks.ice;
{
buffered = true;
options(
new SliderOption("radius", () -> radius, f -> radius = f, 1f, 10f),
new BlockOption("flooronto", () -> flooronto, b -> flooronto = b, floorsOnly),
new BlockOption("block", () -> block, b -> block = b, anyOptional),
new BlockOption("floor", () -> floor, b -> floor = b, floorsOnly)
);
}
@Override
public void apply(){
if(in.floor == flooronto) return;
if(in.floor == block || block == Blocks.air) return;
int rad = (int)radius;
boolean found = false;
@@ -32,8 +33,9 @@ public class BlendFilter extends GenerateFilter{
for(int x = -rad; x <= rad; x++){
for(int y = -rad; y <= rad; y++){
if(Mathf.dst2(x, y) > rad*rad) continue;
GenTile tile = in.tile(in.x + x, in.y + y);
if(in.tile(in.x + x, in.y + y).floor == flooronto.id){
if(tile.floor == block.id || tile.block == block.id || tile.ore == block.id){
found = true;
break outer;
}

View File

@@ -22,6 +22,7 @@ public abstract class FilterOption{
public static final Predicate<Block> wallsOptional = b -> b == Blocks.air || ((!b.synthetic() && !(b instanceof Floor)) && Core.atlas.isFound(b.icon(Icon.full)));
public static final Predicate<Block> wallsOresOptional = b -> b == Blocks.air || (((!b.synthetic() && !(b instanceof Floor)) || (b instanceof OverlayFloor)) && Core.atlas.isFound(b.icon(Icon.full)));
public static final Predicate<Block> oresOnly = b -> b instanceof OverlayFloor && Core.atlas.isFound(b.icon(Icon.full));
public static final Predicate<Block> anyOptional = b -> floorsOnly.test(b) || wallsOnly.test(b) || oresOnly.test(b) || b == Blocks.air;
public abstract void build(Table table);

View File

@@ -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 = 43, threshold = 0.705f, octaves = 3f, falloff = 0.4f;
public float scl = 40, threshold = 0.75f, octaves = 2f, falloff = 0.4f;
public Block ore = Blocks.oreCopper;
{

View File

@@ -15,8 +15,8 @@ public class RiverNoiseFilter extends GenerateFilter{
{
options(
new SliderOption("scale", () -> scl, f -> scl = f, 1f, 500f),
new SliderOption("threshold", () -> threshold, f -> threshold = f, 0f, 1f),
new SliderOption("threshold2", () -> threshold2, f -> threshold2 = f, 0f, 1f),
new SliderOption("threshold", () -> threshold, f -> threshold = f, -1f, 0.3f),
new SliderOption("threshold2", () -> threshold2, f -> threshold2 = f, -1f, 0.3f),
new BlockOption("block", () -> block, b -> block = b, wallsOnly),
new BlockOption("floor", () -> floor, b -> floor = b, floorsOnly),
new BlockOption("floor2", () -> floor2, b -> floor2 = b, floorsOnly)