2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Interaction;
|
2021-07-12 01:32:10 -07:00
|
|
|
using Robust.Shared.GameStates;
|
2020-06-25 15:52:24 +02:00
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
2022-11-14 20:30:30 +01:00
|
|
|
namespace Content.Shared.Buckle.Components;
|
2020-10-14 15:24:07 +02:00
|
|
|
|
2022-11-14 20:30:30 +01:00
|
|
|
[NetworkedComponent]
|
|
|
|
|
[Access(typeof(SharedBuckleSystem))]
|
|
|
|
|
public abstract class SharedBuckleComponent : Component
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The range from which this entity can buckle to a <see cref="SharedStrapComponent"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("range")]
|
|
|
|
|
public float Range { get; protected set; } = SharedInteractionSystem.InteractionRange / 1.4f;
|
2022-10-16 17:38:04 +11:00
|
|
|
|
2022-11-14 20:30:30 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// True if the entity is buckled, false otherwise.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Buckled { get; set; }
|
2022-10-16 17:38:04 +11:00
|
|
|
|
2022-11-14 20:30:30 +01:00
|
|
|
public EntityUid? LastEntityBuckledTo { get; set; }
|
2022-07-16 13:51:52 +10:00
|
|
|
|
2022-11-14 20:30:30 +01:00
|
|
|
public bool DontCollide { get; set; }
|
|
|
|
|
}
|
2020-07-02 23:36:06 +02:00
|
|
|
|
2022-11-14 20:30:30 +01:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class BuckleComponentState : ComponentState
|
|
|
|
|
{
|
|
|
|
|
public BuckleComponentState(bool buckled, EntityUid? lastEntityBuckledTo, bool dontCollide)
|
2020-07-17 10:43:10 +02:00
|
|
|
{
|
2022-11-14 20:30:30 +01:00
|
|
|
Buckled = buckled;
|
|
|
|
|
LastEntityBuckledTo = lastEntityBuckledTo;
|
|
|
|
|
DontCollide = dontCollide;
|
2020-07-17 10:43:10 +02:00
|
|
|
}
|
|
|
|
|
|
2022-11-14 20:30:30 +01:00
|
|
|
public bool Buckled { get; }
|
|
|
|
|
public EntityUid? LastEntityBuckledTo { get; }
|
|
|
|
|
public bool DontCollide { get; }
|
|
|
|
|
}
|
2022-04-15 18:53:52 -04:00
|
|
|
|
2022-11-14 20:30:30 +01:00
|
|
|
public sealed class BuckleChangeEvent : EntityEventArgs
|
|
|
|
|
{
|
|
|
|
|
public EntityUid Strap;
|
2020-07-26 12:12:53 +02:00
|
|
|
|
2022-11-14 20:30:30 +01:00
|
|
|
public EntityUid BuckledEntity;
|
|
|
|
|
public bool Buckling;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public enum BuckleVisuals
|
|
|
|
|
{
|
|
|
|
|
Buckled
|
2020-06-25 15:52:24 +02:00
|
|
|
}
|