This commit is contained in:
Rane
2022-02-17 21:43:24 -05:00
committed by GitHub
parent 94c56980cb
commit 8049a709e6
29 changed files with 323 additions and 8 deletions

View File

@@ -1,6 +1,8 @@
using Content.Server.Access.Components;
using Content.Server.Access.Systems;
using Content.Server.Storage.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.Emag.Components;
using Content.Shared.Access.Components;
using Content.Shared.Access.Systems;
using Content.Shared.Examine;
@@ -33,6 +35,7 @@ namespace Content.Server.Lock
SubscribeLocalEvent<LockComponent, ActivateInWorldEvent>(OnActivated);
SubscribeLocalEvent<LockComponent, ExaminedEvent>(OnExamined);
SubscribeLocalEvent<LockComponent, GetVerbsEvent<AlternativeVerb>>(AddToggleLockVerb);
SubscribeLocalEvent<LockComponent, GotEmaggedEvent>(OnEmagged);
}
private void OnStartup(EntityUid uid, LockComponent lockComp, ComponentStartup args)
@@ -182,5 +185,23 @@ namespace Content.Server.Lock
// TODO VERB ICONS need padlock open/close icons.
args.Verbs.Add(verb);
}
private void OnEmagged(EntityUid uid, LockComponent component, GotEmaggedEvent args)
{
if (component.Locked == true)
{
if (component.UnlockSound != null)
{
SoundSystem.Play(Filter.Pvs(component.Owner), component.UnlockSound.GetSound(), component.Owner, AudioParams.Default.WithVolume(-5));
}
if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearanceComp))
{
appearanceComp.SetData(StorageVisuals.Locked, false);
}
EntityManager.RemoveComponent<LockComponent>(uid); //Literally destroys the lock as a tell it was emagged
args.Handled = true;
}
}
}
}