mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-05 21:10:53 +07:00
Switched to unit UI icons for minimap/players
This commit is contained in:
parent
243cc1e527
commit
604e732edb
@ -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();
|
||||
|
@ -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(){
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user