River noise target field

This commit is contained in:
Anuken 2021-09-10 09:22:39 -04:00
parent b2a634e5e7
commit 10c3f9e44a
3 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,6 @@
63743=spawn|block-spawn-ui
63742=deepwater|block-deepwater-ui
63741=water|block-shallow-water-ui
63741=shallow-water|block-shallow-water-ui
63740=tainted-water|block-tainted-water-ui
63739=darksand-tainted-water|block-darksand-tainted-water-ui
63738=sand-water|block-sand-water-ui
@ -357,7 +357,6 @@
63357=crux|team-crux
63358=derelict|team-derelict
63350=deep-water|block-deep-water-ui
63349=shallow-water|block-shallow-water-ui
63348=molten-slag|block-molten-slag-ui
63347=crater-stone|block-crater-stone-ui
63346=deep-tainted-water|block-deep-tainted-water-ui

Binary file not shown.

View file

@ -8,7 +8,7 @@ import static mindustry.maps.filters.FilterOption.*;
public class RiverNoiseFilter extends GenerateFilter{
float scl = 40, threshold = 0f, threshold2 = 0.1f, octaves = 1, falloff = 0.5f;
Block floor = Blocks.water, floor2 = Blocks.deepwater, block = Blocks.sandWall;
Block floor = Blocks.water, floor2 = Blocks.deepwater, block = Blocks.sandWall, target = Blocks.air;
@Override
public FilterOption[] options(){
@ -18,6 +18,7 @@ public class RiverNoiseFilter extends GenerateFilter{
new SliderOption("threshold2", () -> threshold2, f -> threshold2 = f, -1f, 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("block", () -> block, b -> block = b, wallsOnly),
new BlockOption("floor", () -> floor, b -> floor = b, floorsOnly),
new BlockOption("floor2", () -> floor2, b -> floor2 = b, floorsOnly)
@ -26,14 +27,14 @@ public class RiverNoiseFilter extends GenerateFilter{
@Override
public char icon(){
return Iconc.blockWater;
return Iconc.blockShallowWater;
}
@Override
public void apply(GenerateInput in){
float noise = rnoise(in.x, in.y, (int)octaves, scl, falloff, 1f);
if(noise >= threshold){
if(noise >= threshold && (target == Blocks.air || in.floor == target || in.block == target)){
in.floor = floor;
if(in.block.solid){