using Content.Shared.StepTrigger.Systems; using Content.Shared.Whitelist; using Robust.Shared.GameStates; using Robust.Shared.Serialization; namespace Content.Shared.StepTrigger.Components; [RegisterComponent] [NetworkedComponent] [Access(typeof(StepTriggerSystem))] public sealed partial 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 = true; /// /// Ratio of shape intersection for a trigger to occur. /// [DataField("intersectRatio")] public float IntersectRatio = 0.3f; /// /// Entities will only be triggered if their speed exceeds this limit. /// [DataField("requiredTriggeredSpeed")] public float RequiredTriggerSpeed = 3.5f; /// /// If any entities occupy the blacklist on the same tile then steptrigger won't work. /// [DataField("blacklist")] public EntityWhitelist? Blacklist; } [RegisterComponent] [Access(typeof(StepTriggerSystem))] public sealed partial 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; } }