2023-07-08 14:08:32 +10:00
|
|
|
using System.Numerics;
|
2022-12-23 23:55:31 -05:00
|
|
|
using Content.Shared.Alert;
|
2023-05-01 03:04:23 -04:00
|
|
|
using Content.Shared.Whitelist;
|
2022-12-23 23:55:31 -05:00
|
|
|
using Robust.Shared.Audio;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2024-05-23 22:43:04 -04:00
|
|
|
using Robust.Shared.Prototypes;
|
2020-06-25 15:52:24 +02:00
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
2022-11-18 22:08:28 +01:00
|
|
|
namespace Content.Shared.Buckle.Components;
|
2022-07-16 13:51:52 +10:00
|
|
|
|
2023-09-28 16:20:29 -07:00
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
2024-02-01 11:33:10 +11:00
|
|
|
[Access(typeof(SharedBuckleSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class StrapComponent : Component
|
2022-11-18 22:08:28 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2024-06-20 03:14:18 +12:00
|
|
|
/// The entities that are currently buckled to this strap.
|
2022-11-18 22:08:28 +01:00
|
|
|
/// </summary>
|
2024-09-22 18:21:40 +10:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-09-28 16:20:29 -07:00
|
|
|
public HashSet<EntityUid> BuckledEntities = new();
|
2022-11-18 22:08:28 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-05-01 03:04:23 -04:00
|
|
|
/// Entities that this strap accepts and can buckle
|
|
|
|
|
/// If null it accepts any entity
|
2022-11-18 22:08:28 +01:00
|
|
|
/// </summary>
|
2024-06-20 03:14:18 +12:00
|
|
|
[DataField]
|
2024-03-31 04:21:18 +01:00
|
|
|
public EntityWhitelist? Whitelist;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Entities that this strap does not accept and cannot buckle.
|
|
|
|
|
/// </summary>
|
2024-06-20 03:14:18 +12:00
|
|
|
[DataField]
|
2024-03-31 04:21:18 +01:00
|
|
|
public EntityWhitelist? Blacklist;
|
2022-11-18 22:08:28 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The change in position to the strapped mob
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-05-01 03:04:23 -04:00
|
|
|
public StrapPosition Position = StrapPosition.None;
|
2022-11-18 22:08:28 +01:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The buckled entity will be offset by this amount from the center of the strap object.
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public Vector2 BuckleOffset = Vector2.Zero;
|
2022-12-23 23:55:31 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
2024-01-30 18:23:30 -05:00
|
|
|
/// The angle to rotate the player by when they get strapped
|
2022-12-23 23:55:31 -05:00
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
2024-01-30 18:23:30 -05:00
|
|
|
public Angle Rotation;
|
2022-12-23 23:55:31 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The size of the strap which is compared against when buckling entities
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
2023-05-01 03:04:23 -04:00
|
|
|
public int Size = 100;
|
2022-12-23 23:55:31 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// If disabled, nothing can be buckled on this object, and it will unbuckle anything that's already buckled
|
|
|
|
|
/// </summary>
|
2024-06-20 03:14:18 +12:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-05-01 03:04:23 -04:00
|
|
|
public bool Enabled = true;
|
2022-12-23 23:55:31 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The sound to be played when a mob is buckled
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
2023-05-01 03:04:23 -04:00
|
|
|
public SoundSpecifier BuckleSound = new SoundPathSpecifier("/Audio/Effects/buckle.ogg");
|
2022-12-23 23:55:31 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The sound to be played when a mob is unbuckled
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
2023-05-01 03:04:23 -04:00
|
|
|
public SoundSpecifier UnbuckleSound = new SoundPathSpecifier("/Audio/Effects/unbuckle.ogg");
|
2022-12-23 23:55:31 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ID of the alert to show when buckled
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
2024-05-23 22:43:04 -04:00
|
|
|
public ProtoId<AlertPrototype> BuckledAlertType = "Buckled";
|
2024-08-09 08:43:02 -07:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How long it takes to buckle someone else into a chair
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public float BuckleDoafterTime = 2f;
|
2024-08-25 10:09:51 -07:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether InteractHand will buckle the user to the strap.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public bool BuckleOnInteractHand = true;
|
2022-11-18 22:08:28 +01:00
|
|
|
}
|
2021-01-11 22:14:01 +11:00
|
|
|
|
2023-05-01 03:04:23 -04:00
|
|
|
public enum StrapPosition
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// (Default) Makes no change to the buckled mob
|
|
|
|
|
/// </summary>
|
|
|
|
|
None = 0,
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Makes the mob stand up
|
|
|
|
|
/// </summary>
|
|
|
|
|
Stand,
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Makes the mob lie down
|
|
|
|
|
/// </summary>
|
|
|
|
|
Down
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-18 22:08:28 +01:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum StrapVisuals : byte
|
|
|
|
|
{
|
|
|
|
|
RotationAngle,
|
|
|
|
|
State
|
2020-06-25 15:52:24 +02:00
|
|
|
}
|