* camera * add console command * change verb name to camera * placeholder text * add button to player panel * orks are indeed the best * visibility flag fix * not a datafield * more follower fixes * more cleanup * add zooming * resizing real * remove commented out code * remove AddForceSend * comment * Use OS window and add some comments * fix comments and variable name * Needs RT update * Minor grammarchange * Fix warning * Cleanup * almost working... * fix bug * oswindow update * Remove need for RequestClosed. --------- Co-authored-by: beck-thompson <beck314159@hotmail.com> Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com>
59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
using Content.Server.Administration.UI;
|
|
using Content.Server.EUI;
|
|
using Content.Shared.Administration;
|
|
using Robust.Server.Player;
|
|
using Robust.Shared.Console;
|
|
|
|
namespace Content.Server.Administration.Commands;
|
|
|
|
[AdminCommand(AdminFlags.Admin)]
|
|
public sealed class CameraCommand : LocalizedCommands
|
|
{
|
|
[Dependency] private readonly EuiManager _eui = default!;
|
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
|
|
public override string Command => "camera";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
if (shell.Player is not { } user)
|
|
{
|
|
shell.WriteError(Loc.GetString("shell-cannot-run-command-from-server"));
|
|
return;
|
|
}
|
|
|
|
if (args.Length != 1)
|
|
{
|
|
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
|
|
return;
|
|
}
|
|
|
|
if (!NetEntity.TryParse(args[0], out var targetNetId) || !_entManager.TryGetEntity(targetNetId, out var targetUid))
|
|
{
|
|
if (!_playerManager.TryGetSessionByUsername(args[0], out var player)
|
|
|| player.AttachedEntity == null)
|
|
{
|
|
shell.WriteError(Loc.GetString("cmd-camera-wrong-argument"));
|
|
return;
|
|
}
|
|
targetUid = player.AttachedEntity.Value;
|
|
}
|
|
|
|
var ui = new AdminCameraEui(targetUid.Value);
|
|
_eui.OpenEui(ui, user);
|
|
}
|
|
|
|
public override CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
|
{
|
|
if (args.Length == 1)
|
|
{
|
|
return CompletionResult.FromHintOptions(
|
|
CompletionHelper.SessionNames(players: _playerManager),
|
|
Loc.GetString("cmd-camera-hint"));
|
|
}
|
|
|
|
return CompletionResult.Empty;
|
|
}
|
|
}
|