diff --git a/core/src/mindustry/core/Renderer.java b/core/src/mindustry/core/Renderer.java index 16b73c4a71..436d08a21b 100644 --- a/core/src/mindustry/core/Renderer.java +++ b/core/src/mindustry/core/Renderer.java @@ -188,6 +188,8 @@ public class Renderer implements ApplicationListener{ Draw.proj(camera); + Draw.sort(true); + //beginFx(); drawBackground(); @@ -206,7 +208,7 @@ public class Renderer implements ApplicationListener{ blocks.floor.drawLayer(CacheLayer.walls); blocks.floor.endDraw(); - Draw.sort(true); + blocks.drawBlocks(); diff --git a/core/src/mindustry/graphics/BlockRenderer.java b/core/src/mindustry/graphics/BlockRenderer.java index 4a88a96ba6..b9f2a28d6c 100644 --- a/core/src/mindustry/graphics/BlockRenderer.java +++ b/core/src/mindustry/graphics/BlockRenderer.java @@ -14,6 +14,7 @@ import mindustry.game.Teams.*; import mindustry.gen.*; import mindustry.ui.*; import mindustry.world.*; +import mindustry.world.blocks.power.*; import static arc.Core.camera; import static mindustry.Vars.*; @@ -202,7 +203,7 @@ public class BlockRenderer implements Disposable{ if(tile.entity != null && tile.entity.power() != null && tile.entity.power().links.size > 0){ for(Tilec other : tile.entity.getPowerConnections(outArray2)){ - if(other.block().layer == Layer.power){ + if(other.block() instanceof PowerNode){ //TODO need a generic way to render connections! requests.add(other.tile()); } } diff --git a/core/src/mindustry/graphics/Layer.java b/core/src/mindustry/graphics/Layer.java index f731452aa8..21ad9a530d 100644 --- a/core/src/mindustry/graphics/Layer.java +++ b/core/src/mindustry/graphics/Layer.java @@ -1,16 +1,63 @@ package mindustry.graphics; -public enum Layer{ - /** Base block layer. */ - block, - /** for placement */ - placement, - /** First overlay. Stuff like conveyor items. */ - overlay, - /** "High" blocks, like turrets. */ - turret, - /** Power lasers. */ - power, - /** Extra layer that's always on top.*/ - lights +/** Stores constants for sorting layers. Values should be stored in increments of 10. */ +public class Layer{ + + public static final float + + //background, which may be planets or an image or nothing at all + background = -10, + + //floor tiles + floor = 0, + + //scorch marks on the floor + scorch = 10, + + //things such as spent casings or rubble + debris = 20, + + //base block layer - most blocks go here + block = 30, + + //blocks currently in progress *shaders used* TODO perhaps put shaders into their own category + blockBuilding = 40, + + //ground units + groundUnit = 50, + + //turrets + turret = 60, + + //power lines + power = 70, + + //building plans + plans = 80, + + //flying units + flyingUnit = 90, + + //bullets *bloom begin* + bullet = 100, + + //effects *bloom end* + effect = 110, + + //overlaied UI, like block config guides + overlayUI = 120, + + //weather effects, e.g. rain and snow TODO draw before overlay UI? + weather = 130, + + //light rendering *shaders used* + light = 140, + + //names of players in the game + playerName = 150, + + //space effects, currently only the land and launch effects + space = 160 + + ; } diff --git a/core/src/mindustry/world/blocks/legacy/LegacyCommandCenter.java b/core/src/mindustry/world/blocks/legacy/LegacyCommandCenter.java index 91ac7acce0..4fbd663263 100644 --- a/core/src/mindustry/world/blocks/legacy/LegacyCommandCenter.java +++ b/core/src/mindustry/world/blocks/legacy/LegacyCommandCenter.java @@ -2,9 +2,8 @@ package mindustry.world.blocks.legacy; import arc.util.io.*; import mindustry.gen.*; -import mindustry.world.*; -public class LegacyCommandCenter extends Block{ +public class LegacyCommandCenter extends LegacyBlock{ public LegacyCommandCenter(String name){ super(name); diff --git a/core/src/mindustry/world/blocks/legacy/LegacyUnitFactory.java b/core/src/mindustry/world/blocks/legacy/LegacyUnitFactory.java index 88049a1832..8befde6940 100644 --- a/core/src/mindustry/world/blocks/legacy/LegacyUnitFactory.java +++ b/core/src/mindustry/world/blocks/legacy/LegacyUnitFactory.java @@ -2,9 +2,8 @@ package mindustry.world.blocks.legacy; import arc.util.io.*; import mindustry.gen.*; -import mindustry.world.*; -public class LegacyUnitFactory extends Block{ +public class LegacyUnitFactory extends LegacyBlock{ public LegacyUnitFactory(String name){ super(name);