AttackAttemptEvent.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using Content.Shared.Weapons.Melee;
  2. namespace Content.Shared.Interaction.Events
  3. {
  4. /// <summary>
  5. /// Raised Directed at a user to check whether they are allowed to attack a target.
  6. /// </summary>
  7. /// <remarks>
  8. /// Combat will also check the general interaction blockers, so this event should only be used for combat-specific
  9. /// action blocking.
  10. /// </remarks>
  11. public sealed class AttackAttemptEvent : CancellableEntityEventArgs
  12. {
  13. public EntityUid Uid { get; }
  14. public EntityUid? Target { get; }
  15. public Entity<MeleeWeaponComponent>? Weapon { get; }
  16. /// <summary>
  17. /// If this attempt is a disarm as opposed to an actual attack, for things that care about the difference.
  18. /// </summary>
  19. public bool Disarm { get; }
  20. public AttackAttemptEvent(EntityUid uid, EntityUid? target = null, Entity<MeleeWeaponComponent>? weapon = null, bool disarm = false)
  21. {
  22. Uid = uid;
  23. Target = target;
  24. Weapon = weapon;
  25. Disarm = disarm;
  26. }
  27. }
  28. /// <summary>
  29. /// Raised directed at an entity to check if they can attack while inside of a container.
  30. /// </summary>
  31. public sealed class CanAttackFromContainerEvent : EntityEventArgs
  32. {
  33. public EntityUid Uid;
  34. public EntityUid? Target;
  35. public bool CanAttack = false;
  36. public CanAttackFromContainerEvent(EntityUid uid, EntityUid? target = null)
  37. {
  38. Uid = uid;
  39. Target = target;
  40. }
  41. }
  42. }