Files
tbd-station-14/Content.Server/Mind/Commands/MindInfoCommand.cs
Errant 93c7bdc134 Mind Role Entities (#31318)
* Mind Role Entities wip

* headrev count fix

* silicon stuff, cleanup

* exclusive antag config, cleanup

* jobroleadd overwerite

* logging stuff

* MindHasRole cleanup, admin log stuff

* last second cleanup

* ocd

* minor cleanup

* remove createdTime datafield

* now actually using the event replacement I made for role time tracking

* weh
2024-10-10 10:48:56 +02:00

55 lines
1.7 KiB
C#

using System.Text;
using Content.Server.Administration;
using Content.Shared.Administration;
using Content.Shared.Mind;
using Content.Shared.Roles;
using Robust.Server.Player;
using Robust.Shared.Console;
namespace Content.Server.Mind.Commands
{
[AdminCommand(AdminFlags.Admin)]
public sealed class MindInfoCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "mindinfo";
public string Description => "Lists info for the mind of a specific player.";
public string Help => "mindinfo <session ID>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteLine("Expected exactly 1 argument.");
return;
}
var mgr = IoCManager.Resolve<IPlayerManager>();
if (!mgr.TryGetSessionByUsername(args[0], out var session))
{
shell.WriteLine("Can't find that mind");
return;
}
var minds = _entities.System<SharedMindSystem>();
if (!minds.TryGetMind(session, out var mindId, out var mind))
{
shell.WriteLine("Can't find that mind");
return;
}
var builder = new StringBuilder();
builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.UserId, mind.OwnedEntity);
var roles = _entities.System<SharedRoleSystem>();
foreach (var role in roles.MindGetAllRoleInfo(mindId))
{
builder.AppendFormat("{0} ", role.Name);
}
shell.WriteLine(builder.ToString());
}
}
}