Files
tbd-station-14/Content.Server/Commands/Mobs/MindInfoCommand.cs
ShadowCommander 481fee135b Delete ghost when respawning (#3519)
* Delete ghost when respawning

Fix session.AttachedEntity not being set to null when mind is wiped
Fix MindComponent not getting disconnected when Mind is wiped
Rename OwnedMob to OwnedComponent

* Update Content.Server/GameTicking/GameTicker.cs

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

Co-authored-by: Paul Ritter <ritter.paul1@googlemail.com>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
2021-03-11 10:37:16 +01:00

48 lines
1.4 KiB
C#

using System.Text;
using Content.Server.Administration;
using Content.Server.Players;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.IoC;
namespace Content.Server.Commands.Mobs
{
[AdminCommand(AdminFlags.Admin)]
public class MindInfoCommand : IConsoleCommand
{
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 data))
{
var mind = data.ContentData().Mind;
var builder = new StringBuilder();
builder.AppendFormat("player: {0}, mob: {1}\nroles: ", mind.UserId, mind.OwnedComponent?.Owner?.Uid);
foreach (var role in mind.AllRoles)
{
builder.AppendFormat("{0} ", role.Name);
}
shell.WriteLine(builder.ToString());
}
else
{
shell.WriteLine("Can't find that mind");
}
}
}
}