Map editor tweaks & fixes / New map

This commit is contained in:
Anuken
2020-10-22 15:27:30 -04:00
parent c2ff5a69ef
commit a2e75df096
22 changed files with 108 additions and 76 deletions

View File

@@ -29,7 +29,7 @@ import static mindustry.Vars.*;
public class Maps{
/** List of all built-in maps. Filenames only. */
private static String[] defaultMapNames = {"maze", "fortress", "labyrinth", "islands", "tendrils", "caldera", "wasteland", "shattered", "fork", "triad", "mudFlats", "moltenLake", "veins", "glacier"};
private static String[] defaultMapNames = {"maze", "fortress", "labyrinth", "islands", "tendrils", "caldera", "wasteland", "shattered", "fork", "triad", "mudFlats", "moltenLake", "archipelago", "veins", "glacier"};
/** Maps tagged as PvP */
static final String[] pvpMaps = {"veins", "glacier"};
/** All maps stored in an ordered array. */

View File

@@ -11,7 +11,7 @@ public class ClearFilter extends GenerateFilter{
@Override
public FilterOption[] options(){
return Structs.arr(new BlockOption("block", () -> block, b -> block = b, wallsOnly));
return Structs.arr(new BlockOption("block", () -> block, b -> block = b, b -> oresOnly.get(b) || wallsOnly.get(b)));
}
@Override
@@ -20,5 +20,9 @@ public class ClearFilter extends GenerateFilter{
if(in.block == block){
in.block = Blocks.air;
}
if(in.overlay == block){
in.overlay = Blocks.air;
}
}
}

View File

@@ -20,9 +20,10 @@ public abstract class FilterOption{
public static final Boolf<Block> floorsOnly = b -> (b instanceof Floor && !(b instanceof OverlayFloor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full));
public static final Boolf<Block> wallsOnly = b -> (!b.synthetic() && !(b instanceof Floor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full)) && b.inEditor;
public static final Boolf<Block> floorsOptional = b -> b == Blocks.air || ((b instanceof Floor && !(b instanceof OverlayFloor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full)));
public static final Boolf<Block> wallsOptional = b -> b == Blocks.air || ((!b.synthetic() && !(b instanceof Floor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full)));
public static final Boolf<Block> wallsOptional = b -> (b == Blocks.air || ((!b.synthetic() && !(b instanceof Floor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full)))) && b.inEditor;
public static final Boolf<Block> wallsOresOptional = b -> b == Blocks.air || (((!b.synthetic() && !(b instanceof Floor)) || (b instanceof OverlayFloor)) && !headless && Core.atlas.isFound(b.icon(Cicon.full))) && b.inEditor;
public static final Boolf<Block> oresOnly = b -> b instanceof OverlayFloor && !headless && Core.atlas.isFound(b.icon(mindustry.ui.Cicon.full));
public static final Boolf<Block> oresOnly = b -> b instanceof OverlayFloor && !headless && Core.atlas.isFound(b.icon(Cicon.full));
public static final Boolf<Block> oresFloorsOptional = b -> (b instanceof Floor) && !headless && Core.atlas.isFound(b.icon(Cicon.full));
public static final Boolf<Block> anyOptional = b -> (floorsOnly.get(b) || wallsOnly.get(b) || oresOnly.get(b) || b == Blocks.air) && b.inEditor;
public abstract void build(Table table);

View File

@@ -9,7 +9,7 @@ import static mindustry.maps.filters.FilterOption.*;
public class NoiseFilter extends GenerateFilter{
float scl = 40, threshold = 0.5f, octaves = 3f, falloff = 0.5f;
Block floor = Blocks.stone, block = Blocks.stoneWall;
Block floor = Blocks.stone, block = Blocks.stoneWall, target = Blocks.air;
@Override
public FilterOption[] options(){
@@ -18,6 +18,7 @@ public class NoiseFilter extends GenerateFilter{
new SliderOption("threshold", () -> threshold, f -> threshold = f, 0f, 1f),
new SliderOption("octaves", () -> octaves, f -> octaves = f, 1f, 10f),
new SliderOption("falloff", () -> falloff, f -> falloff = f, 0f, 1f),
new BlockOption("target", () -> target, b -> target = b, anyOptional),
new BlockOption("floor", () -> floor, b -> floor = b, floorsOnly),
new BlockOption("wall", () -> block, b -> block = b, wallsOptional)
);
@@ -27,9 +28,9 @@ public class NoiseFilter extends GenerateFilter{
public void apply(){
float noise = noise(in.x, in.y, scl, 1f, octaves, falloff);
if(noise > threshold){
if(noise > threshold && (target == Blocks.air || in.floor == target || in.block == target)){
in.floor = floor;
if(in.block != Blocks.air) in.block = block;
if(block != Blocks.air) in.block = block;
}
}
}

View File

@@ -9,7 +9,7 @@ import static mindustry.maps.filters.FilterOption.*;
public class OreFilter extends GenerateFilter{
public float scl = 23, threshold = 0.81f, octaves = 2f, falloff = 0.3f;
public Block ore = Blocks.oreCopper;
public Block ore = Blocks.oreCopper, target = Blocks.air;
@Override
public FilterOption[] options(){
@@ -18,7 +18,8 @@ public class OreFilter extends GenerateFilter{
new SliderOption("threshold", () -> threshold, f -> threshold = f, 0f, 1f),
new SliderOption("octaves", () -> octaves, f -> octaves = f, 1f, 10f),
new SliderOption("falloff", () -> falloff, f -> falloff = f, 0f, 1f),
new BlockOption("ore", () -> ore, b -> ore = b, oresOnly)
new BlockOption("ore", () -> ore, b -> ore = b, oresOnly),
new BlockOption("target", () -> target, b -> target = b, oresFloorsOptional)
);
}
@@ -26,7 +27,7 @@ public class OreFilter extends GenerateFilter{
public void apply(){
float noise = noise(in.x, in.y, scl, 1f, octaves, falloff);
if(noise > threshold && in.overlay != Blocks.spawn){
if(noise > threshold && in.overlay != Blocks.spawn && (target == Blocks.air || in.floor == target || in.overlay == target)){
in.overlay = ore;
}
}

View File

@@ -39,7 +39,7 @@ public class SpawnPathFilter extends GenerateFilter{
if(core != null && spawns.any()){
for(var spawn : spawns){
var path = Astar.pathfind(core.x, core.y, spawn.x, spawn.y, t -> t.solid() ? 20 : 1, Astar.manhattan, tile -> !tile.floor().isDeep());
var path = Astar.pathfind(core.x, core.y, spawn.x, spawn.y, t -> t.solid() ? 100 : 1, Astar.manhattan, tile -> !tile.floor().isDeep());
for(var tile : path){
for(int x = -radius; x <= radius; x++){
for(int y = -radius; y <= radius; y++){