1
0

StepTriggerComponent.cs 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Content.Shared.StepTrigger.Systems;
  2. using Content.Shared.Whitelist;
  3. using Robust.Shared.GameStates;
  4. namespace Content.Shared.StepTrigger.Components;
  5. [RegisterComponent, NetworkedComponent, AutoGenerateComponentState(true)]
  6. [Access(typeof(StepTriggerSystem))]
  7. public sealed partial class StepTriggerComponent : Component
  8. {
  9. public const float DefaultRequiredTriggeredSpeed = 3.5f;
  10. /// <summary>
  11. /// List of entities that are currently colliding with the entity.
  12. /// </summary>
  13. [ViewVariables, AutoNetworkedField]
  14. public HashSet<EntityUid> Colliding = new();
  15. /// <summary>
  16. /// The list of entities that are standing on this entity,
  17. /// which shouldn't be able to trigger it again until stepping off.
  18. /// </summary>
  19. [ViewVariables, AutoNetworkedField]
  20. public HashSet<EntityUid> CurrentlySteppedOn = new();
  21. /// <summary>
  22. /// Whether or not this component will currently try to trigger for entities.
  23. /// </summary>
  24. [DataField, AutoNetworkedField]
  25. public bool Active = true;
  26. /// <summary>
  27. /// Ratio of shape intersection for a trigger to occur.
  28. /// </summary>
  29. [DataField, AutoNetworkedField]
  30. public float IntersectRatio = 0.3f;
  31. /// <summary>
  32. /// Entities will only be triggered if their speed exceeds this limit.
  33. /// </summary>
  34. [DataField, AutoNetworkedField]
  35. public float RequiredTriggeredSpeed = DefaultRequiredTriggeredSpeed;
  36. /// <summary>
  37. /// If any entities occupy the blacklist on the same tile then steptrigger won't work.
  38. /// </summary>
  39. [DataField]
  40. public EntityWhitelist? Blacklist;
  41. /// <summary>
  42. /// If this is true, steptrigger will still occur on entities that are in air / weightless. They do not
  43. /// by default.
  44. /// </summary>
  45. [DataField, AutoNetworkedField]
  46. public bool IgnoreWeightless;
  47. /// <summary>
  48. /// Does this have separate "StepOn" and "StepOff" triggers.
  49. /// </summary>
  50. [DataField, AutoNetworkedField]
  51. public bool StepOn = false;
  52. }
  53. [RegisterComponent]
  54. [Access(typeof(StepTriggerSystem))]
  55. public sealed partial class StepTriggerActiveComponent : Component
  56. {
  57. }