]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Turn off PointLights on VendingMachines when broken or off. (#33513)
authorNiels Huylebroeck <red15@users.noreply.github.com>
Mon, 25 Nov 2024 12:35:14 +0000 (13:35 +0100)
committerGitHub <noreply@github.com>
Mon, 25 Nov 2024 12:35:14 +0000 (13:35 +0100)
The light itself should already turn off due to `LitOnPowered`
component, but the broken state of a VendingMachine did not.

Fixes  #33382

Content.Server/VendingMachines/VendingMachineSystem.cs

index 90fe4cb7d8ae7ba53d09b8053f3b48b59c473f19..c20a6a46446c46329103893818bf4c01710ed320 100644 (file)
@@ -38,6 +38,7 @@ namespace Content.Server.VendingMachines
         [Dependency] private readonly ThrowingSystem _throwingSystem = default!;
         [Dependency] private readonly IGameTiming _timing = default!;
         [Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!;
+        [Dependency] private readonly SharedPointLightSystem _light = default!;
 
         private const float WallVendEjectDistanceFromWall = 1f;
 
@@ -334,6 +335,12 @@ namespace Content.Server.VendingMachines
                 finalState = VendingMachineVisualState.Off;
             }
 
+            if (_light.TryGetLight(uid, out var pointlight))
+            {
+                var lightState = finalState != VendingMachineVisualState.Broken && finalState != VendingMachineVisualState.Off;
+                _light.SetEnabled(uid, lightState, pointlight);
+            }
+
             _appearanceSystem.SetData(uid, VendingMachineVisuals.VisualState, finalState);
         }