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

@@ -38,7 +38,7 @@ public class Blocks implements ContentList{
//environment
air, spawn, deepwater, water, taintedWater, tar, stone, craters, charr, sand, darksand, ice, snow, darksandTaintedWater,
holostone, rocks, sporerocks, icerocks, cliffs, sporePine, snowPine, pine, shrubs, whiteTree, whiteTreeDead, sporeCluster,
iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, grass, salt,
iceSnow, sandWater, darksandWater, duneRocks, sandRocks, moss, sporeMoss, shale, shaleRocks, shaleBoulder, sandBoulder, grass, salt,
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor5, ignarock, magmarock, hotrock, snowrocks, rock, snowrock, saltRocks,
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
pebbles, tendrils,
@@ -350,6 +350,10 @@ public class Blocks implements ContentList{
variants = 2;
}};
sandBoulder = new Rock("sand-boulder"){{
variants = 2;
}};
moss = new Floor("moss"){{
variants = 3;
attributes.set(Attribute.spores, 0.15f);

View File

@@ -500,7 +500,7 @@ public class World implements ApplicationListener{
tile.setFloor((Floor)input.floor);
tile.setOverlay(input.ore);
if(!tile.block().synthetic()){
if(!tile.block().synthetic() && !input.block.synthetic()){
tile.setBlock(input.block);
}
}

View File

@@ -220,7 +220,7 @@ public class MapGenerateDialog extends FloatingDialog{
}
void rebuildFilters(){
int cols = Math.max((int)(filterTable.getParent().getWidth() / Unit.dp.scl(290f)), 1);
int cols = Math.max((int)(Math.max(filterTable.getParent().getWidth(), Core.graphics.getWidth()/2f * 0.9f) / Unit.dp.scl(290f)), 1);
filterTable.clearChildren();
filterTable.top().left();
int i = 0;
@@ -238,7 +238,6 @@ public class MapGenerateDialog extends FloatingDialog{
t.table(b -> {
String style = "clear";
b.left();
b.defaults().size(50f);
b.addImageButton("icon-refresh-small", style, iconsizesmall, () -> {
filter.randomize();
@@ -267,7 +266,7 @@ public class MapGenerateDialog extends FloatingDialog{
c.row();
//all the options
c.table(f -> {
f.left();
f.left().top();
for(FilterOption option : filter.options){
option.changed = this::update;
@@ -277,8 +276,8 @@ public class MapGenerateDialog extends FloatingDialog{
}).growX().left();
f.row();
}
}).grow().left().pad(2);
}).width(280f).pad(3).top().left();
}).grow().left().pad(2).top();
}).width(280f).pad(3).top().left().fillY();
if(++i % cols == 0){
filterTable.row();
}

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)