2023-12-27 02:55:48 -07:00
|
|
|
using Content.Shared.Weapons.Melee;
|
|
|
|
|
|
2021-06-19 10:03:24 +02:00
|
|
|
namespace Content.Shared.Interaction.Events
|
|
|
|
|
{
|
2022-03-09 19:40:07 +13:00
|
|
|
/// <summary>
|
|
|
|
|
/// Raised Directed at a user to check whether they are allowed to attack a target.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>
|
|
|
|
|
/// Combat will also check the general interaction blockers, so this event should only be used for combat-specific
|
|
|
|
|
/// action blocking.
|
|
|
|
|
/// </remarks>
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class AttackAttemptEvent : CancellableEntityEventArgs
|
2021-06-19 10:03:24 +02:00
|
|
|
{
|
2022-01-04 01:22:28 -08:00
|
|
|
public EntityUid Uid { get; }
|
|
|
|
|
public EntityUid? Target { get; }
|
|
|
|
|
|
2023-12-27 02:55:48 -07:00
|
|
|
public Entity<MeleeWeaponComponent>? Weapon { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// If this attempt is a disarm as opposed to an actual attack, for things that care about the difference.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public bool Disarm { get; }
|
|
|
|
|
|
|
|
|
|
public AttackAttemptEvent(EntityUid uid, EntityUid? target = null, Entity<MeleeWeaponComponent>? weapon = null, bool disarm = false)
|
2021-06-19 10:03:24 +02:00
|
|
|
{
|
2021-11-09 13:40:27 +01:00
|
|
|
Uid = uid;
|
2022-01-04 01:22:28 -08:00
|
|
|
Target = target;
|
2023-12-27 02:55:48 -07:00
|
|
|
Weapon = weapon;
|
|
|
|
|
Disarm = disarm;
|
2021-06-19 10:03:24 +02:00
|
|
|
}
|
|
|
|
|
}
|
2022-12-10 12:05:39 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Raised directed at an entity to check if they can attack while inside of a container.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public sealed class CanAttackFromContainerEvent : EntityEventArgs
|
|
|
|
|
{
|
|
|
|
|
public EntityUid Uid;
|
|
|
|
|
public EntityUid? Target;
|
|
|
|
|
public bool CanAttack = false;
|
|
|
|
|
|
|
|
|
|
public CanAttackFromContainerEvent(EntityUid uid, EntityUid? target = null)
|
|
|
|
|
{
|
|
|
|
|
Uid = uid;
|
|
|
|
|
Target = target;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-06-19 10:03:24 +02:00
|
|
|
}
|