Event based lock access (#40883)

* init

* some bonus stuff

* CheckForAnyReaders

* reader

* doc

* review

* fuck yaml

* Me when I push changes myshelf

---------

Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
This commit is contained in:
ScarKy0
2025-10-17 04:04:43 +02:00
committed by GitHub
parent 853bb1d3c0
commit ee33792b33
7 changed files with 195 additions and 36 deletions

View File

@@ -1,4 +1,3 @@
using Content.Shared.Access.Components;
using Content.Shared.DoAfter;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
@@ -47,11 +46,37 @@ public sealed partial class LockComponent : Component
public bool UnlockOnClick = true;
/// <summary>
/// Whether the lock requires access validation through <see cref="AccessReaderComponent"/>
/// Whether or not the lock is locked when used it hand.
/// </summary>
[DataField, AutoNetworkedField]
public bool LockInHand;
/// <summary>
/// Whether or not the lock is unlocked when used in hand.
/// </summary>
[DataField, AutoNetworkedField]
public bool UnlockInHand;
/// <summary>
/// Whether access requirements should be checked for this lock.
/// </summary>
[DataField, AutoNetworkedField]
public bool UseAccess = true;
/// <summary>
/// What readers should be checked to determine if an entity has access.
/// If null, all possible readers are checked.
/// </summary>
[DataField, AutoNetworkedField]
public LockTypes? CheckedLocks;
/// <summary>
/// Whether any reader needs to be accessed to operate this lock.
/// By default, all readers need to be able to be accessed.
/// </summary>
[DataField, AutoNetworkedField]
public bool CheckForAnyReaders;
/// <summary>
/// The sound played when unlocked.
/// </summary>
@@ -96,6 +121,12 @@ public sealed partial class LockComponent : Component
[DataField]
[AutoNetworkedField]
public TimeSpan UnlockTime;
/// <summary>
/// Whether this lock can be locked again after being unlocked.
/// </summary>
[DataField, AutoNetworkedField]
public bool AllowRepeatedLocking = true;
}
/// <summary>