diff --git a/core/src/mindustry/type/Weapon.java b/core/src/mindustry/type/Weapon.java index af6b19b05e..04facbab05 100644 --- a/core/src/mindustry/type/Weapon.java +++ b/core/src/mindustry/type/Weapon.java @@ -97,6 +97,8 @@ public class Weapon implements Cloneable{ public boolean parentizeEffects; /** internal value used for alternation - do not change! */ public int otherSide = -1; + /** draw Z offset relative to the default value */ + public float layerOffset = 0f; /** sound used for shooting */ public Sound shootSound = Sounds.pew; /** sound used for weapons that have a delay */ @@ -161,6 +163,10 @@ public class Weapon implements Cloneable{ } public void draw(Unit unit, WeaponMount mount){ + //apply layer offset, roll it back at the end + float z = Draw.z(); + Draw.z(z + layerOffset); + float rotation = unit.rotation - 90, weaponRotation = rotation + (rotate ? mount.rotation : 0), @@ -196,6 +202,8 @@ public class Weapon implements Cloneable{ Draw.blend(); Draw.color(); } + + Draw.z(z); } public void update(Unit unit, WeaponMount mount){