Fix chameleon backpacks not being able to be opened when locked (#39784)
* Fix chameleon backpacks not being able to be opened when locked * rename --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -48,11 +48,12 @@ public sealed class LockSystem : EntitySystem
|
|||||||
SubscribeLocalEvent<LockComponent, GotEmaggedEvent>(OnEmagged);
|
SubscribeLocalEvent<LockComponent, GotEmaggedEvent>(OnEmagged);
|
||||||
SubscribeLocalEvent<LockComponent, LockDoAfter>(OnDoAfterLock);
|
SubscribeLocalEvent<LockComponent, LockDoAfter>(OnDoAfterLock);
|
||||||
SubscribeLocalEvent<LockComponent, UnlockDoAfter>(OnDoAfterUnlock);
|
SubscribeLocalEvent<LockComponent, UnlockDoAfter>(OnDoAfterUnlock);
|
||||||
SubscribeLocalEvent<LockComponent, StorageInteractAttemptEvent>(OnStorageInteractAttempt);
|
|
||||||
|
|
||||||
SubscribeLocalEvent<LockedWiresPanelComponent, LockToggleAttemptEvent>(OnLockToggleAttempt);
|
SubscribeLocalEvent<LockedWiresPanelComponent, LockToggleAttemptEvent>(OnLockToggleAttempt);
|
||||||
SubscribeLocalEvent<LockedWiresPanelComponent, AttemptChangePanelEvent>(OnAttemptChangePanel);
|
SubscribeLocalEvent<LockedWiresPanelComponent, AttemptChangePanelEvent>(OnAttemptChangePanel);
|
||||||
SubscribeLocalEvent<LockedAnchorableComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
|
SubscribeLocalEvent<LockedAnchorableComponent, UnanchorAttemptEvent>(OnUnanchorAttempt);
|
||||||
|
SubscribeLocalEvent<LockedStorageComponent, StorageInteractAttemptEvent>(OnStorageInteractAttempt);
|
||||||
|
|
||||||
SubscribeLocalEvent<UIRequiresLockComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
|
SubscribeLocalEvent<UIRequiresLockComponent, ActivatableUIOpenAttemptEvent>(OnUIOpenAttempt);
|
||||||
SubscribeLocalEvent<UIRequiresLockComponent, LockToggledEvent>(LockToggled);
|
SubscribeLocalEvent<UIRequiresLockComponent, LockToggledEvent>(LockToggled);
|
||||||
@@ -358,9 +359,9 @@ public sealed class LockSystem : EntitySystem
|
|||||||
TryUnlock(uid, args.User, skipDoAfter: true);
|
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;
|
args.Cancelled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
10
Content.Shared/Lock/LockedStorageComponent.cs
Normal file
10
Content.Shared/Lock/LockedStorageComponent.cs
Normal file
@@ -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;
|
||||||
@@ -138,6 +138,7 @@
|
|||||||
- type: AccessReader
|
- type: AccessReader
|
||||||
access: [["Research"], ["Cargo"]]
|
access: [["Research"], ["Cargo"]]
|
||||||
- type: Lock
|
- type: Lock
|
||||||
|
- type: LockedStorage
|
||||||
- type: SuppressArtifactContainer
|
- type: SuppressArtifactContainer
|
||||||
- type: RadiationBlockingContainer
|
- type: RadiationBlockingContainer
|
||||||
resistance: 5
|
resistance: 5
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
description: It looks as strong as reality itself.
|
description: It looks as strong as reality itself.
|
||||||
components:
|
components:
|
||||||
- type: Lock
|
- type: Lock
|
||||||
|
- type: LockedStorage
|
||||||
- type: LockVisuals
|
- type: LockVisuals
|
||||||
- type: Sprite
|
- type: Sprite
|
||||||
sprite: Structures/Storage/Shelfs/wood.rsi
|
sprite: Structures/Storage/Shelfs/wood.rsi
|
||||||
|
|||||||
Reference in New Issue
Block a user