SignalSwitchSystem: Check button is locked before toggling (#38474)

Check button is locked before toggling
This commit is contained in:
Whatstone
2025-06-21 05:41:04 -04:00
committed by GitHub
parent 27a4c1955c
commit 54cb731147

View File

@@ -1,6 +1,7 @@
using Content.Server.DeviceLinking.Components;
using Content.Server.DeviceNetwork;
using Content.Shared.Interaction;
using Content.Shared.Lock;
using Robust.Shared.Audio;
using Robust.Shared.Audio.Systems;
@@ -10,6 +11,7 @@ public sealed class SignalSwitchSystem : EntitySystem
{
[Dependency] private readonly DeviceLinkSystem _deviceLink = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly LockSystem _lock = default!;
public override void Initialize()
{
@@ -29,6 +31,9 @@ public sealed class SignalSwitchSystem : EntitySystem
if (args.Handled || !args.Complex)
return;
if (_lock.IsLocked(uid))
return;
comp.State = !comp.State;
_deviceLink.InvokePort(uid, comp.State ? comp.OnPort : comp.OffPort);