Security barriers take 5 seconds to (un)lock (#24637)

People are using these as unhackable and hard-to-tailgate airlocks into sec. They should not be trivial for security officers to move through.

Made LockComponent have configurable lock times to implement this.
This commit is contained in:
Pieter-Jan Briers
2024-01-28 01:28:02 +01:00
committed by GitHub
parent 3e3cb10a96
commit 8ca7cb59a3
3 changed files with 104 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
using Content.Shared.DoAfter;
using Robust.Shared.Audio;
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
@@ -50,6 +51,26 @@ public sealed partial class LockComponent : Component
[DataField("breakOnEmag")]
[AutoNetworkedField]
public bool BreakOnEmag = true;
/// <summary>
/// Amount of do-after time needed to lock the entity.
/// </summary>
/// <remarks>
/// If set to zero, no do-after will be used.
/// </remarks>
[DataField]
[AutoNetworkedField]
public TimeSpan LockTime;
/// <summary>
/// Amount of do-after time needed to unlock the entity.
/// </summary>
/// <remarks>
/// If set to zero, no do-after will be used.
/// </remarks>
[DataField]
[AutoNetworkedField]
public TimeSpan UnlockTime;
}
/// <summary>
@@ -64,3 +85,31 @@ public record struct LockToggleAttemptEvent(EntityUid User, bool Silent = false,
/// </summary>
[ByRefEvent]
public readonly record struct LockToggledEvent(bool Locked);
/// <summary>
/// Used to lock a lockable entity that has a lock time configured.
/// </summary>
/// <seealso cref="LockComponent"/>
/// <seealso cref="LockSystem"/>
[Serializable, NetSerializable]
public sealed partial class LockDoAfter : DoAfterEvent
{
public override DoAfterEvent Clone()
{
return this;
}
}
/// <summary>
/// Used to unlock a lockable entity that has an unlock time configured.
/// </summary>
/// <seealso cref="LockComponent"/>
/// <seealso cref="LockSystem"/>
[Serializable, NetSerializable]
public sealed partial class UnlockDoAfter : DoAfterEvent
{
public override DoAfterEvent Clone()
{
return this;
}
}