diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 8aff18d4b9..3e2304b765 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -492,6 +492,7 @@ filter.option.block = Block filter.option.floor = Floor filter.option.flooronto = Target Floor filter.option.target = Target +filter.option.replacement = Replacement filter.option.wall = Wall filter.option.ore = Ore filter.option.floor2 = Secondary Floor diff --git a/core/assets/maps/passage.msav b/core/assets/maps/passage.msav new file mode 100644 index 0000000000..9e9d8d1138 Binary files /dev/null and b/core/assets/maps/passage.msav differ diff --git a/core/src/mindustry/editor/MapInfoDialog.java b/core/src/mindustry/editor/MapInfoDialog.java index da4bf5a4b3..63b9a053da 100644 --- a/core/src/mindustry/editor/MapInfoDialog.java +++ b/core/src/mindustry/editor/MapInfoDialog.java @@ -3,10 +3,10 @@ package mindustry.editor; import arc.*; import arc.scene.ui.*; import arc.struct.*; -import arc.util.*; import mindustry.*; import mindustry.game.*; import mindustry.io.*; +import mindustry.maps.filters.*; import mindustry.ui.*; import mindustry.ui.dialogs.*; @@ -74,7 +74,11 @@ public class MapInfoDialog extends BaseDialog{ t.row(); t.add("@editor.generation").padRight(8).left(); t.button("@edit", () -> { - generate.show(maps.readFilters(editor.tags.get("genfilters", "")), + //randomize so they're not all the same seed + var res = maps.readFilters(editor.tags.get("genfilters", "")); + res.each(GenerateFilter::randomize); + + generate.show(res, filters -> { //reset seed to 0 so it is not written filters.each(f -> f.seed = 0); diff --git a/core/src/mindustry/maps/Maps.java b/core/src/mindustry/maps/Maps.java index d7ea3b392d..72fcc09aa1 100644 --- a/core/src/mindustry/maps/Maps.java +++ b/core/src/mindustry/maps/Maps.java @@ -29,9 +29,9 @@ 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", "archipelago", "debrisField", "veins", "glacier"}; + private static String[] defaultMapNames = {"maze", "fortress", "labyrinth", "islands", "tendrils", "caldera", "wasteland", "shattered", "fork", "triad", "mudFlats", "moltenLake", "archipelago", "debrisField", "veins", "glacier", "passage"}; /** Maps tagged as PvP */ - static final String[] pvpMaps = {"veins", "glacier"}; + static final String[] pvpMaps = {"veins", "glacier", "passage"}; /** All maps stored in an ordered array. */ private Seq maps = new Seq<>(); /** Serializer for meta. */ diff --git a/core/src/mindustry/maps/filters/ClearFilter.java b/core/src/mindustry/maps/filters/ClearFilter.java index 3b2684ef7e..59e4512a82 100644 --- a/core/src/mindustry/maps/filters/ClearFilter.java +++ b/core/src/mindustry/maps/filters/ClearFilter.java @@ -7,12 +7,14 @@ import mindustry.world.*; import static mindustry.maps.filters.FilterOption.*; public class ClearFilter extends GenerateFilter{ - protected Block block = Blocks.air; + protected Block target = Blocks.stone; + protected Block replace = Blocks.air; @Override public FilterOption[] options(){ return new BlockOption[]{ - new BlockOption("block", () -> block, b -> block = b, b -> oresOnly.get(b) || wallsOnly.get(b)) + new BlockOption("target", () -> target, b -> target = b, anyOptional), + new BlockOption("replacement", () -> replace, b -> replace = b, anyOptional) }; } @@ -24,12 +26,21 @@ public class ClearFilter extends GenerateFilter{ @Override public void apply(GenerateInput in){ - if(in.block == block){ - in.block = Blocks.air; - } - - if(in.overlay == block){ - in.overlay = Blocks.air; + if(in.block == target || in.floor == target || (target.isOverlay() && in.overlay == target)){ + //special case: when air is the result, replace only the overlay or wall + if(replace == Blocks.air){ + if(in.overlay == target){ + in.overlay = Blocks.air; + }else{ + in.block = Blocks.air; + } + }else if(replace.isOverlay()){ //replace the best match based on type + in.overlay = replace; + }else if(replace.isFloor()){ + in.floor = replace; + }else{ + in.block = replace; + } } } } diff --git a/gradle.properties b/gradle.properties index 15947e3eac..a70ad43723 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,4 +10,4 @@ kapt.include.compile.classpath=false kotlin.stdlib.default.dependency=false #needed for android compilation android.useAndroidX=true -archash=07ced971f4c8b8b5a61aa3a84b29c90aa497cb48 +archash=37fbff84ebd824be79586e1e13d05506446938b3