mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-26 06:22:17 -08:00
Slightly better terrain filter
This commit is contained in:
parent
92d573bdcb
commit
84171a8619
1 changed files with 5 additions and 5 deletions
|
|
@ -10,7 +10,7 @@ import static mindustry.maps.filters.FilterOption.*;
|
|||
|
||||
public class TerrainFilter extends GenerateFilter{
|
||||
float scl = 40, threshold = 0.9f, octaves = 3f, falloff = 0.5f, magnitude = 1f, circleScl = 2.1f;
|
||||
Block floor = Blocks.stone, block = Blocks.stoneWall;
|
||||
Block floor = Blocks.air, block = Blocks.stoneWall;
|
||||
|
||||
@Override
|
||||
public FilterOption[] options(){
|
||||
|
|
@ -21,7 +21,7 @@ public class TerrainFilter extends GenerateFilter{
|
|||
new SliderOption("circle-scale", () -> circleScl, f -> circleScl = f, 0f, 3f),
|
||||
new SliderOption("octaves", () -> octaves, f -> octaves = f, 1f, 10f),
|
||||
new SliderOption("falloff", () -> falloff, f -> falloff = f, 0f, 1f),
|
||||
new BlockOption("floor", () -> floor, b -> floor = b, floorsOnly),
|
||||
new BlockOption("floor", () -> floor, b -> floor = b, floorsOptional),
|
||||
new BlockOption("wall", () -> block, b -> block = b, wallsOnly)
|
||||
);
|
||||
}
|
||||
|
|
@ -30,12 +30,12 @@ public class TerrainFilter extends GenerateFilter{
|
|||
public void apply(){
|
||||
float noise = noise(in.x, in.y, scl, magnitude, octaves, falloff) + Mathf.dst((float)in.x / in.width, (float)in.y / in.height, 0.5f, 0.5f) * circleScl;
|
||||
|
||||
in.floor = floor;
|
||||
if(floor != Blocks.air){
|
||||
in.floor = floor;
|
||||
}
|
||||
|
||||
if(noise >= threshold){
|
||||
in.block = block;
|
||||
}else if(!in.block.synthetic()){
|
||||
in.block = Blocks.air;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue