From 370a79fbc847c75aca4d733e1cac2bb56a19776b Mon Sep 17 00:00:00 2001 From: exincore Date: Wed, 6 Mar 2024 11:23:16 -0600 Subject: [PATCH] fix(emag): Emagging a lock properly unlocks the component (#25858) * fix(emag): Emagging a lock properly unlocks the component Fixes #24860 * fix(emag): Emagging a lock no longer duplicates the unlock sound --- Content.Shared/Lock/LockSystem.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Lock/LockSystem.cs b/Content.Shared/Lock/LockSystem.cs index a01c5ace4d..53c199e410 100644 --- a/Content.Shared/Lock/LockSystem.cs +++ b/Content.Shared/Lock/LockSystem.cs @@ -246,8 +246,16 @@ public sealed class LockSystem : EntitySystem { if (!component.Locked || !component.BreakOnEmag) return; - _audio.PlayPredicted(component.UnlockSound, uid, null); + + _audio.PlayPredicted(component.UnlockSound, uid, args.UserUid); + + component.Locked = false; _appearanceSystem.SetData(uid, LockVisuals.Locked, false); + Dirty(uid, component); + + var ev = new LockToggledEvent(false); + RaiseLocalEvent(uid, ref ev, true); + RemComp(uid); //Literally destroys the lock as a tell it was emagged args.Handled = true; } -- 2.51.2