]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix(emag): Emagging a lock properly unlocks the component (#25858)
authorexincore <me@exin.xyz>
Wed, 6 Mar 2024 17:23:16 +0000 (11:23 -0600)
committerGitHub <noreply@github.com>
Wed, 6 Mar 2024 17:23:16 +0000 (18:23 +0100)
* 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

index a01c5ace4d4dffbae3fe554d355b67622fdc406f..53c199e4108626c39224e96e3fced5a8da6768df 100644 (file)
@@ -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<LockComponent>(uid); //Literally destroys the lock as a tell it was emagged
         args.Handled = true;
     }