Added message for last accessed player of block
This commit is contained in:
@@ -57,6 +57,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
transient int rotation;
|
||||
transient boolean enabled = true;
|
||||
transient float enabledControlTime;
|
||||
transient String lastAccessed;
|
||||
|
||||
PowerModule power;
|
||||
ItemModule items;
|
||||
@@ -879,6 +880,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
//null is of type void.class; anonymous classes use their superclass.
|
||||
Class<?> type = value == null ? void.class : value.getClass().isAnonymousClass() ? value.getClass().getSuperclass() : value.getClass();
|
||||
|
||||
if(builder != null && builder.isPlayer()){
|
||||
lastAccessed = builder.getPlayer().name;
|
||||
}
|
||||
|
||||
if(block.configurations.containsKey(type)){
|
||||
block.configurations.get(type).get(this, value);
|
||||
}
|
||||
@@ -1043,6 +1048,11 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
|
||||
}
|
||||
}
|
||||
|
||||
if(net.active() && lastAccessed != null){
|
||||
table.row();
|
||||
table.add(Core.bundle.format("lastaccessed", lastAccessed)).growX().wrap().left();
|
||||
}
|
||||
|
||||
table.marginBottom(-5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,10 +86,10 @@ abstract class PayloadComp implements Posc, Rotc, Hitboxc, Unitc{
|
||||
return true;
|
||||
}
|
||||
|
||||
if(payload instanceof BuildPayload){
|
||||
return dropBlock((BuildPayload)payload);
|
||||
}else if(payload instanceof UnitPayload){
|
||||
return dropUnit((UnitPayload)payload);
|
||||
if(payload instanceof BuildPayload b){
|
||||
return dropBlock(b);
|
||||
}else if(payload instanceof UnitPayload p){
|
||||
return dropUnit(p);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -126,6 +126,8 @@ 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;
|
||||
|
||||
Fx.unitDrop.at(tile);
|
||||
Fx.placeBlock.at(on.drawx(), on.drawy(), on.block().size);
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user