Generation quick copy & paste (#7520)
* several UI changes * block ID bad
This commit is contained in:
@@ -9,12 +9,14 @@ import static mindustry.maps.filters.FilterOption.*;
|
||||
public class ClearFilter extends GenerateFilter{
|
||||
public Block target = Blocks.stone;
|
||||
public Block replace = Blocks.air;
|
||||
public Block ignore = Blocks.air;
|
||||
|
||||
@Override
|
||||
public FilterOption[] options(){
|
||||
return new FilterOption[]{
|
||||
new BlockOption("target", () -> target, b -> target = b, anyOptional),
|
||||
new BlockOption("replacement", () -> replace, b -> replace = b, anyOptional)
|
||||
new BlockOption("replacement", () -> replace, b -> replace = b, anyOptional),
|
||||
new BlockOption("ignore", () -> ignore, b -> ignore = b, anyOptional)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -25,6 +27,7 @@ public class ClearFilter extends GenerateFilter{
|
||||
|
||||
@Override
|
||||
public void apply(GenerateInput in){
|
||||
if(ignore != Blocks.air && (in.block == ignore || in.floor == ignore || in.overlay == ignore)) return;
|
||||
|
||||
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
|
||||
|
||||
@@ -3,6 +3,7 @@ package mindustry.maps.filters;
|
||||
|
||||
import arc.*;
|
||||
import arc.func.*;
|
||||
import arc.input.*;
|
||||
import arc.scene.*;
|
||||
import arc.scene.event.*;
|
||||
import arc.scene.style.*;
|
||||
@@ -103,7 +104,7 @@ public abstract class FilterOption{
|
||||
|
||||
@Override
|
||||
public void build(Table table){
|
||||
table.button(b -> b.image(supplier.get().uiIcon).update(i -> ((TextureRegionDrawable)i.getDrawable())
|
||||
Button button = table.button(b -> b.image(supplier.get().uiIcon).update(i -> ((TextureRegionDrawable)i.getDrawable())
|
||||
.setRegion(supplier.get() == Blocks.air ? Icon.none.getRegion() : supplier.get().uiIcon)).size(iconSmall), () -> {
|
||||
BaseDialog dialog = new BaseDialog("@filter.option." + name);
|
||||
dialog.cont.pane(t -> {
|
||||
@@ -124,7 +125,19 @@ public abstract class FilterOption{
|
||||
|
||||
dialog.addCloseButton();
|
||||
dialog.show();
|
||||
}).pad(4).margin(12f);
|
||||
}).pad(4).margin(12f).get();
|
||||
|
||||
button.clicked(KeyCode.mouseMiddle, () -> {
|
||||
Core.app.setClipboardText(supplier.get().name);
|
||||
ui.showInfoFade("@copied");
|
||||
});
|
||||
|
||||
button.clicked(KeyCode.mouseRight, () -> {
|
||||
if(content.block(Core.app.getClipboardText()) != null && filter.get(content.block(Core.app.getClipboardText()))){
|
||||
consumer.get(content.block(Core.app.getClipboardText()));
|
||||
changed.run();
|
||||
}
|
||||
});
|
||||
|
||||
table.add("@filter.option." + name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user