Ghost toggle lighting ability (#12374)
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Actions.ActionTypes;
|
||||
using Content.Shared.Ghost;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.Ghost
|
||||
{
|
||||
@@ -7,5 +10,17 @@ namespace Content.Client.Ghost
|
||||
public sealed class GhostComponent : SharedGhostComponent
|
||||
{
|
||||
public bool IsAttached { get; set; }
|
||||
|
||||
public InstantAction DisableLightingAction = new()
|
||||
{
|
||||
Icon = new SpriteSpecifier.Texture(new ResourcePath("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 DisableLightingActionEvent(),
|
||||
};
|
||||
}
|
||||
|
||||
public sealed class DisableLightingActionEvent : InstantActionEvent { };
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Ghost;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.GameStates;
|
||||
|
||||
@@ -12,6 +14,8 @@ namespace Content.Client.Ghost
|
||||
{
|
||||
[Dependency] private readonly IClientConsoleHost _console = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||
[Dependency] private readonly ILightManager _lightManager = default!;
|
||||
|
||||
public int AvailableGhostRoleCount { get; private set; }
|
||||
|
||||
@@ -61,6 +65,8 @@ namespace Content.Client.Ghost
|
||||
|
||||
SubscribeNetworkEvent<GhostWarpsResponseEvent>(OnGhostWarpsResponse);
|
||||
SubscribeNetworkEvent<GhostUpdateGhostRoleCountEvent>(OnUpdateGhostRoleCount);
|
||||
|
||||
SubscribeLocalEvent<GhostComponent, DisableLightingActionEvent>(OnActionPerform);
|
||||
}
|
||||
|
||||
private void OnGhostInit(EntityUid uid, GhostComponent component, ComponentInit args)
|
||||
@@ -69,10 +75,24 @@ namespace Content.Client.Ghost
|
||||
{
|
||||
sprite.Visible = GhostVisibility;
|
||||
}
|
||||
|
||||
_actions.AddAction(uid, component.DisableLightingAction, null);
|
||||
}
|
||||
|
||||
private void OnActionPerform(EntityUid uid, GhostComponent component, DisableLightingActionEvent args)
|
||||
{
|
||||
if (args.Handled)
|
||||
return;
|
||||
|
||||
_lightManager.Enabled = !_lightManager.Enabled;
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private void OnGhostRemove(EntityUid uid, GhostComponent component, ComponentRemove args)
|
||||
{
|
||||
_actions.RemoveAction(uid, component.DisableLightingAction);
|
||||
_lightManager.Enabled = true;
|
||||
|
||||
if (uid != _playerManager.LocalPlayer?.ControlledEntity)
|
||||
return;
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ ghost-gui-return-to-body-button = Return to body
|
||||
ghost-gui-ghost-warp-button = Ghost Warp
|
||||
ghost-gui-ghost-roles-button = Ghost Roles ({$count})
|
||||
ghost-gui-toggle-ghost-visibility-button = Toggle Ghosts
|
||||
ghost-gui-toggle-lighting-manager-name = Toggle Lighting
|
||||
ghost-gui-toggle-lighting-manager-desc = Toggle light rendering to better observe dark areas or to see what players see.
|
||||
|
||||
ghost-target-window-title = Ghost Warp
|
||||
ghost-target-window-current-button = Warp: {$name}
|
||||
@@ -12,4 +14,3 @@ ghost-roles-window-request-role-button-timer = Request ({$time}s)
|
||||
ghost-roles-window-follow-role-button = Follow
|
||||
ghost-roles-window-no-roles-available-label = There are currently no available ghost roles.
|
||||
ghost-roles-window-rules-footer = The button will enable after {$time} seconds (this delay is to make sure you read the rules).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user