Don't configure processor when no changes are made

This commit is contained in:
Anuken
2021-01-02 14:40:08 -05:00
parent 42ae5e90b0
commit c4d72eef39
10 changed files with 38 additions and 14 deletions

View File

@@ -136,7 +136,9 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
int rot = (int)((rotation + 45f) / 90f) % 4;
payload.place(on, rot);
if(isPlayer()) payload.build.lastAccessed = getPlayer().name;
if(getControllerName() != null){
payload.build.lastAccessed = getControllerName();
}
Fx.unitDrop.at(tile);
Fx.placeBlock.at(on.drawx(), on.drawy(), on.block().size);

View File

@@ -445,6 +445,15 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
remove();
}
/** @return name of direct or indirect player controller. */
@Override
public @Nullable String getControllerName(){
if(isPlayer()) return getPlayer().name;
if(controller instanceof LogicAI ai && ai.controller != null) return ai.controller.lastAccessed;
if(controller instanceof FormationAI ai && ai.leader != null && ai.leader.isPlayer()) return ai.leader.getPlayer().name;
return null;
}
@Override
public void display(Table table){
type.display(self(), table);