mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 05:59:03 +03:00
# Description IPCs were ported from a codebase that didn't necessarily follow all of our repo's coding standards. And while I had done my part to cleanup as much of the system as was practical within the bounds of a Maintainer Review, there were a lot of things that I felt were inappropriate to leave to review, and wished to go over with a fine lense. Thus, here is my Refactor of IPC code. Do not merge this without first testing that nothing was broken. Because I haven't tested it myself yet.
29 lines
934 B
C#
29 lines
934 B
C#
using Content.Shared.Lock;
|
|
using Content.Shared.Radio.Components;
|
|
using Content.Shared.Radio.EntitySystems;
|
|
|
|
namespace Content.Server.Silicon.EncryptionHolderRequiresLock;
|
|
|
|
public sealed class EncryptionHolderRequiresLockSystem : EntitySystem
|
|
|
|
{
|
|
[Dependency] private readonly EncryptionKeySystem _encryptionKeySystem = default!;
|
|
|
|
/// <inheritdoc/>
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
SubscribeLocalEvent<EncryptionHolderRequiresLockComponent, LockToggledEvent>(LockToggled);
|
|
}
|
|
|
|
private void LockToggled(EntityUid uid, EncryptionHolderRequiresLockComponent component, LockToggledEvent args)
|
|
{
|
|
if (!TryComp<LockComponent>(uid, out var lockComp)
|
|
|| !TryComp<EncryptionKeyHolderComponent>(uid, out var keyHolder))
|
|
return;
|
|
|
|
keyHolder.KeysUnlocked = !lockComp.Locked;
|
|
_encryptionKeySystem.UpdateChannels(uid, keyHolder);
|
|
}
|
|
}
|