IPlayerManager refactor (#21215)

This commit is contained in:
Leon Friedrich
2023-10-24 20:19:08 +11:00
committed by GitHub
parent c500a63ada
commit 7ba0ea2926
248 changed files with 966 additions and 1048 deletions

View File

@@ -1,6 +1,5 @@
using Content.Server.Mind;
using Content.Shared.Administration;
using Content.Shared.Mind;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Administration.Commands
@@ -16,7 +15,7 @@ namespace Content.Server.Administration.Commands
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (shell.Player is not IPlayerSession player)
if (shell.Player is not { } player)
{
shell.WriteLine("shell-server-cannot");
return;
@@ -42,14 +41,7 @@ namespace Content.Server.Administration.Commands
return;
}
var mindSystem = _entities.System<SharedMindSystem>();
if (!mindSystem.TryGetMind(target, out var mindId, out var mind))
{
shell.WriteLine(Loc.GetString("shell-entity-is-not-mob"));
return;
}
mindSystem.TransferTo(mindId, target, mind: mind);
_entities.System<MindSystem>().ControlMob(player.UserId, target);
}
}
}