Files
crystall-punk-14/Content.Server/Ghost/Ghost.cs

43 lines
1.2 KiB
C#
Raw Normal View History

using Content.Server.Administration;
2021-06-09 22:19:39 +02:00
using Content.Server.GameTicking;
2020-03-03 20:37:26 +01:00
using Content.Server.Players;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
using Robust.Shared.GameObjects;
2020-03-03 20:37:26 +01:00
using Robust.Shared.IoC;
2021-06-09 22:19:39 +02:00
namespace Content.Server.Ghost
2020-03-03 20:37:26 +01:00
{
[AnyCommand]
public sealed class Ghost : IConsoleCommand
2020-03-03 20:37:26 +01:00
{
public string Command => "ghost";
public string Description => "Give up on life and become a ghost.";
public string Help => "ghost";
public void Execute(IConsoleShell shell, string argStr, string[] args)
2020-03-03 20:37:26 +01:00
{
var player = shell.Player as IPlayerSession;
2020-03-03 20:37:26 +01:00
if (player == null)
{
shell?.WriteLine("You have no session, you can't ghost.");
2020-03-03 20:37:26 +01:00
return;
}
var mind = player.ContentData()?.Mind;
if (mind == null)
{
shell?.WriteLine("You have no Mind, you can't ghost.");
return;
2020-03-03 20:37:26 +01:00
}
if (!EntitySystem.Get<GameTicker>().OnGhostAttempt(mind, true))
{
shell?.WriteLine("You can't ghost right now.");
return;
}
2020-03-03 20:37:26 +01:00
}
}
}