Events.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. namespace Content.Shared.Wieldable;
  2. /// <summary>
  3. /// Raised directed on an item when it is wielded.
  4. /// </summary>
  5. [ByRefEvent]
  6. public readonly record struct ItemWieldedEvent(EntityUid User);
  7. /// <summary>
  8. /// Raised directed on an item that has been unwielded.
  9. /// Force is whether the item is being forced to be unwielded, or if the player chose to unwield it themselves.
  10. /// </summary>
  11. [ByRefEvent]
  12. public readonly record struct ItemUnwieldedEvent(EntityUid User, bool Force);
  13. /// <summary>
  14. /// Raised directed on an item before a user tries to wield it.
  15. /// If this event is cancelled wielding will not happen.
  16. /// </summary>
  17. [ByRefEvent]
  18. public record struct WieldAttemptEvent(EntityUid User, bool Cancelled = false)
  19. {
  20. public void Cancel()
  21. {
  22. Cancelled = true;
  23. }
  24. }
  25. /// <summary>
  26. /// Raised directed on an item before a user tries to stop wielding it willingly.
  27. /// If this event is cancelled unwielding will not happen.
  28. /// </summary>
  29. /// <remarks>
  30. /// This event is not raised if the user is forced to unwield the item.
  31. /// </remarks>
  32. [ByRefEvent]
  33. public record struct UnwieldAttemptEvent(EntityUid User, bool Cancelled = false)
  34. {
  35. public void Cancel()
  36. {
  37. Cancelled = true;
  38. }
  39. }