2022-12-23 23:55:31 -05:00
|
|
|
using Robust.Shared.Containers;
|
2022-10-16 06:00:04 +13:00
|
|
|
using Robust.Shared.GameStates;
|
|
|
|
|
using Robust.Shared.Serialization;
|
|
|
|
|
|
|
|
|
|
namespace Content.Shared.Ensnaring.Components;
|
2022-08-24 10:50:31 -04:00
|
|
|
/// <summary>
|
2022-12-23 23:55:31 -05:00
|
|
|
/// Use this on an entity that you would like to be ensnared by anything that has the <see cref="EnsnaringComponent"/>
|
2022-08-24 10:50:31 -04:00
|
|
|
/// </summary>
|
2022-12-23 23:55:31 -05:00
|
|
|
[RegisterComponent, NetworkedComponent]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class EnsnareableComponent : Component
|
2022-08-24 10:50:31 -04:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How much should this slow down the entities walk?
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("walkSpeed")]
|
|
|
|
|
public float WalkSpeed = 1.0f;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// How much should this slow down the entities sprint?
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("sprintSpeed")]
|
|
|
|
|
public float SprintSpeed = 1.0f;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Is this entity currently ensnared?
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ViewVariables(VVAccess.ReadWrite)]
|
|
|
|
|
[DataField("isEnsnared")]
|
|
|
|
|
public bool IsEnsnared;
|
2022-12-23 23:55:31 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The container where the <see cref="EnsnaringComponent"/> entity will be stored
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Container Container = default!;
|
|
|
|
|
|
|
|
|
|
[DataField("sprite")]
|
|
|
|
|
public string? Sprite;
|
|
|
|
|
|
|
|
|
|
[DataField("state")]
|
|
|
|
|
public string? State;
|
2022-08-24 10:50:31 -04:00
|
|
|
}
|
|
|
|
|
|
2022-10-16 06:00:04 +13:00
|
|
|
[Serializable, NetSerializable]
|
|
|
|
|
public sealed class EnsnareableComponentState : ComponentState
|
|
|
|
|
{
|
|
|
|
|
public readonly bool IsEnsnared;
|
|
|
|
|
|
|
|
|
|
public EnsnareableComponentState(bool isEnsnared)
|
|
|
|
|
{
|
|
|
|
|
IsEnsnared = isEnsnared;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-24 10:50:31 -04:00
|
|
|
public sealed class EnsnaredChangedEvent : EntityEventArgs
|
|
|
|
|
{
|
|
|
|
|
public readonly bool IsEnsnared;
|
|
|
|
|
|
|
|
|
|
public EnsnaredChangedEvent(bool isEnsnared)
|
|
|
|
|
{
|
|
|
|
|
IsEnsnared = isEnsnared;
|
|
|
|
|
}
|
|
|
|
|
}
|