diff --git a/core/src/mindustry/entities/comp/BlockUnitComp.java b/core/src/mindustry/entities/comp/BlockUnitComp.java index 2ce9a3afd1..bd13c88991 100644 --- a/core/src/mindustry/entities/comp/BlockUnitComp.java +++ b/core/src/mindustry/entities/comp/BlockUnitComp.java @@ -43,6 +43,12 @@ abstract class BlockUnitComp implements Unitc{ return tile.block.fullIcon; } + @Replace + @Override + public TextureRegion uiIcon(){ + return tile.block.uiIcon; + } + @Override public void killed(){ tile.kill(); diff --git a/core/src/mindustry/entities/comp/PlayerComp.java b/core/src/mindustry/entities/comp/PlayerComp.java index fe787a8336..45a80b7c1f 100644 --- a/core/src/mindustry/entities/comp/PlayerComp.java +++ b/core/src/mindustry/entities/comp/PlayerComp.java @@ -72,9 +72,9 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra public TextureRegion icon(){ //display default icon for dead players - if(dead()) return core() == null ? UnitTypes.alpha.fullIcon : ((CoreBlock)bestCore().block).unitType.fullIcon; + if(dead()) return core() == null ? UnitTypes.alpha.uiIcon : ((CoreBlock)bestCore().block).unitType.uiIcon; - return unit.icon(); + return unit.uiIcon(); } public boolean displayAmmo(){ diff --git a/core/src/mindustry/entities/comp/UnitComp.java b/core/src/mindustry/entities/comp/UnitComp.java index 8ca3361cdd..c33e020693 100644 --- a/core/src/mindustry/entities/comp/UnitComp.java +++ b/core/src/mindustry/entities/comp/UnitComp.java @@ -671,6 +671,11 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I return type.fullIcon; } + /** @return a preview UI icon for this unit. */ + public TextureRegion uiIcon(){ + return type.uiIcon; + } + /** Actually destroys the unit, removing it and creating explosions. **/ public void destroy(){ if(!isAdded() || !type.killable) return; diff --git a/core/src/mindustry/graphics/MinimapRenderer.java b/core/src/mindustry/graphics/MinimapRenderer.java index e5f42b2c9a..a14935a379 100644 --- a/core/src/mindustry/graphics/MinimapRenderer.java +++ b/core/src/mindustry/graphics/MinimapRenderer.java @@ -166,7 +166,7 @@ public class MinimapRenderer{ if(unit.inFogTo(player.team()) || !unit.type.drawMinimap) continue; float scale = Scl.scl(1f) * tilesize * 3; - var region = unit.icon(); + var region = unit.uiIcon(); Draw.mixcol(unit.team.color, 1f); Draw.rect(region, unit.x, unit.y, scale, scale * (float)region.height / region.width, unit.rotation() - 90); diff --git a/core/src/mindustry/graphics/OverlayRenderer.java b/core/src/mindustry/graphics/OverlayRenderer.java index 14e9927e9c..844a087c8e 100644 --- a/core/src/mindustry/graphics/OverlayRenderer.java +++ b/core/src/mindustry/graphics/OverlayRenderer.java @@ -129,7 +129,7 @@ public class OverlayRenderer{ Draw.mixcol(Pal.accent, 1f); Draw.alpha(unitFade); Building build = (select instanceof BlockUnitc b ? b.tile() : select instanceof Building b ? b : null); - TextureRegion region = build != null ? build.block.fullIcon : select instanceof Unit u ? u.icon() : Core.atlas.white(); + TextureRegion region = build != null ? build.block.fullIcon : Core.atlas.white(); if(!(select instanceof Unitc)){ Draw.rect(region, select.getX(), select.getY());