2022-07-29 14:13:12 +12:00
|
|
|
using Robust.Shared.Audio;
|
2021-07-30 19:22:06 +02:00
|
|
|
|
|
|
|
|
namespace Content.Server.Storage.Components
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Allows locking/unlocking, with access determined by AccessReader
|
|
|
|
|
/// </summary>
|
|
|
|
|
[RegisterComponent]
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class LockComponent : Component
|
2021-07-30 19:22:06 +02:00
|
|
|
{
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("locked")] public bool Locked { get; set; } = true;
|
2021-08-22 19:32:24 +03:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("lockOnClick")] public bool LockOnClick { get; set; } = false;
|
2021-07-31 19:52:33 +02:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("unlockingSound")] public SoundSpecifier UnlockSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/door_lock_off.ogg");
|
2022-03-23 05:34:09 +03:00
|
|
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("lockingSound")] public SoundSpecifier LockSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/door_lock_on.ogg");
|
2021-07-30 19:22:06 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-12-06 16:59:59 -06:00
|
|
|
[ByRefEvent]
|
|
|
|
|
public struct LockToggleAttemptEvent
|
|
|
|
|
{
|
|
|
|
|
public bool Silent = false;
|
|
|
|
|
public bool Cancelled = false;
|
|
|
|
|
public EntityUid User;
|
|
|
|
|
|
|
|
|
|
public LockToggleAttemptEvent(EntityUid user, bool silent = false)
|
|
|
|
|
{
|
|
|
|
|
User = user;
|
|
|
|
|
Silent = silent;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public sealed class LockToggleAttemptArgs : EventArgs { }
|