]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix chameleon backpacks not being able to be opened when locked (#39784)
authorbeck-thompson <107373427+beck-thompson@users.noreply.github.com>
Tue, 26 Aug 2025 21:50:19 +0000 (14:50 -0700)
committerGitHub <noreply@github.com>
Tue, 26 Aug 2025 21:50:19 +0000 (23:50 +0200)
* Fix chameleon backpacks not being able to be opened when locked

* rename

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Shared/Lock/LockSystem.cs
Content.Shared/Lock/LockedStorageComponent.cs [new file with mode: 0644]
Resources/Prototypes/Entities/Objects/Specific/Xenoarchaeology/artifact_equipment.yml
Resources/Prototypes/Entities/Structures/Wallmounts/Storage/shelfs.yml

index 65ac04874ad47cdb86df7f0e9fae30c86296d762..2abb45d8788f3c99c1afa8cec99bf6d6e0b2ff80 100644 (file)
@@ -48,11 +48,12 @@ public sealed class LockSystem : EntitySystem
         SubscribeLocalEvent<LockComponent, GotEmaggedEvent>(OnEmagged);
         SubscribeLocalEvent<LockComponent, LockDoAfter>(OnDoAfterLock);
         SubscribeLocalEvent<LockComponent, UnlockDoAfter>(OnDoAfterUnlock);
-        SubscribeLocalEvent<LockComponent, StorageInteractAttemptEvent>(OnStorageInteractAttempt);
+
 
         SubscribeLocalEvent<LockedWiresPanelComponent, LockToggleAttemptEvent>(OnLockToggleAttempt);
         SubscribeLocalEvent<LockedWiresPanelComponent, AttemptChangePanelEvent>(OnAttemptChangePanel);
         SubscribeLocalEvent<LockedAnchorableComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
+        SubscribeLocalEvent<LockedStorageComponent, StorageInteractAttemptEvent>(OnStorageInteractAttempt);
 
         SubscribeLocalEvent<UIRequiresLockComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
         SubscribeLocalEvent<UIRequiresLockComponent, LockToggledEvent>(LockToggled);
@@ -358,9 +359,9 @@ public sealed class LockSystem : EntitySystem
         TryUnlock(uid, args.User, skipDoAfter: true);
     }
 
-    private void OnStorageInteractAttempt(Entity<LockComponent> ent, ref StorageInteractAttemptEvent args)
+    private void OnStorageInteractAttempt(Entity<LockedStorageComponent> 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 (file)
index 0000000..25d6dba
--- /dev/null
@@ -0,0 +1,10 @@
+using Content.Shared.Storage;
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Lock;
+
+/// <summary>
+/// Prevents using an entity's <see cref="StorageComponent"/> if its <see cref="LockComponent"/> is locked.
+/// </summary>
+[RegisterComponent, NetworkedComponent]
+public sealed partial class LockedStorageComponent : Component;
index bdd042df57b54894e70d1d592bcab1e9e921d931..8352933f8bd0026ec609a8c99bdac61f3cd0ab7b 100644 (file)
   - type: AccessReader
     access: [["Research"], ["Cargo"]]
   - type: Lock
+  - type: LockedStorage
   - type: SuppressArtifactContainer
   - type: RadiationBlockingContainer
     resistance: 5
index aeceba8f2e8b82ffda70d52317791b9c4a44ad79..dd3e7dd0a484596f2d12a6dbe4d592d3bf449f70 100644 (file)
@@ -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