Add clientside personal pointlight for observers (#33607)

* Observer personal pointlight

* Bigger light

* combine actions

---------

Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co>
Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
Winkarst
2025-02-05 02:26:06 +03:00
committed by GitHub
parent 7478af2d2a
commit 265de76c9a
3 changed files with 30 additions and 5 deletions

View File

@@ -13,6 +13,7 @@ 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 PointLightSystem _pointLightSystem = default!;
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
public int AvailableGhostRoleCount { get; private set; }
@@ -79,8 +80,27 @@ namespace Content.Client.Ghost
if (args.Handled)
return;
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup"), args.Performer);
_contentEye.RequestToggleLight(uid, component);
TryComp<PointLightComponent>(uid, out var light);
if (!component.DrawLight)
{
// normal lighting
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup-normal"), args.Performer);
_contentEye.RequestEye(component.DrawFov, true);
}
else if (!light?.Enabled ?? false) // skip this option if we have no PointLightComponent
{
// enable personal light
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup-personal-light"), args.Performer);
_pointLightSystem.SetEnabled(uid, true, light);
}
else
{
// fullbright mode
Popup.PopupEntity(Loc.GetString("ghost-gui-toggle-lighting-manager-popup-fullbright"), args.Performer);
_contentEye.RequestEye(component.DrawFov, false);
_pointLightSystem.SetEnabled(uid, false, light);
}
args.Handled = true;
}

View File

@@ -3,7 +3,9 @@ ghost-gui-ghost-warp-button = Ghost Warp
ghost-gui-ghost-roles-button = Ghost Roles ({$count})
ghost-gui-toggle-ghost-visibility-popup-on = Enabled visibility of ghosts.
ghost-gui-toggle-ghost-visibility-popup-off = Disabled visibility of ghosts.
ghost-gui-toggle-lighting-manager-popup = Toggled all lighting.
ghost-gui-toggle-lighting-manager-popup-normal = Lighting normal.
ghost-gui-toggle-lighting-manager-popup-personal-light = Enabled personal light.
ghost-gui-toggle-lighting-manager-popup-fullbright = Fullbright mode.
ghost-gui-toggle-fov-popup = Toggled field-of-view.
ghost-gui-toggle-hearing-popup-on = You can now hear all messages.

View File

@@ -63,6 +63,9 @@
- type: Tag
tags:
- BypassInteractionRangeChecks
- type: PointLight
radius: 6
enabled: false
# proto for player ghosts specifically
- type: entity
@@ -85,8 +88,8 @@
- type: entity
id: ActionToggleLighting
name: Toggle All Lighting
description: Toggle all light rendering to better observe dark areas.
name: Toggle Lighting
description: Toggle light rendering to better observe dark areas.
components:
- type: InstantAction
icon: Interface/VerbIcons/light.svg.192dpi.png