InteractUsing.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using JetBrains.Annotations;
  2. using Robust.Shared.Map;
  3. using Robust.Shared.Utility;
  4. namespace Content.Shared.Interaction
  5. {
  6. /// <summary>
  7. /// Raised when a target entity is interacted with by a user while holding an object in their hand.
  8. /// </summary>
  9. [PublicAPI]
  10. public sealed class InteractUsingEvent : HandledEntityEventArgs
  11. {
  12. /// <summary>
  13. /// Entity that triggered the interaction.
  14. /// </summary>
  15. public EntityUid User { get; }
  16. /// <summary>
  17. /// Entity that the user used to interact.
  18. /// </summary>
  19. public EntityUid Used { get; }
  20. /// <summary>
  21. /// Entity that was interacted on.
  22. /// </summary>
  23. public EntityUid Target { get; }
  24. /// <summary>
  25. /// The original location that was clicked by the user.
  26. /// </summary>
  27. public EntityCoordinates ClickLocation { get; }
  28. public InteractUsingEvent(EntityUid user, EntityUid used, EntityUid target, EntityCoordinates clickLocation)
  29. {
  30. // Interact using should not have the same used and target.
  31. // That should be a use-in-hand event instead.
  32. // If this is not the case, can lead to bugs (e.g., attempting to merge a item stack into itself).
  33. DebugTools.Assert(used != target);
  34. User = user;
  35. Used = used;
  36. Target = target;
  37. ClickLocation = clickLocation;
  38. }
  39. }
  40. }