using System.Threading; using Robust.Shared.GameStates; namespace Content.Shared.Ensnaring.Components; /// /// Use this on something you want to use to ensnare an entity with /// [RegisterComponent, NetworkedComponent] public sealed class EnsnaringComponent : Component { /// /// How long it should take to free someone else. /// [ViewVariables(VVAccess.ReadWrite)] [DataField("freeTime")] public float FreeTime = 3.5f; /// /// How long it should take for an entity to free themselves. /// [ViewVariables(VVAccess.ReadWrite)] [DataField("breakoutTime")] public float BreakoutTime = 30.0f; /// /// How much should this slow down the entities walk? /// [ViewVariables(VVAccess.ReadWrite)] [DataField("walkSpeed")] public float WalkSpeed = 0.9f; /// /// How much should this slow down the entities sprint? /// [ViewVariables(VVAccess.ReadWrite)] [DataField("sprintSpeed")] public float SprintSpeed = 0.9f; /// /// Should this ensnare someone when thrown? /// [ViewVariables(VVAccess.ReadWrite)] [DataField("canThrowTrigger")] public bool CanThrowTrigger; /// /// What is ensnared? /// [ViewVariables(VVAccess.ReadWrite)] [DataField("ensnared")] public EntityUid? Ensnared; /// /// Should movement cancel breaking out? /// [ViewVariables(VVAccess.ReadWrite)] [DataField("canMoveBreakout")] public bool CanMoveBreakout; public CancellationTokenSource? CancelToken; } /// /// Used whenever you want to do something when someone becomes ensnared by the /// public sealed class EnsnareEvent : EntityEventArgs { public readonly float WalkSpeed; public readonly float SprintSpeed; public EnsnareEvent(float walkSpeed, float sprintSpeed) { WalkSpeed = walkSpeed; SprintSpeed = sprintSpeed; } } /// /// Used whenever you want to do something when someone is freed by the /// public sealed class EnsnareRemoveEvent : CancellableEntityEventArgs { } /// /// Used for the do after event to free the entity that owns the /// public sealed class FreeEnsnareDoAfterComplete : EntityEventArgs { public readonly EntityUid EnsnaringEntity; public FreeEnsnareDoAfterComplete(EntityUid ensnaringEntity) { EnsnaringEntity = ensnaringEntity; } } /// /// Used for the do after event when it fails to free the entity that owns the /// public sealed class FreeEnsnareDoAfterCancel : EntityEventArgs { public readonly EntityUid EnsnaringEntity; public FreeEnsnareDoAfterCancel(EntityUid ensnaringEntity) { EnsnaringEntity = ensnaringEntity; } }