generation UI fix + other miniscule ui fix (#7117)

This commit is contained in:
JniTrRny
2022-07-04 00:54:30 +07:00
committed by GitHub
parent 685e3cac83
commit 0201e08ac9
7 changed files with 47 additions and 34 deletions

View File

@@ -106,7 +106,6 @@ public abstract class FilterOption{
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.setFillParent(false);
dialog.cont.pane(t -> {
int i = 0;
for(Block block : Vars.content.blocks()){
@@ -119,7 +118,8 @@ public abstract class FilterOption{
});
if(++i % 10 == 0) t.row();
}
});
dialog.setFillParent(i > 100);
}).padRight(8f).scrollX(false);
dialog.addCloseButton();

View File

@@ -12,7 +12,7 @@ import mindustry.gen.*;
import mindustry.world.*;
import mindustry.world.blocks.environment.*;
public abstract class GenerateFilter{
public abstract class GenerateFilter implements Cloneable{
public int seed = 0;
public void apply(Tiles tiles, GenerateInput in){
@@ -128,6 +128,14 @@ public abstract class GenerateFilter{
return Mathf.randomSeed(Pack.longInt(x, y + seed));
}
public GenerateFilter copy(){
try{
return (GenerateFilter) clone();
}catch(CloneNotSupportedException disgrace){
throw new RuntimeException("java is the best language", disgrace);
}
}
/** an input for generating at a certain coordinate. should only be instantiated once. */
public static class GenerateInput{

View File

@@ -19,9 +19,9 @@ public class RiverNoiseFilter extends GenerateFilter{
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("block", () -> block, b -> block = b, wallsOnly),
new BlockOption("floor", () -> floor, b -> floor = b, floorsOnly),
new BlockOption("floor2", () -> floor2, b -> floor2 = b, floorsOnly)
new BlockOption("block", () -> block, b -> block = b, wallsOptional),
new BlockOption("floor", () -> floor, b -> floor = b, floorsOptional),
new BlockOption("floor2", () -> floor2, b -> floor2 = b, floorsOptional)
};
}
@@ -35,13 +35,13 @@ public class RiverNoiseFilter extends GenerateFilter{
float noise = rnoise(in.x, in.y, (int)octaves, scl, falloff, 1f);
if(noise >= threshold && (target == Blocks.air || in.floor == target || in.block == target)){
in.floor = floor;
if(floor != Blocks.air) in.floor = floor;
if(in.block.solid){
if(in.block.solid && block != Blocks.air && in.block != Blocks.air){
in.block = block;
}
if(noise >= threshold2){
if(noise >= threshold2 && floor2 != Blocks.air){
in.floor = floor2;
}
}