From d15697091ceffbcc60f423339b071451c18a0697 Mon Sep 17 00:00:00 2001 From: Niels Huylebroeck Date: Mon, 25 Nov 2024 13:35:14 +0100 Subject: [PATCH] Turn off PointLights on VendingMachines when broken or off. (#33513) 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Content.Server/VendingMachines/VendingMachineSystem.cs b/Content.Server/VendingMachines/VendingMachineSystem.cs index 90fe4cb7d8ae..c20a6a46446c 100644 --- a/Content.Server/VendingMachines/VendingMachineSystem.cs +++ b/Content.Server/VendingMachines/VendingMachineSystem.cs @@ -38,6 +38,7 @@ public sealed class VendingMachineSystem : SharedVendingMachineSystem [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 @@ public void TryUpdateVisualState(EntityUid uid, VendingMachineComponent? vendCom 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); }