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-12-23 23:55:31 -05:00
|
|
|
[RegisterComponent, NetworkedComponent]
|
|
|
|
|
public sealed class BuckleComponent : Component
|
2022-11-14 20:30:30 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
2022-12-23 23:55:31 -05:00
|
|
|
/// The range from which this entity can buckle to a <see cref="StrapComponent"/>.
|
2022-11-14 20:30:30 +01:00
|
|
|
/// </summary>
|
|
|
|
|
[DataField("range")]
|
2022-12-23 23:55:31 -05:00
|
|
|
public float Range = 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; }
|
2022-12-23 23:55:31 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The amount of time that must pass for this entity to
|
|
|
|
|
/// be able to unbuckle after recently buckling.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("delay")]
|
|
|
|
|
public TimeSpan UnbuckleDelay = TimeSpan.FromSeconds(0.25f);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The time that this entity buckled at.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables] public TimeSpan BuckleTime;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The strap that this component is buckled to.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables]
|
|
|
|
|
public StrapComponent? BuckledTo { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The amount of space that this entity occupies in a
|
|
|
|
|
/// <see cref="StrapComponent"/>.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField("size")]
|
|
|
|
|
public int Size = 100;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Used for client rendering
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int? OriginalDrawDepth { get; set; }
|
2022-11-14 20:30:30 +01:00
|
|
|
}
|
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
|
|
|
}
|