mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-15 18:27:36 +07:00
Experimental core-capture PvP map / Editor filter fixes
This commit is contained in:
@ -492,6 +492,7 @@ filter.option.block = Block
|
|||||||
filter.option.floor = Floor
|
filter.option.floor = Floor
|
||||||
filter.option.flooronto = Target Floor
|
filter.option.flooronto = Target Floor
|
||||||
filter.option.target = Target
|
filter.option.target = Target
|
||||||
|
filter.option.replacement = Replacement
|
||||||
filter.option.wall = Wall
|
filter.option.wall = Wall
|
||||||
filter.option.ore = Ore
|
filter.option.ore = Ore
|
||||||
filter.option.floor2 = Secondary Floor
|
filter.option.floor2 = Secondary Floor
|
||||||
|
BIN
core/assets/maps/passage.msav
Normal file
BIN
core/assets/maps/passage.msav
Normal file
Binary file not shown.
@ -3,10 +3,10 @@ package mindustry.editor;
|
|||||||
import arc.*;
|
import arc.*;
|
||||||
import arc.scene.ui.*;
|
import arc.scene.ui.*;
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
|
||||||
import mindustry.*;
|
import mindustry.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
import mindustry.io.*;
|
import mindustry.io.*;
|
||||||
|
import mindustry.maps.filters.*;
|
||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.ui.dialogs.*;
|
import mindustry.ui.dialogs.*;
|
||||||
|
|
||||||
@ -74,7 +74,11 @@ public class MapInfoDialog extends BaseDialog{
|
|||||||
t.row();
|
t.row();
|
||||||
t.add("@editor.generation").padRight(8).left();
|
t.add("@editor.generation").padRight(8).left();
|
||||||
t.button("@edit", () -> {
|
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 -> {
|
filters -> {
|
||||||
//reset seed to 0 so it is not written
|
//reset seed to 0 so it is not written
|
||||||
filters.each(f -> f.seed = 0);
|
filters.each(f -> f.seed = 0);
|
||||||
|
@ -29,9 +29,9 @@ import static mindustry.Vars.*;
|
|||||||
|
|
||||||
public class Maps{
|
public class Maps{
|
||||||
/** List of all built-in maps. Filenames only. */
|
/** 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 */
|
/** Maps tagged as PvP */
|
||||||
static final String[] pvpMaps = {"veins", "glacier"};
|
static final String[] pvpMaps = {"veins", "glacier", "passage"};
|
||||||
/** All maps stored in an ordered array. */
|
/** All maps stored in an ordered array. */
|
||||||
private Seq<Map> maps = new Seq<>();
|
private Seq<Map> maps = new Seq<>();
|
||||||
/** Serializer for meta. */
|
/** Serializer for meta. */
|
||||||
|
@ -7,12 +7,14 @@ import mindustry.world.*;
|
|||||||
import static mindustry.maps.filters.FilterOption.*;
|
import static mindustry.maps.filters.FilterOption.*;
|
||||||
|
|
||||||
public class ClearFilter extends GenerateFilter{
|
public class ClearFilter extends GenerateFilter{
|
||||||
protected Block block = Blocks.air;
|
protected Block target = Blocks.stone;
|
||||||
|
protected Block replace = Blocks.air;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FilterOption[] options(){
|
public FilterOption[] options(){
|
||||||
return new BlockOption[]{
|
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
|
@Override
|
||||||
public void apply(GenerateInput in){
|
public void apply(GenerateInput in){
|
||||||
|
|
||||||
if(in.block == block){
|
if(in.block == target || in.floor == target || (target.isOverlay() && in.overlay == target)){
|
||||||
in.block = Blocks.air;
|
//special case: when air is the result, replace only the overlay or wall
|
||||||
}
|
if(replace == Blocks.air){
|
||||||
|
if(in.overlay == target){
|
||||||
if(in.overlay == block){
|
in.overlay = Blocks.air;
|
||||||
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,4 +10,4 @@ kapt.include.compile.classpath=false
|
|||||||
kotlin.stdlib.default.dependency=false
|
kotlin.stdlib.default.dependency=false
|
||||||
#needed for android compilation
|
#needed for android compilation
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
archash=07ced971f4c8b8b5a61aa3a84b29c90aa497cb48
|
archash=37fbff84ebd824be79586e1e13d05506446938b3
|
||||||
|
Reference in New Issue
Block a user