diff --git a/Content.Shared/Lock/LockSystem.cs b/Content.Shared/Lock/LockSystem.cs index 65ac04874a..2abb45d878 100644 --- a/Content.Shared/Lock/LockSystem.cs +++ b/Content.Shared/Lock/LockSystem.cs @@ -48,11 +48,12 @@ public sealed class LockSystem : EntitySystem SubscribeLocalEvent(OnEmagged); SubscribeLocalEvent(OnDoAfterLock); SubscribeLocalEvent(OnDoAfterUnlock); - SubscribeLocalEvent(OnStorageInteractAttempt); + SubscribeLocalEvent(OnLockToggleAttempt); SubscribeLocalEvent(OnAttemptChangePanel); SubscribeLocalEvent(OnUnanchorAttempt); + SubscribeLocalEvent(OnStorageInteractAttempt); SubscribeLocalEvent(OnUIOpenAttempt); SubscribeLocalEvent(LockToggled); @@ -358,9 +359,9 @@ public sealed class LockSystem : EntitySystem TryUnlock(uid, args.User, skipDoAfter: true); } - private void OnStorageInteractAttempt(Entity ent, ref StorageInteractAttemptEvent args) + private void OnStorageInteractAttempt(Entity ent, ref StorageInteractAttemptEvent args) { - if (ent.Comp.Locked) + if (IsLocked(ent.Owner)) args.Cancelled = true; } diff --git a/Content.Shared/Lock/LockedStorageComponent.cs b/Content.Shared/Lock/LockedStorageComponent.cs new file mode 100644 index 0000000000..25d6dba381 --- /dev/null +++ b/Content.Shared/Lock/LockedStorageComponent.cs @@ -0,0 +1,10 @@ +using Content.Shared.Storage; +using Robust.Shared.GameStates; + +namespace Content.Shared.Lock; + +/// +/// Prevents using an entity's if its is locked. +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class LockedStorageComponent : Component; diff --git a/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/artifact_equipment.yml b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/artifact_equipment.yml index bdd042df57..8352933f8b 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/artifact_equipment.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/artifact_equipment.yml @@ -138,6 +138,7 @@ - type: AccessReader access: [["Research"], ["Cargo"]] - type: Lock + - type: LockedStorage - type: SuppressArtifactContainer - type: RadiationBlockingContainer resistance: 5 diff --git a/Resources/Prototypes/Entities/Structures/Wallmounts/Storage/shelfs.yml b/Resources/Prototypes/Entities/Structures/Wallmounts/Storage/shelfs.yml index aeceba8f2e..dd3e7dd0a4 100644 --- a/Resources/Prototypes/Entities/Structures/Wallmounts/Storage/shelfs.yml +++ b/Resources/Prototypes/Entities/Structures/Wallmounts/Storage/shelfs.yml @@ -45,6 +45,7 @@ description: It looks as strong as reality itself. components: - type: Lock + - type: LockedStorage - type: LockVisuals - type: Sprite sprite: Structures/Storage/Shelfs/wood.rsi