1
0

DraggableEvents.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. namespace Content.Shared.DragDrop;
  2. /// <summary>
  3. /// Raised directed on an entity when attempting to start a drag.
  4. /// </summary>
  5. [ByRefEvent]
  6. public record struct CanDragEvent
  7. {
  8. /// <summary>
  9. /// False if we are unable to drag this entity.
  10. /// </summary>
  11. public bool Handled;
  12. }
  13. /// <summary>
  14. /// Raised directed on a dragged entity to indicate whether it has interactions with the target entity.
  15. /// </summary>
  16. [ByRefEvent]
  17. public record struct CanDropDraggedEvent(EntityUid User, EntityUid Target)
  18. {
  19. public readonly EntityUid User = User;
  20. public readonly EntityUid Target = Target;
  21. public bool Handled = false;
  22. /// <summary>
  23. /// Can we drop the entity onto the target? If the event is not handled then there is no supported interactions.
  24. /// </summary>
  25. public bool CanDrop = false;
  26. }
  27. /// <summary>
  28. /// Raised directed on the target entity to indicate whether it has interactions with the dragged entity.
  29. /// </summary>
  30. [ByRefEvent]
  31. public record struct CanDropTargetEvent(EntityUid User, EntityUid Dragged)
  32. {
  33. public readonly EntityUid User = User;
  34. public readonly EntityUid Dragged = Dragged;
  35. public bool Handled = false;
  36. /// <summary>
  37. /// <see cref="CanDropDraggedEvent"/>
  38. /// </summary>
  39. public bool CanDrop = false;
  40. }
  41. /// <summary>
  42. /// Raised directed on a dragged entity when it is dropped on a target entity.
  43. /// </summary>
  44. [ByRefEvent]
  45. public record struct DragDropDraggedEvent(EntityUid User, EntityUid Target)
  46. {
  47. public readonly EntityUid User = User;
  48. public readonly EntityUid Target = Target;
  49. public bool Handled = false;
  50. }
  51. /// <summary>
  52. /// Raised directed on the target entity when a dragged entity is dragged onto it.
  53. /// </summary>
  54. [ByRefEvent]
  55. public record struct DragDropTargetEvent(EntityUid User, EntityUid Dragged)
  56. {
  57. public readonly EntityUid User = User;
  58. public readonly EntityUid Dragged = Dragged;
  59. public bool Handled = false;
  60. }