using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared.StepTrigger; [RegisterComponent] [NetworkedComponent] [Access(typeof(StepTriggerSystem))] public sealed class StepTriggerComponent : Component { /// /// List of entities that are currently colliding with the entity. /// [ViewVariables] public readonly HashSet Colliding = new(); /// /// The list of entities that are standing on this entity, /// which shouldn't be able to trigger it again until stepping off. /// [ViewVariables] public readonly HashSet CurrentlySteppedOn = new(); /// /// Whether or not this component will currently try to trigger for entities. /// [DataField("active")] public bool Active { get; set; } = true; /// /// Ratio of shape intersection for a trigger to occur. /// [DataField("intersectRatio")] public float IntersectRatio { get; set; } = 0.3f; /// /// Entities will only be triggered if their speed exceeds this limit. /// [DataField("requiredTriggeredSpeed")] public float RequiredTriggerSpeed { get; set; } = 3.5f; } [RegisterComponent] [Access(typeof(StepTriggerSystem))] public sealed class StepTriggerActiveComponent : Component { } [Serializable, NetSerializable] public sealed class StepTriggerComponentState : ComponentState { public float IntersectRatio { get; } public float RequiredTriggerSpeed { get; } public readonly HashSet CurrentlySteppedOn; public readonly HashSet Colliding; public readonly bool Active; public StepTriggerComponentState(float intersectRatio, HashSet currentlySteppedOn, HashSet colliding, float requiredTriggerSpeed, bool active) { IntersectRatio = intersectRatio; CurrentlySteppedOn = currentlySteppedOn; RequiredTriggerSpeed = requiredTriggerSpeed; Active = active; Colliding = colliding; } }