Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Conserta o painel de chaves encriptadas aparecendo enquando o painel …
Browse files Browse the repository at this point in the history
…está fechado
  • Loading branch information
Day-OS committed Apr 20, 2024
1 parent d538fd2 commit 33ed0b4
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Content.Server.SimpleStation14.EncryptionHolderRequiresLock;

[RegisterComponent]
public sealed partial class EncryptionHolderRequiresLockComponent : Component
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Lock;
using Content.Shared.Radio.Components;
using Content.Shared.Radio.EntitySystems;

namespace Content.Server.SimpleStation14.EncryptionHolderRequiresLock;

public sealed class EncryptionHolderRequiresLockSystem : EntitySystem

{
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public sealed partial class EncryptionKeyHolderComponent : Component
public Container KeyContainer = default!;
public const string KeyContainerName = "key_slots";

// Parkstation-IPC-Start
// IPC-Start
/// <summary>
/// Whether or not the headset can be examined to see the encryption keys while the keys aren't accessible.
/// </summary>
[ViewVariables(VVAccess.ReadWrite)]
[DataField("examineWhileLocked")]
public bool ExamineWhileLocked = true;
// Parkstation-IPC-End
// IPC-End

/// <summary>
/// Combined set of radio channels provided by all contained keys.
Expand Down
4 changes: 2 additions & 2 deletions Content.Shared/Radio/EntitySystems/EncryptionKeySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,13 @@ private void OnHolderExamined(EntityUid uid, EncryptionKeyHolderComponent compon
if (!args.IsInDetailsRange)
return;

// Parkstation-IPC-Start
// IPC-Start
if (!component.ExamineWhileLocked && !component.KeysUnlocked)
return;

if (!component.ExamineWhileLocked && TryComp<WiresPanelComponent>(uid, out var panel) && !panel.Open)
return;
// Parkstation-IPC-End
// IPC-End

if (component.KeyContainer.ContainedEntities.Count == 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
startingItem: PowerCellMedium
- type: BatterySlotRequiresLock
cellSlotId: cell_slot
- type: EncryptionHolderRequiresLock
- type: SiliconEmitSoundOnDrained
sound: "/Audio/Weapons/Guns/EmptyAlarm/smg_empty_alarm.ogg"
minInterval: 15
Expand Down Expand Up @@ -86,6 +87,7 @@
keySlots: 3
examineWhileLocked: false
keysExtractionMethod: Cutting
keysUnlocked: false
- type: ActiveRadio
- type: IntrinsicRadioReceiver
- type: IntrinsicRadioTransmitter
Expand Down

0 comments on commit 33ed0b4

Please sign in to comment.