Kick mines (real) (#8056)

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Pieter-Jan Briers
2022-05-18 06:07:35 +02:00
committed by GitHub
parent 2f604ce05c
commit ebfe5e888f
29 changed files with 635 additions and 220 deletions

View File

@@ -0,0 +1,62 @@
using Robust.Shared.GameStates;
using Robust.Shared.Serialization;
namespace Content.Shared.StepTrigger;
[RegisterComponent]
[NetworkedComponent]
[Friend(typeof(StepTriggerSystem))]
public sealed class StepTriggerComponent : Component
{
/// <summary>
/// List of entities that are currently colliding with the entity.
/// </summary>
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>
public readonly HashSet<EntityUid> CurrentlySteppedOn = new();
/// <summary>
/// Whether or not this component will currently try to trigger for entities.
/// </summary>
[DataField("active")]
public bool Active { get; set; } = true;
/// <summary>
/// Ratio of shape intersection for a trigger to occur.
/// </summary>
[DataField("intersectRatio")]
public float IntersectRatio { get; set; } = 0.3f;
/// <summary>
/// Entities will only be triggered if their speed exceeds this limit.
/// </summary>
[DataField("requiredTriggeredSpeed")]
public float RequiredTriggerSpeed { get; set; } = 3.5f;
}
[RegisterComponent]
[Friend(typeof(StepTriggerSystem))]
public sealed class StepTriggerActiveComponent : Component
{
}
[Serializable, NetSerializable]
public sealed class StepTriggerComponentState : ComponentState
{
public float IntersectRatio { get; }
public float RequiredTriggerSpeed { get; }
public readonly EntityUid[] CurrentlySteppedOn;
public StepTriggerComponentState(float intersectRatio, EntityUid[] currentlySteppedOn, float requiredTriggerSpeed)
{
IntersectRatio = intersectRatio;
CurrentlySteppedOn = currentlySteppedOn;
RequiredTriggerSpeed = requiredTriggerSpeed;
}
}