Skip to content

Commit

Permalink
Turn off PointLights on VendingMachines when broken or off. (space-wi…
Browse files Browse the repository at this point in the history
…zards#33513)

The light itself should already turn off due to `LitOnPowered`
component, but the broken state of a VendingMachine did not.

Fixes  space-wizards#33382
  • Loading branch information
red15 authored and Doctor-Cpu committed Jan 2, 2025
1 parent d684916 commit d156970
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Content.Server/VendingMachines/VendingMachineSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit d156970

Please sign in to comment.