2022-07-10 02:28:37 -07:00
|
|
|
using Content.Shared.StepTrigger.Systems;
|
2023-03-07 06:11:27 +11:00
|
|
|
using Content.Shared.Whitelist;
|
2022-05-29 11:31:43 +12:00
|
|
|
using Robust.Shared.GameStates;
|
2022-05-18 06:07:35 +02:00
|
|
|
|
2022-07-10 02:28:37 -07:00
|
|
|
namespace Content.Shared.StepTrigger.Components;
|
2022-05-18 06:07:35 +02:00
|
|
|
|
2023-09-28 16:20:29 -07:00
|
|
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
|
2022-06-07 15:26:28 +02:00
|
|
|
[Access(typeof(StepTriggerSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class StepTriggerComponent : Component
|
2022-05-18 06:07:35 +02:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// List of entities that are currently colliding with the entity.
|
|
|
|
|
/// </summary>
|
2023-09-29 22:14:16 -07:00
|
|
|
[ViewVariables, AutoNetworkedField]
|
2023-09-28 16:20:29 -07:00
|
|
|
public HashSet<EntityUid> Colliding = new();
|
2022-05-18 06:07:35 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The list of entities that are standing on this entity,
|
|
|
|
|
/// which shouldn't be able to trigger it again until stepping off.
|
|
|
|
|
/// </summary>
|
2023-09-29 22:14:16 -07:00
|
|
|
[ViewVariables, AutoNetworkedField]
|
2023-09-28 16:20:29 -07:00
|
|
|
public HashSet<EntityUid> CurrentlySteppedOn = new();
|
2022-05-18 06:07:35 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether or not this component will currently try to trigger for entities.
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-03-03 11:01:06 +11:00
|
|
|
public bool Active = true;
|
2022-05-18 06:07:35 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Ratio of shape intersection for a trigger to occur.
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-03-03 11:01:06 +11:00
|
|
|
public float IntersectRatio = 0.3f;
|
2022-05-18 06:07:35 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Entities will only be triggered if their speed exceeds this limit.
|
|
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public float RequiredTriggeredSpeed = 3.5f;
|
2023-03-07 06:11:27 +11:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-09-10 23:03:16 -07:00
|
|
|
/// If any entities occupy the blacklist on the same tile then steptrigger won't work.
|
2023-03-07 06:11:27 +11:00
|
|
|
/// </summary>
|
2023-09-28 16:20:29 -07:00
|
|
|
[DataField]
|
2023-03-07 06:11:27 +11:00
|
|
|
public EntityWhitelist? Blacklist;
|
2023-09-10 23:03:16 -07:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// If this is true, steptrigger will still occur on entities that are in air / weightless. They do not
|
|
|
|
|
/// by default.
|
|
|
|
|
/// </summary>
|
2024-03-24 07:33:45 +02:00
|
|
|
[DataField, AutoNetworkedField]
|
2023-09-28 16:20:29 -07:00
|
|
|
public bool IgnoreWeightless;
|
2024-03-24 07:33:45 +02:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Does this have separate "StepOn" and "StepOff" triggers.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[DataField, AutoNetworkedField]
|
|
|
|
|
public bool StepOn = false;
|
2022-05-18 06:07:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[RegisterComponent]
|
2022-06-07 15:26:28 +02:00
|
|
|
[Access(typeof(StepTriggerSystem))]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class StepTriggerActiveComponent : Component
|
2022-05-18 06:07:35 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|