Files
tbd-station-14/Content.Client/Ghost/GhostToggleSelfVisibility.cs
Kyle Tyo 9d22f6147c Command resolve killing, LEC conversions, and general cleanup. (#38338)
* i'm just gonna put this here.

* I'm just gonna do it.

* Update ShowHTNCommand.cs

* I feel dumb.

* may as well with this too.

* this does in fact not work

* :/
2025-06-17 20:08:12 +02:00

31 lines
954 B
C#

using Content.Shared.Ghost;
using Robust.Client.GameObjects;
using Robust.Shared.Console;
namespace Content.Client.Ghost;
public sealed class GhostToggleSelfVisibility : LocalizedEntityCommands
{
[Dependency] private readonly SpriteSystem _sprite = default!;
public override string Command => "toggleselfghost";
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
var attachedEntity = shell.Player?.AttachedEntity;
if (!attachedEntity.HasValue)
return;
if (!EntityManager.HasComponent<GhostComponent>(attachedEntity))
{
shell.WriteError(Loc.GetString($"cmd-toggleselfghost-must-be-ghost"));
return;
}
if (!EntityManager.TryGetComponent(attachedEntity, out SpriteComponent? spriteComponent))
return;
_sprite.SetVisible((attachedEntity.Value, spriteComponent), !spriteComponent.Visible);
}
}