]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add clientside personal pointlight for observers (#33607)
authorWinkarst <74284083+Winkarst-cpu@users.noreply.github.com>
Tue, 4 Feb 2025 23:26:06 +0000 (02:26 +0300)
committerGitHub <noreply@github.com>
Tue, 4 Feb 2025 23:26:06 +0000 (00:26 +0100)
* 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>
Content.Client/Ghost/GhostSystem.cs
Resources/Locale/en-US/ghost/ghost-gui.ftl
Resources/Prototypes/Entities/Mobs/Player/observer.yml

index f4f7e3459fb9810418bc9ba9c7da89e97f952724..8e977b418b081f502da535fcd1e843839c032ff3 100644 (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;
         }
 
index 7d3939abb13e696e4f6b7ce13c078f762348facd..02beef12db9fe6608be4d1e644b48a69ee1c4787 100644 (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.
index 32a481491ce5e18d6d1f3580eed2bd6dc3f1e9cc..351fab6efea05a7d1c85789a42566b03fbe4b0a0 100644 (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