* 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 * :/
31 lines
954 B
C#
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);
|
|
}
|
|
}
|