From 44abe3e54d8522fe795a59a0b302a0f1f858cbbc Mon Sep 17 00:00:00 2001
From: LankLTE <135308300+LankLTE@users.noreply.github.com>
Date: Tue, 16 Jan 2024 17:26:14 -0800
Subject: [PATCH] Follow command and ahelp menu follow (#24142)
* Command & ahelp rename
* Reviews
* remove tpto
---
.../UI/Bwoink/BwoinkControl.xaml | 2 +-
.../UI/Bwoink/BwoinkControl.xaml.cs | 8 ++--
.../Administration/Commands/FollowCommand.cs | 44 +++++++++++++++++++
.../commands/follow-command.ftl | 2 +
.../en-US/administration/ui/actions.ftl | 2 +-
5 files changed, 52 insertions(+), 6 deletions(-)
create mode 100644 Content.Server/Administration/Commands/FollowCommand.cs
create mode 100644 Resources/Locale/en-US/administration/commands/follow-command.ftl
diff --git a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml b/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml
index 28b55f987f..e5269c027a 100644
--- a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml
+++ b/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml
@@ -14,7 +14,7 @@
-
+
diff --git a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs b/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs
index 90dc88e5b1..af977f763c 100644
--- a/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs
+++ b/Content.Client/Administration/UI/Bwoink/BwoinkControl.xaml.cs
@@ -138,10 +138,10 @@ namespace Content.Client.Administration.UI.Bwoink
_console.ExecuteCommand($"kick \"{_currentPlayer.Username}\"");
};
- Teleport.OnPressed += _ =>
+ Follow.OnPressed += _ =>
{
if (_currentPlayer is not null)
- _console.ExecuteCommand($"tpto \"{_currentPlayer.Username}\"");
+ _console.ExecuteCommand($"follow \"{_currentPlayer.NetEntity}\"");
};
Respawn.OnPressed += _ =>
@@ -204,8 +204,8 @@ namespace Content.Client.Administration.UI.Bwoink
Respawn.Visible = _adminManager.CanCommand("respawn");
Respawn.Disabled = !Respawn.Visible || disabled;
- Teleport.Visible = _adminManager.CanCommand("tpto");
- Teleport.Disabled = !Teleport.Visible || disabled;
+ Follow.Visible = _adminManager.CanCommand("follow");
+ Follow.Disabled = !Follow.Visible || disabled;
}
private string FormatTabTitle(ItemList.Item li, PlayerInfo? pl = default)
diff --git a/Content.Server/Administration/Commands/FollowCommand.cs b/Content.Server/Administration/Commands/FollowCommand.cs
new file mode 100644
index 0000000000..1ced6cf8dd
--- /dev/null
+++ b/Content.Server/Administration/Commands/FollowCommand.cs
@@ -0,0 +1,44 @@
+using Content.Shared.Administration;
+using Content.Shared.Follower;
+using Robust.Shared.Console;
+using Robust.Shared.Enums;
+
+namespace Content.Server.Administration.Commands;
+
+[AdminCommand(AdminFlags.Admin)]
+public sealed class FollowCommand : IConsoleCommand
+{
+ [Dependency] private readonly IEntityManager _entManager = default!;
+
+ public string Command => "follow";
+ public string Description => Loc.GetString("add-uplink-command-description");
+ public string Help => Loc.GetString("add-uplink-command-help");
+
+ public void Execute(IConsoleShell shell, string argStr, string[] args)
+ {
+ var player = shell.Player;
+ if (player == null)
+ {
+ shell.WriteError(Loc.GetString("shell-only-players-can-run-this-command"));
+ return;
+ }
+
+ if (args.Length != 1)
+ {
+ shell.WriteError(Loc.GetString("shell-need-exactly-one-argument"));
+ return;
+ }
+
+ if (player.Status != SessionStatus.InGame || player.AttachedEntity is not { Valid: true } playerEntity)
+ {
+ shell.WriteError(Loc.GetString("shell-must-be-attached-to-entity"));
+ return;
+ }
+
+ var entity = args[0];
+ if (NetEntity.TryParse(entity, out var uidNet) && _entManager.TryGetEntity(uidNet, out var uid))
+ {
+ _entManager.System().StartFollowingEntity(playerEntity, uid.Value);
+ }
+ }
+}
diff --git a/Resources/Locale/en-US/administration/commands/follow-command.ftl b/Resources/Locale/en-US/administration/commands/follow-command.ftl
new file mode 100644
index 0000000000..3ef5fde075
--- /dev/null
+++ b/Resources/Locale/en-US/administration/commands/follow-command.ftl
@@ -0,0 +1,2 @@
+follow-command-description = Makes you begin following an entity
+follow-command-help = Usage: follow [netEntity]
\ No newline at end of file
diff --git a/Resources/Locale/en-US/administration/ui/actions.ftl b/Resources/Locale/en-US/administration/ui/actions.ftl
index 0433a724c1..b067774d0a 100644
--- a/Resources/Locale/en-US/administration/ui/actions.ftl
+++ b/Resources/Locale/en-US/administration/ui/actions.ftl
@@ -8,5 +8,5 @@ admin-player-actions-spawn = Spawn here
admin-player-spawn-failed = Failed to find valid coordinates
admin-player-actions-clone = Clone
-admin-player-actions-teleport = Teleport To
+admin-player-actions-follow = Follow
admin-player-actions-confirm = Are you sure?
--
2.51.2