Skip to content

Commit

Permalink
fix(emag): Emagging a lock properly unlocks the component (space-wiza…
Browse files Browse the repository at this point in the history
…rds#25858)

* fix(emag): Emagging a lock properly unlocks the component

Fixes space-wizards#24860

* fix(emag): Emagging a lock no longer duplicates the unlock sound
  • Loading branch information
exincore authored Mar 6, 2024
1 parent 6da4009 commit 370a79f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Content.Shared/Lock/LockSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,16 @@ private void OnEmagged(EntityUid uid, LockComponent component, ref GotEmaggedEve
{
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;
}
Expand Down

0 comments on commit 370a79f

Please sign in to comment.