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
This commit is contained in:
Niels Huylebroeck
2024-11-25 13:35:14 +01:00
committed by GitHub
parent ae576abe1f
commit 49724a9b9d

View File

@@ -38,6 +38,7 @@ namespace Content.Server.VendingMachines
[Dependency] private readonly ThrowingSystem _throwingSystem = default!; [Dependency] private readonly ThrowingSystem _throwingSystem = default!;
[Dependency] private readonly IGameTiming _timing = default!; [Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!; [Dependency] private readonly SpeakOnUIClosedSystem _speakOnUIClosed = default!;
[Dependency] private readonly SharedPointLightSystem _light = default!;
private const float WallVendEjectDistanceFromWall = 1f; private const float WallVendEjectDistanceFromWall = 1f;
@@ -334,6 +335,12 @@ namespace Content.Server.VendingMachines
finalState = VendingMachineVisualState.Off; 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); _appearanceSystem.SetData(uid, VendingMachineVisuals.VisualState, finalState);
} }