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

(cherry picked from commit 370a79fbc847c75aca4d733e1cac2bb56a19776b)
This commit is contained in:
exincore 2024-03-06 11:23:16 -06:00 committed by Debug
parent 2062e6dfde
commit d4d8898496
No known key found for this signature in database
GPG Key ID: 271270A74EF9C350
1 changed files with 9 additions and 1 deletions

View 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;
}