mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-03-13 19:39:04 +07:00
This commit is contained in:
parent
9c846bd2c9
commit
9b1c66ba15
@ -59,6 +59,12 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
return team.core();
|
||||
}
|
||||
|
||||
/** @return largest/closest core, with largest cores getting priority */
|
||||
@Nullable
|
||||
public CoreBuild bestCore(){
|
||||
return team.cores().min(Structs.comps(Structs.comparingInt(c -> -c.block.size), Structs.comparingFloat(c -> c.dst(x, y))));
|
||||
}
|
||||
|
||||
public TextureRegion icon(){
|
||||
//display default icon for dead players
|
||||
if(dead()) return core() == null ? UnitTypes.alpha.icon(Cicon.full) : ((CoreBlock)core().block).unitType.icon(Cicon.full);
|
||||
@ -112,7 +118,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
clearUnit();
|
||||
}
|
||||
|
||||
CoreBuild core = closestCore();
|
||||
CoreBuild core;
|
||||
|
||||
if(!dead()){
|
||||
set(unit);
|
||||
@ -124,7 +130,7 @@ abstract class PlayerComp implements UnitController, Entityc, Syncc, Timerc, Dra
|
||||
Tile tile = unit.tileOn();
|
||||
unit.elevation = Mathf.approachDelta(unit.elevation, (tile != null && tile.solid()) || boosting ? 1f : 0f, 0.08f);
|
||||
}
|
||||
}else if(core != null){
|
||||
}else if((core = bestCore()) != null){
|
||||
//have a small delay before death to prevent the camera from jumping around too quickly
|
||||
//(this is not for balance, it just looks better this way)
|
||||
deathTimer += Time.delta;
|
||||
|
Loading…
Reference in New Issue
Block a user