2021-02-01 16:49:43 -08:00
|
|
|
#nullable enable
|
2020-12-07 14:52:55 +01:00
|
|
|
using Content.Server.Administration;
|
2020-03-03 20:37:26 +01:00
|
|
|
using Content.Server.Interfaces.GameTicking;
|
|
|
|
|
using Content.Server.Players;
|
2021-02-11 01:13:03 -08:00
|
|
|
using Robust.Server.Player;
|
2021-02-01 16:49:43 -08:00
|
|
|
using Robust.Shared.Console;
|
2020-03-03 20:37:26 +01:00
|
|
|
using Robust.Shared.IoC;
|
|
|
|
|
|
2020-12-03 03:40:47 +01:00
|
|
|
namespace Content.Server.Commands.Observer
|
2020-03-03 20:37:26 +01:00
|
|
|
{
|
2020-10-30 16:06:48 +01:00
|
|
|
[AnyCommand]
|
2021-02-01 16:49:43 -08:00
|
|
|
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";
|
2020-08-16 17:08:27 +02:00
|
|
|
public bool CanReturn { get; set; } = true;
|
2020-03-03 20:37:26 +01:00
|
|
|
|
2021-02-01 16:49:43 -08:00
|
|
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
2020-03-03 20:37:26 +01:00
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
var player = shell.Player as IPlayerSession;
|
2020-03-03 20:37:26 +01:00
|
|
|
if (player == null)
|
|
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
shell?.WriteLine("You have no session, you can't ghost.");
|
2020-03-03 20:37:26 +01:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-01-14 08:57:24 +01:00
|
|
|
var mind = player.ContentData()?.Mind;
|
2020-08-25 05:37:54 -06:00
|
|
|
if (mind == null)
|
|
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
shell?.WriteLine("You have no Mind, you can't ghost.");
|
2020-03-30 01:16:44 +02:00
|
|
|
return;
|
2020-03-03 20:37:26 +01:00
|
|
|
}
|
|
|
|
|
|
2020-12-11 01:10:55 +00:00
|
|
|
if (!IoCManager.Resolve<IGameTicker>().OnGhostAttempt(mind, CanReturn))
|
2020-08-14 08:13:32 -05:00
|
|
|
{
|
2021-02-01 16:49:43 -08:00
|
|
|
shell?.WriteLine("You can't ghost right now.");
|
2020-12-11 01:10:55 +00:00
|
|
|
return;
|
2020-08-14 08:13:32 -05:00
|
|
|
}
|
2020-03-03 20:37:26 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|