2025-04-24 17:10:52 +03:00
using Robust.Shared.Audio ;
using Robust.Shared.GameStates ;
2024-04-02 20:59:40 +03:00
using Robust.Shared.Prototypes ;
2024-04-20 11:51:04 +03:00
namespace Content.Shared._CP14.LockKey.Components ;
2024-04-02 20:59:40 +03:00
/// <summary>
/// A component of a lock that stores its keyhole shape, complexity, and current state.
/// </summary>
2025-04-24 17:10:52 +03:00
[RegisterComponent, AutoGenerateComponentState(fieldDeltas: true), NetworkedComponent]
2024-04-20 11:51:04 +03:00
public sealed partial class CP14LockComponent : Component
2024-04-02 20:59:40 +03:00
{
2024-12-03 12:34:07 +03:00
[DataField, AutoNetworkedField]
2024-04-02 20:59:40 +03:00
public List < int > ? LockShape = null ;
/// <summary>
/// On which element of the shape sequence the lock is now located. It's necessary for the mechanics of breaking and entering.
/// </summary>
2025-04-24 17:10:52 +03:00
[DataField, AutoNetworkedField]
2024-10-21 14:20:05 +03:00
public int LockPickStatus = 0 ;
2024-04-02 20:59:40 +03:00
/// <summary>
2025-04-24 17:10:52 +03:00
/// If not null, automatically generates a lock for the specified category on initialization. This ensures that the lock will be opened with a key of the same category.
2024-04-02 20:59:40 +03:00
/// </summary>
[DataField]
2025-04-24 17:10:52 +03:00
public ProtoId < CP14LockTypePrototype > ? AutoGenerateShape = null ;
2024-04-02 20:59:40 +03:00
/// <summary>
2025-04-24 17:10:52 +03:00
/// If not null, the lock will automatically generate a random shape on initialization with selected numbers of elements. Useful for random dungeons doors or chests for example.
2024-04-02 20:59:40 +03:00
/// </summary>
[DataField]
2025-04-24 17:10:52 +03:00
public int? AutoGenerateRandomShape = null ;
/// <summary>
/// This component is used for two types of items: Entities themselves that are locked (doors, chests),
/// and a portable lock item that can be built into other entities. This variable determines whether
/// using this entity on another entity can overwrite the lock properties of the target entity.
/// </summary>
[DataField]
public bool CanEmbedded = false ;
[DataField]
public SoundSpecifier EmbedSound = new SoundPathSpecifier ( "/Audio/_CP14/Items/lockpick_use.ogg" )
{
Params = AudioParams . Default
. WithVariation ( 0.05f )
. WithVolume ( 0.5f ) ,
} ;
2024-04-02 20:59:40 +03:00
}