diff --git a/core/src/io/anuke/mindustry/ai/Pathfinder.java b/core/src/io/anuke/mindustry/ai/Pathfinder.java index 4bd910b3b3..855980a864 100644 --- a/core/src/io/anuke/mindustry/ai/Pathfinder.java +++ b/core/src/io/anuke/mindustry/ai/Pathfinder.java @@ -89,7 +89,7 @@ public class Pathfinder{ } private boolean passable(Tile tile, Team team){ - return (tile.block() == Blocks.air && !tile.floor().isLiquid && tile.cliffs == 0 && !tile.floor().solid && !(tile.floor().isLiquid && (tile.floor().damageTaken > 0 || tile.floor().drownTime > 0))) + return (tile.block() == Blocks.air && !tile.floor().isLiquid && !tile.hasCliffs() && !tile.floor().solid && !(tile.floor().isLiquid && (tile.floor().damageTaken > 0 || tile.floor().drownTime > 0))) || (tile.breakable() && (tile.getTeam() != team)) || !tile.solid(); } diff --git a/core/src/io/anuke/mindustry/entities/effect/Puddle.java b/core/src/io/anuke/mindustry/entities/effect/Puddle.java index 5ce8ec31f0..214e003777 100644 --- a/core/src/io/anuke/mindustry/entities/effect/Puddle.java +++ b/core/src/io/anuke/mindustry/entities/effect/Puddle.java @@ -179,7 +179,7 @@ public class Puddle extends BaseEntity implements SaveTrait, Poolable, DrawTrait float deposited = Math.min((amount - maxLiquid / 1.5f) / 4f, 0.3f) * Timers.delta(); for(GridPoint2 point : Geometry.d4){ Tile other = world.tile(tile.x + point.x, tile.y + point.y); - if(other.block() == Blocks.air && other.cliffs == 0){ + if(other.block() == Blocks.air && !other.hasCliffs()){ deposit(other, tile, liquid, deposited, generation + 1); amount -= deposited / 2f; //tweak to speed up/slow down puddle propagation } diff --git a/core/src/io/anuke/mindustry/graphics/FogRenderer.java b/core/src/io/anuke/mindustry/graphics/FogRenderer.java index b6746eecb4..e039b6179e 100644 --- a/core/src/io/anuke/mindustry/graphics/FogRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/FogRenderer.java @@ -25,9 +25,7 @@ import java.nio.ByteBuffer; import static io.anuke.mindustry.Vars.*; -/** - * Used for rendering fog of war. A framebuffer is used for this. - */ +/**Used for rendering fog of war. A framebuffer is used for this.*/ public class FogRenderer implements Disposable{ private static final int extraPadding = 3; private static final int shadowPadding = 1; diff --git a/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java b/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java index 32abff70cf..c68df21f11 100644 --- a/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java +++ b/core/src/io/anuke/mindustry/maps/generation/WorldGenerator.java @@ -127,7 +127,7 @@ public class WorldGenerator{ tile.updateOcclusion(); //fix things on cliffs that shouldn't be - if(tile.block() != Blocks.air && tile.cliffs != 0){ + if(tile.block() != Blocks.air && tile.hasCliffs()){ tile.setBlock(Blocks.air); } } @@ -158,7 +158,7 @@ public class WorldGenerator{ Tile tile = tiles[x][y]; - if(!tile.floor().hasOres || tile.cliffs != 0 || tile.block() != Blocks.air){ + if(!tile.floor().hasOres || tile.hasCliffs() || tile.block() != Blocks.air){ continue; } diff --git a/core/src/io/anuke/mindustry/world/Build.java b/core/src/io/anuke/mindustry/world/Build.java index 34726fec7f..6b0f226cac 100644 --- a/core/src/io/anuke/mindustry/world/Build.java +++ b/core/src/io/anuke/mindustry/world/Build.java @@ -154,7 +154,7 @@ public class Build{ for(int dy = 0; dy < type.size; dy++){ Tile other = world.tile(x + dx + offsetx, y + dy + offsety); if(other == null || (other.block() != Blocks.air && !other.block().alwaysReplace) - || other.cliffs != 0 || !other.floor().placeableOn || + || other.hasCliffs() || !other.floor().placeableOn || (tile.floor().liquidDrop != null && !type.floating)){ return false; } @@ -164,7 +164,7 @@ public class Build{ }else{ return (tile.getTeam() == Team.none || tile.getTeam() == team) && (tile.floor().liquidDrop == null || type.floating) - && tile.floor().placeableOn && tile.cliffs == 0 + && tile.floor().placeableOn && !tile.hasCliffs() && ((type.canReplace(tile.block()) && !(type == tile.block() && rotation == tile.getRotation() && type.rotate)) || tile.block().alwaysReplace || tile.block() == Blocks.air) && tile.block().isMultiblock() == type.isMultiblock() && type.canPlaceOn(tile); diff --git a/core/src/io/anuke/mindustry/world/Tile.java b/core/src/io/anuke/mindustry/world/Tile.java index a8ba24f7df..062b68e4b9 100644 --- a/core/src/io/anuke/mindustry/world/Tile.java +++ b/core/src/io/anuke/mindustry/world/Tile.java @@ -29,14 +29,13 @@ public class Tile implements PosTrait, TargetTrait{ * This is relative to the block it is linked to; negate coords to find the link. */ public byte link = 0; - public short x, y; /** Tile traversal cost. */ public byte cost = 1; - /** Position of cliffs around the tile, packed into bits 0-8. */ - public byte cliffs; /** Tile entity, usually null. */ public TileEntity entity; - /** Block ID data. */ + public short x, y; + /** Position of cliffs around the tile, packed into bits 0-8. */ + private byte cliffs; private Block wall; private Floor floor; /** Rotation, 0-3. Also used to store offload location for routers, in which case it can be any number. */ @@ -197,6 +196,18 @@ public class Tile implements PosTrait, TargetTrait{ this.elevation = (byte)elevation; } + public byte getCliffs(){ + return cliffs; + } + + public void setCliffs(byte cliffs){ + this.cliffs = cliffs; + } + + public boolean hasCliffs(){ + return getCliffs() != 0; + } + public boolean passable(){ Block block = block(); Block floor = floor(); @@ -212,7 +223,7 @@ public class Tile implements PosTrait, TargetTrait{ public boolean solid(){ Block block = block(); Block floor = floor(); - return block.solid || cliffs != 0 || (floor.solid && (block == Blocks.air || block.solidifes)) || block.isSolidFor(this) + return block.solid || getCliffs() != 0 || (floor.solid && (block == Blocks.air || block.solidifes)) || block.isSolidFor(this) || (isLinked() && getLinked().block().isSolidFor(getLinked())); } diff --git a/core/src/io/anuke/mindustry/world/blocks/Floor.java b/core/src/io/anuke/mindustry/world/blocks/Floor.java index e1fbc0a850..04106ac14b 100644 --- a/core/src/io/anuke/mindustry/world/blocks/Floor.java +++ b/core/src/io/anuke/mindustry/world/blocks/Floor.java @@ -140,12 +140,12 @@ public class Floor extends Block{ Draw.rect(variantRegions[Mathf.randomSeed(tile.id(), 0, Math.max(0, variantRegions.length - 1))], tile.worldx(), tile.worldy()); - if(tile.cliffs != 0 && cliffRegions != null){ + if(tile.hasCliffs() && cliffRegions != null){ for(int i = 0; i < 4; i++){ - if((tile.cliffs & (1 << i * 2)) != 0){ + if((tile.getCliffs() & (1 << i * 2)) != 0){ Draw.colorl(i > 1 ? 0.6f : 1f); - boolean above = (tile.cliffs & (1 << ((i + 1) % 4) * 2)) != 0, below = (tile.cliffs & (1 << (Mathf.mod(i - 1, 4)) * 2)) != 0; + boolean above = (tile.getCliffs() & (1 << ((i + 1) % 4) * 2)) != 0, below = (tile.getCliffs() & (1 << (Mathf.mod(i - 1, 4)) * 2)) != 0; if(above && below){ Draw.rect(cliffRegions[0], tile.worldx(), tile.worldy(), i * 90); @@ -169,7 +169,7 @@ public class Floor extends Block{ } protected void drawEdges(Tile tile, boolean sameLayer){ - if(!blend || tile.cliffs > 0) return; + if(!blend || tile.getCliffs() > 0) return; for(int i = 0; i < 8; i++){ int dx = Geometry.d8[i].x, dy = Geometry.d8[i].y;