AttackEvent.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using Content.Shared.Damage;
  2. using Robust.Shared.Map;
  3. using Robust.Shared.Serialization;
  4. namespace Content.Shared.Weapons.Melee.Events
  5. {
  6. [Serializable, NetSerializable]
  7. public abstract class AttackEvent : EntityEventArgs
  8. {
  9. /// <summary>
  10. /// Coordinates being attacked.
  11. /// </summary>
  12. public readonly NetCoordinates Coordinates;
  13. protected AttackEvent(NetCoordinates coordinates)
  14. {
  15. Coordinates = coordinates;
  16. }
  17. }
  18. /// <summary>
  19. /// Event raised on entities that have been attacked.
  20. /// </summary>
  21. public sealed class AttackedEvent : EntityEventArgs
  22. {
  23. /// <summary>
  24. /// Entity used to attack, for broadcast purposes.
  25. /// </summary>
  26. public EntityUid Used { get; }
  27. /// <summary>
  28. /// Entity that triggered the attack.
  29. /// </summary>
  30. public EntityUid User { get; }
  31. /// <summary>
  32. /// The original location that was clicked by the user.
  33. /// </summary>
  34. public EntityCoordinates ClickLocation { get; }
  35. public DamageSpecifier BonusDamage = new();
  36. public AttackedEvent(EntityUid used, EntityUid user, EntityCoordinates clickLocation)
  37. {
  38. Used = used;
  39. User = user;
  40. ClickLocation = clickLocation;
  41. }
  42. }
  43. }