This commit is contained in:
Anuken
2024-04-14 11:17:57 -04:00
parent e80a523073
commit 569d0f8fac
4 changed files with 10 additions and 5 deletions

View File

@@ -1310,7 +1310,7 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
if(value instanceof UnitType) type = UnitType.class; if(value instanceof UnitType) type = UnitType.class;
if(builder != null && builder.isPlayer()){ if(builder != null && builder.isPlayer()){
lastAccessed = builder.getPlayer().coloredName(); updateLastAccess(builder.getPlayer());
} }
if(block.configurations.containsKey(type)){ if(block.configurations.containsKey(type)){
@@ -1324,6 +1324,10 @@ abstract class BuildingComp implements Posc, Teamc, Healthc, Buildingc, Timerc,
} }
} }
public void updateLastAccess(Player player){
lastAccessed = player.coloredName();
}
/** Called when the block is tapped by the local player. */ /** Called when the block is tapped by the local player. */
public void tapped(){ public void tapped(){

View File

@@ -734,7 +734,7 @@ abstract class UnitComp implements Healthc, Physicsc, Hitboxc, Statusc, Teamc, I
/** @return name of direct or indirect player controller. */ /** @return name of direct or indirect player controller. */
@Override @Override
public @Nullable String getControllerName(){ public @Nullable String getControllerName(){
if(isPlayer()) return getPlayer().name; if(isPlayer()) return getPlayer().coloredName();
if(controller instanceof LogicAI ai && ai.controller != null) return ai.controller.lastAccessed; if(controller instanceof LogicAI ai && ai.controller != null) return ai.controller.lastAccessed;
return null; return null;
} }

View File

@@ -391,7 +391,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
if(build == null || build.team() != player.team() || !build.block.commandable) continue; if(build == null || build.team() != player.team() || !build.block.commandable) continue;
build.onCommand(target); build.onCommand(target);
build.lastAccessed = player.name; build.updateLastAccess(player);
if(!state.isPaused() && player == Vars.player){ if(!state.isPaused() && player == Vars.player){
Fx.moveCommand.at(target); Fx.moveCommand.at(target);
@@ -596,7 +596,7 @@ public abstract class InputHandler implements InputProcessor, GestureListener{
throw new ValidateException(player, "Player cannot rotate a block."); throw new ValidateException(player, "Player cannot rotate a block.");
} }
if(player != null) build.lastAccessed = player.name; if(player != null) build.updateLastAccess(player);
int previous = build.rotation; int previous = build.rotation;
build.rotation = Mathf.mod(build.rotation + Mathf.sign(direction), 4); build.rotation = Mathf.mod(build.rotation + Mathf.sign(direction), 4);
build.updateProximity(); build.updateProximity();

View File

@@ -1,5 +1,6 @@
package mindustry.ui.dialogs; package mindustry.ui.dialogs;
import arc.*;
import arc.scene.ui.*; import arc.scene.ui.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
import mindustry.gen.*; import mindustry.gen.*;
@@ -39,7 +40,7 @@ public class AdminsDialog extends BaseDialog{
res.labelWrap("[lightgray]" + info.lastName).width(w - h - 24f); res.labelWrap("[lightgray]" + info.lastName).width(w - h - 24f);
res.add().growX(); res.add().growX();
res.button(Icon.cancel, () -> { res.button(Icon.cancel, () -> {
ui.showConfirm("@confirm", "@confirmunadmin", () -> { ui.showConfirm("@confirm", Core.bundle.format("@confirmunadmin", info.lastName), () -> {
netServer.admins.unAdminPlayer(info.id); netServer.admins.unAdminPlayer(info.id);
Groups.player.each(player -> { Groups.player.each(player -> {
if(player != null && !player.isLocal() && player.uuid().equals(info.id)){ if(player != null && !player.isLocal() && player.uuid().equals(info.id)){