AfterInteract.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System.Threading.Tasks;
  2. using JetBrains.Annotations;
  3. using Robust.Shared.Map;
  4. namespace Content.Shared.Interaction
  5. {
  6. [PublicAPI]
  7. public abstract class InteractEvent : HandledEntityEventArgs
  8. {
  9. /// <summary>
  10. /// Entity that triggered the interaction.
  11. /// </summary>
  12. public EntityUid User { get; }
  13. /// <summary>
  14. /// Entity that the user used to interact.
  15. /// </summary>
  16. public EntityUid Used { get; }
  17. /// <summary>
  18. /// Entity that was interacted on. This can be null if there was no target (e.g., clicking on tiles).
  19. /// </summary>
  20. public EntityUid? Target { get; }
  21. /// <summary>
  22. /// Location that the user clicked outside of their interaction range.
  23. /// </summary>
  24. public EntityCoordinates ClickLocation { get; }
  25. /// <summary>
  26. /// Is the click location in range without obstructions?
  27. /// </summary>
  28. public bool CanReach { get; }
  29. public InteractEvent(EntityUid user, EntityUid used, EntityUid? target,
  30. EntityCoordinates clickLocation, bool canReach)
  31. {
  32. User = user;
  33. Used = used;
  34. Target = target;
  35. ClickLocation = clickLocation;
  36. CanReach = canReach;
  37. }
  38. }
  39. /// <summary>
  40. /// Raised directed on the used object when clicking on another object and no standard interaction occurred.
  41. /// Used for low-priority interactions facilitated by the used entity.
  42. /// </summary>
  43. public sealed class AfterInteractEvent : InteractEvent
  44. {
  45. public AfterInteractEvent(EntityUid user, EntityUid used, EntityUid? target,
  46. EntityCoordinates clickLocation, bool canReach) : base(user, used, target, clickLocation, canReach)
  47. { }
  48. }
  49. /// <summary>
  50. /// Raised directed on the target when clicking on another object and no standard interaction occurred. Used for
  51. /// low-priority interactions facilitated by the target entity.
  52. /// </summary>
  53. public sealed class AfterInteractUsingEvent : InteractEvent
  54. {
  55. public AfterInteractUsingEvent(EntityUid user, EntityUid used, EntityUid? target,
  56. EntityCoordinates clickLocation, bool canReach) : base(user, used, target, clickLocation, canReach)
  57. { }
  58. }
  59. }