diff --git a/core/src/io/anuke/mindustry/content/Blocks.java b/core/src/io/anuke/mindustry/content/Blocks.java index 7d7f222ac7..cf35aecb84 100644 --- a/core/src/io/anuke/mindustry/content/Blocks.java +++ b/core/src/io/anuke/mindustry/content/Blocks.java @@ -205,10 +205,8 @@ public class Blocks implements ContentList{ variants = 1; }}; - rocks = new Rock("rocks"){{ + rocks = new StaticWall("rocks"){{ variants = 2; - breakable = alwaysReplace = false; - solid = true; }}; //endregion diff --git a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java index 1094a1cbf7..8da7a2280b 100644 --- a/core/src/io/anuke/mindustry/graphics/BlockRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/BlockRenderer.java @@ -73,6 +73,9 @@ public class BlockRenderer{ shadows.begin(); Core.graphics.clear(Color.CLEAR); Draw.color(shadowColor); + floor.beginDraw(); + floor.drawLayer(CacheLayer.walls); + floor.endDraw(); drawBlocks(Layer.shadow); EntityDraw.drawWith(playerGroup, player -> !player.isDead(), Unit::draw); @@ -119,11 +122,11 @@ public class BlockRenderer{ Tile tile = world.rawTile(x, y); Block block = tile.block(); - if(!expanded && block != Blocks.air && world.isAccessible(x, y)){ + if(!expanded && block != Blocks.air && block.cacheLayer == CacheLayer.normal && world.isAccessible(x, y)){ tile.block().drawShadow(tile); } - if(block != Blocks.air){ + if(block != Blocks.air && block.cacheLayer == CacheLayer.normal){ if(!expanded){ addRequest(tile, Layer.shadow); addRequest(tile, Layer.block); @@ -148,6 +151,10 @@ public class BlockRenderer{ lastCamY = avgy; lastRangeX = rangex; lastRangeY = rangey; + + floor.beginDraw(); + floor.drawLayer(CacheLayer.walls); + floor.endDraw(); } public void drawBlocks(Layer stopAt){ diff --git a/core/src/io/anuke/mindustry/graphics/FloorRenderer.java b/core/src/io/anuke/mindustry/graphics/FloorRenderer.java index 97165b9a00..115615b682 100644 --- a/core/src/io/anuke/mindustry/graphics/FloorRenderer.java +++ b/core/src/io/anuke/mindustry/graphics/FloorRenderer.java @@ -22,7 +22,8 @@ import io.anuke.mindustry.world.blocks.Floor; import java.util.Arrays; -import static io.anuke.mindustry.Vars.*; +import static io.anuke.mindustry.Vars.tilesize; +import static io.anuke.mindustry.Vars.world; public class FloorRenderer{ private final static int chunksize = 64; @@ -156,7 +157,11 @@ public class FloorRenderer{ Tile tile = world.tile(tilex, tiley); if(tile != null){ - used.add(tile.floor().cacheLayer); + if(tile.block().cacheLayer != CacheLayer.normal){ + used.add(tile.block().cacheLayer); + }else{ + used.add(tile.floor().cacheLayer); + } } } } @@ -183,7 +188,9 @@ public class FloorRenderer{ floor = tile.floor(); } - if(floor.cacheLayer == layer){ + if(tile.block().cacheLayer == layer && layer == CacheLayer.walls){ + tile.block().draw(tile); + }else if(floor.cacheLayer == layer && tile.block().cacheLayer != CacheLayer.walls){ floor.draw(tile); } } diff --git a/core/src/io/anuke/mindustry/world/blocks/StaticWall.java b/core/src/io/anuke/mindustry/world/blocks/StaticWall.java new file mode 100644 index 0000000000..df881c880b --- /dev/null +++ b/core/src/io/anuke/mindustry/world/blocks/StaticWall.java @@ -0,0 +1,13 @@ +package io.anuke.mindustry.world.blocks; + +import io.anuke.mindustry.graphics.CacheLayer; + +public class StaticWall extends Rock{ + + public StaticWall(String name){ + super(name); + breakable = alwaysReplace = false; + solid = true; + cacheLayer = CacheLayer.walls; + } +}