1
0

DoorEvents.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. using Content.Shared.Doors.Components;
  2. namespace Content.Shared.Doors
  3. {
  4. /// <summary>
  5. /// Raised when the door's State variable is changed to a new variable that it was not equal to before.
  6. /// </summary>
  7. public sealed class DoorStateChangedEvent : EntityEventArgs
  8. {
  9. public readonly DoorState State;
  10. public DoorStateChangedEvent(DoorState state)
  11. {
  12. State = state;
  13. }
  14. }
  15. /// <summary>
  16. /// Raised when the door's bolt status was changed.
  17. /// </summary>
  18. public sealed class DoorBoltsChangedEvent : EntityEventArgs
  19. {
  20. public readonly bool BoltsDown;
  21. public DoorBoltsChangedEvent(bool boltsDown)
  22. {
  23. BoltsDown = boltsDown;
  24. }
  25. }
  26. /// <summary>
  27. /// Raised when the door is determining whether it is able to open.
  28. /// Cancel to stop the door from being opened.
  29. /// </summary>
  30. public sealed class BeforeDoorOpenedEvent : CancellableEntityEventArgs
  31. {
  32. public EntityUid? User = null;
  33. }
  34. /// <summary>
  35. /// Raised when the door is determining whether it is able to close. If the event is canceled, the door will not
  36. /// close. Additionally this event also has a bool that determines whether or not the door should perform a
  37. /// safety/collision check before closing. This check has to be proactively disabled by things like hacked airlocks.
  38. /// </summary>
  39. /// <remarks>
  40. /// This event is raised both when the door is initially closed, and when it is just about to become "partially"
  41. /// closed (opaque &amp; collidable). If canceled while partially closing, it will start opening again. Useful in case
  42. /// an entity entered the door just as it was about to become "solid".
  43. /// </remarks>
  44. public sealed class BeforeDoorClosedEvent : CancellableEntityEventArgs
  45. {
  46. /// <summary>
  47. /// If true, this check is being performed when the door is partially closing.
  48. /// </summary>
  49. public bool Partial;
  50. public bool PerformCollisionCheck;
  51. public BeforeDoorClosedEvent(bool performCollisionCheck, bool partial = false)
  52. {
  53. Partial = partial;
  54. PerformCollisionCheck = performCollisionCheck;
  55. }
  56. }
  57. /// <summary>
  58. /// Called when the door is determining whether it is able to deny.
  59. /// Cancel to stop the door from being able to deny.
  60. /// </summary>
  61. public sealed class BeforeDoorDeniedEvent : CancellableEntityEventArgs
  62. {
  63. }
  64. /// <summary>
  65. /// Raised to determine whether the door should automatically close.
  66. /// Cancel to stop it from automatically closing.
  67. /// </summary>
  68. /// <remarks>
  69. /// This is called when a door decides whether it SHOULD auto close, not when it actually closes.
  70. /// </remarks>
  71. public sealed class BeforeDoorAutoCloseEvent : CancellableEntityEventArgs
  72. {
  73. }
  74. }