mirror of
https://github.com/Anuken/Mindustry.git
synced 2026-01-27 15:02:03 -08:00
Internal changes for surface-less floors
This commit is contained in:
parent
6aa1144429
commit
f14d631ff9
11 changed files with 21 additions and 13 deletions
|
|
@ -26,7 +26,7 @@ public class EditorTile extends Tile{
|
|||
|
||||
if(type instanceof OverlayFloor){
|
||||
//don't place on liquids
|
||||
if(!floor.isLiquid){
|
||||
if(floor.hasSurface()){
|
||||
setOverlayID(type.id);
|
||||
}
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public enum EditorTool{
|
|||
if(editor.drawBlock.isOverlay()){
|
||||
Block dest = tile.overlay();
|
||||
if(dest == editor.drawBlock) return;
|
||||
tester = t -> t.overlay() == dest && !t.floor().isLiquid;
|
||||
tester = t -> t.overlay() == dest && t.floor().hasSurface();
|
||||
setter = t -> t.setOverlay(editor.drawBlock);
|
||||
}else if(editor.drawBlock.isFloor()){
|
||||
Block dest = tile.floor();
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ public class MapGenerateDialog extends BaseDialog{
|
|||
public void set(Block floor, Block wall, Block ore, Team team){
|
||||
this.floor = floor.id;
|
||||
this.block = wall.id;
|
||||
this.ore = floor.asFloor().isLiquid ? 0 : ore.id;
|
||||
this.ore = !floor.asFloor().hasSurface() ? 0 : ore.id;
|
||||
this.team = (byte)team.id;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ public class Puddles{
|
|||
return;
|
||||
}
|
||||
|
||||
if(tile.floor().solid){
|
||||
return;
|
||||
}
|
||||
|
||||
Puddle p = map.get(tile.pos());
|
||||
if(p == null){
|
||||
Puddle puddle = Puddle.create();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ public class ConstructBlock extends Block{
|
|||
public void onDestroyed(){
|
||||
Fx.blockExplosionSmoke.at(tile);
|
||||
|
||||
if(!tile.floor().solid && !tile.floor().isLiquid){
|
||||
if(!tile.floor().solid && tile.floor().hasSurface()){
|
||||
Effect.rubble(x, y, size);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,6 +166,11 @@ public class Floor extends Block{
|
|||
return new TextureRegion[]{Core.atlas.find(Core.atlas.has(name) ? name : name + "1")};
|
||||
}
|
||||
|
||||
/** @return whether this floor has a valid surface on which to place things, e.g. scorch marks. */
|
||||
public boolean hasSurface(){
|
||||
return !isLiquid && !solid;
|
||||
}
|
||||
|
||||
public boolean isDeep(){
|
||||
return drownTime > 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue