step trigger fix + optimization (#8503)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.StepTrigger;
|
||||
@@ -11,12 +11,14 @@ public sealed class StepTriggerComponent : Component
|
||||
/// <summary>
|
||||
/// List of entities that are currently colliding with the entity.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public readonly HashSet<EntityUid> Colliding = new();
|
||||
|
||||
/// <summary>
|
||||
/// The list of entities that are standing on this entity,
|
||||
/// which shouldn't be able to trigger it again until stepping off.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public readonly HashSet<EntityUid> CurrentlySteppedOn = new();
|
||||
|
||||
/// <summary>
|
||||
@@ -50,13 +52,17 @@ public sealed class StepTriggerComponentState : ComponentState
|
||||
{
|
||||
public float IntersectRatio { get; }
|
||||
public float RequiredTriggerSpeed { get; }
|
||||
public readonly EntityUid[] CurrentlySteppedOn;
|
||||
public readonly HashSet<EntityUid> CurrentlySteppedOn;
|
||||
public readonly HashSet<EntityUid> Colliding;
|
||||
public readonly bool Active;
|
||||
|
||||
public StepTriggerComponentState(float intersectRatio, EntityUid[] currentlySteppedOn, float requiredTriggerSpeed)
|
||||
public StepTriggerComponentState(float intersectRatio, HashSet<EntityUid> currentlySteppedOn, HashSet<EntityUid> colliding, float requiredTriggerSpeed, bool active)
|
||||
{
|
||||
IntersectRatio = intersectRatio;
|
||||
CurrentlySteppedOn = currentlySteppedOn;
|
||||
RequiredTriggerSpeed = requiredTriggerSpeed;
|
||||
Active = active;
|
||||
Colliding = colliding;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user