2023-10-11 10:41:11 +11:00
|
|
|
using System.Numerics;
|
|
|
|
|
using Robust.Shared.GameStates;
|
|
|
|
|
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Climbing.Components;
|
|
|
|
|
|
2024-03-23 15:29:43 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Indicates that this entity is able to be placed on top of surfaces like tables.
|
|
|
|
|
/// Does not by itself allow the entity to carry out the action of climbing, unless
|
|
|
|
|
/// <see cref="CanClimb"/> is true. Use <see cref="CanForceClimb"/> to control whether
|
|
|
|
|
/// the entity can force other entities onto surfaces.
|
|
|
|
|
/// </summary>
|
2024-02-26 04:36:19 +01:00
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState, AutoGenerateComponentPause]
|
2023-10-11 10:41:11 +11:00
|
|
|
public sealed partial class ClimbingComponent : Component
|
|
|
|
|
{
|
2024-03-23 15:29:43 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the owner is able to climb onto things by their own action.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public bool CanClimb = true;
|
|
|
|
|
|
2023-10-11 10:41:11 +11:00
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the owner is climbing on a climbable entity.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[AutoNetworkedField, DataField]
|
|
|
|
|
public bool IsClimbing;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the owner is being moved onto the climbed entity.
|
|
|
|
|
/// </summary>
|
2024-01-01 03:20:02 +01:00
|
|
|
[AutoNetworkedField, DataField(customTypeSerializer: typeof(TimeOffsetSerializer))]
|
2024-02-26 04:36:19 +01:00
|
|
|
[AutoPausedField]
|
2023-10-11 10:41:11 +11:00
|
|
|
public TimeSpan? NextTransition;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Direction to move when transition.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[AutoNetworkedField, DataField]
|
|
|
|
|
public Vector2 Direction;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How fast the entity is moved when climbing.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField]
|
|
|
|
|
public float TransitionRate = 5f;
|
|
|
|
|
|
|
|
|
|
[AutoNetworkedField, DataField]
|
|
|
|
|
public Dictionary<string, int> DisabledFixtureMasks = new();
|
|
|
|
|
}
|