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

43 lines
1.2 KiB
C#
Raw Normal View History

#nullable enable
using Content.Server.Administration;
2020-03-03 20:37:26 +01:00
using Content.Server.Interfaces.GameTicking;
using Content.Server.Players;
using Robust.Server.Player;
using Robust.Shared.Console;
2020-03-03 20:37:26 +01:00
using Robust.Shared.IoC;
namespace Content.Server.Commands.Observer
2020-03-03 20:37:26 +01:00
{
[AnyCommand]
public 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 bool CanReturn { get; set; } = true;
2020-03-03 20:37:26 +01:00
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 (!IoCManager.Resolve<IGameTicker>().OnGhostAttempt(mind, CanReturn))
{
shell?.WriteLine("You can't ghost right now.");
return;
}
2020-03-03 20:37:26 +01:00
}
}
}