Remove ghost compref (#19478)

This commit is contained in:
metalgearsloth
2023-08-25 18:50:46 +10:00
committed by GitHub
parent 7c4564adcc
commit 0b542098db
33 changed files with 191 additions and 211 deletions

View File

@@ -1,50 +0,0 @@
using Content.Shared.Actions;
using Content.Shared.Actions.ActionTypes;
using Content.Shared.Ghost;
using Robust.Shared.Utility;
namespace Content.Client.Ghost
{
[RegisterComponent]
[ComponentReference(typeof(SharedGhostComponent))]
public sealed partial class GhostComponent : SharedGhostComponent
{
public bool IsAttached { get; set; }
public InstantAction ToggleLightingAction = new()
{
Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/light.svg.192dpi.png")),
DisplayName = "ghost-gui-toggle-lighting-manager-name",
Description = "ghost-gui-toggle-lighting-manager-desc",
ClientExclusive = true,
CheckCanInteract = false,
Event = new ToggleLightingActionEvent(),
};
public InstantAction ToggleFoVAction = new()
{
Icon = new SpriteSpecifier.Texture(new ("Interface/VerbIcons/vv.svg.192dpi.png")),
DisplayName = "ghost-gui-toggle-fov-name",
Description = "ghost-gui-toggle-fov-desc",
ClientExclusive = true,
CheckCanInteract = false,
Event = new ToggleFoVActionEvent(),
};
public InstantAction ToggleGhostsAction = new()
{
Icon = new SpriteSpecifier.Rsi(new ("Mobs/Ghosts/ghost_human.rsi"), "icon"),
DisplayName = "ghost-gui-toggle-ghost-visibility-name",
Description = "ghost-gui-toggle-ghost-visibility-desc",
ClientExclusive = true,
CheckCanInteract = false,
Event = new ToggleGhostsActionEvent(),
};
}
public sealed partial class ToggleLightingActionEvent : InstantActionEvent { };
public sealed partial class ToggleFoVActionEvent : InstantActionEvent { };
public sealed partial class ToggleGhostsActionEvent : InstantActionEvent { };
}

View File

@@ -11,7 +11,6 @@ using Robust.Shared.GameStates;
namespace Content.Client.Ghost
{
[UsedImplicitly]
public sealed class GhostSystem : SharedGhostSystem
{
[Dependency] private readonly IClientConsoleHost _console = default!;
@@ -60,7 +59,7 @@ namespace Content.Client.Ghost
SubscribeLocalEvent<GhostComponent, ComponentInit>(OnGhostInit);
SubscribeLocalEvent<GhostComponent, ComponentRemove>(OnGhostRemove);
SubscribeLocalEvent<GhostComponent, ComponentHandleState>(OnGhostState);
SubscribeLocalEvent<GhostComponent, AfterAutoHandleStateEvent>(OnGhostState);
SubscribeLocalEvent<GhostComponent, PlayerAttachedEvent>(OnGhostPlayerAttach);
SubscribeLocalEvent<GhostComponent, PlayerDetachedEvent>(OnGhostPlayerDetach);
@@ -77,7 +76,7 @@ namespace Content.Client.Ghost
private void OnGhostInit(EntityUid uid, GhostComponent component, ComponentInit args)
{
if (TryComp(component.Owner, out SpriteComponent? sprite))
if (TryComp(uid, out SpriteComponent? sprite))
{
sprite.Visible = GhostVisibility;
}
@@ -146,7 +145,7 @@ namespace Content.Client.Ghost
PlayerAttached?.Invoke(component);
}
private void OnGhostState(EntityUid uid, GhostComponent component, ref ComponentHandleState args)
private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAutoHandleStateEvent args)
{
if (TryComp<SpriteComponent>(uid, out var sprite))
sprite.LayerSetColor(0, component.color);