Skip to content

Commit 370a79f

Browse files
authored
fix(emag): Emagging a lock properly unlocks the component (space-wizards#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
1 parent 6da4009 commit 370a79f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Content.Shared/Lock/LockSystem.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,16 @@ private void OnEmagged(EntityUid uid, LockComponent component, ref GotEmaggedEve
246246
{
247247
if (!component.Locked || !component.BreakOnEmag)
248248
return;
249-
_audio.PlayPredicted(component.UnlockSound, uid, null);
249+
250+
_audio.PlayPredicted(component.UnlockSound, uid, args.UserUid);
251+
252+
component.Locked = false;
250253
_appearanceSystem.SetData(uid, LockVisuals.Locked, false);
254+
Dirty(uid, component);
255+
256+
var ev = new LockToggledEvent(false);
257+
RaiseLocalEvent(uid, ref ev, true);
258+
251259
RemComp<LockComponent>(uid); //Literally destroys the lock as a tell it was emagged
252260
args.Handled = true;
253261
}

0 commit comments

Comments
 (0)