Internal changes for surface-less floors

This commit is contained in:
Anuken
2020-10-08 14:44:02 -04:00
parent 6aa1144429
commit f14d631ff9
11 changed files with 21 additions and 13 deletions

View File

@@ -3,7 +3,6 @@ package mindustry.maps.filters;
import arc.util.*;
import mindustry.maps.filters.FilterOption.*;
import mindustry.world.*;
import mindustry.world.blocks.environment.*;
public class DistortFilter extends GenerateFilter{
float scl = 40, mag = 5;
@@ -27,6 +26,6 @@ public class DistortFilter extends GenerateFilter{
in.floor = tile.floor();
if(!tile.block().synthetic() && !in.block.synthetic()) in.block = tile.block();
if(!((Floor)in.floor).isLiquid) in.ore = tile.overlay();
in.ore = tile.overlay();
}
}

View File

@@ -20,7 +20,7 @@ public abstract class GenerateFilter{
apply();
tile.setFloor(in.floor.asFloor());
tile.setOverlay(in.floor.asFloor().isLiquid ? Blocks.air : in.ore);
tile.setOverlay(!in.floor.asFloor().hasSurface() ? Blocks.air : in.ore);
if(!tile.block().synthetic() && !in.block.synthetic()){
tile.setBlock(in.block);

View File

@@ -188,12 +188,12 @@ public class BaseGenerator{
tile.block.iterateTaken(tile.x + cx, tile.y + cy, (ex, ey) -> {
if(!tiles.getn(ex, ey).floor().isLiquid){
if(tiles.getn(ex, ey).floor().hasSurface()){
set(tiles.getn(ex, ey), item);
}
Tile rand = tiles.getc(ex + Mathf.range(1), ey + Mathf.range(1));
if(!rand.floor().isLiquid){
if(rand.floor().hasSurface()){
//random ores nearby to make it look more natural
set(rand, item);
}

View File

@@ -69,7 +69,7 @@ public abstract class BasicGenerator implements WorldGenerator{
public void ores(Seq<Block> ores){
pass((x, y) -> {
if(floor.asFloor().isLiquid) return;
if(!floor.asFloor().hasSurface()) return;
int offsetX = x - 4, offsetY = y + 23;
for(int i = ores.size - 1; i >= 0; i--){
@@ -124,7 +124,7 @@ public abstract class BasicGenerator implements WorldGenerator{
Block[] blocks = {Blocks.darkPanel3};
int secSize = 20;
pass((x, y) -> {
if(floor.asFloor().isLiquid) return;
if(!floor.asFloor().hasSurface()) return;
int mx = x % secSize, my = y % secSize;
int sclx = x / secSize, scly = y / secSize;

View File

@@ -236,7 +236,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
}
pass((x, y) -> {
if(floor.asFloor().isLiquid) return;
if(!floor.asFloor().hasSurface()) return;
int offsetX = x - 4, offsetY = y + 23;
for(int i = ores.size - 1; i >= 0; i--){
@@ -292,7 +292,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
}
}
if(rand.chance(0.01) && !floor.asFloor().isLiquid && block == Blocks.air){
if(rand.chance(0.01) && floor.asFloor().hasSurface() && block == Blocks.air){
block = dec.get(floor, floor.asFloor().decoration);
}
}