2024-05-13 21:53:47 -07:00
|
|
|
using Content.Shared.Weapons.Ranged.Components;
|
|
|
|
|
|
2023-06-08 02:15:39 +00:00
|
|
|
namespace Content.Shared.Weapons.Ranged.Events;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Raised on a gun when someone is attempting to shoot it.
|
|
|
|
|
/// Cancel this event to prevent it from shooting.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ByRefEvent]
|
|
|
|
|
public record struct ShotAttemptedEvent
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The user attempting to shoot the gun.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public EntityUid User;
|
|
|
|
|
|
2023-09-15 04:12:14 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// The gun being shot.
|
|
|
|
|
/// </summary>
|
2024-05-13 21:53:47 -07:00
|
|
|
public Entity<GunComponent> Used;
|
2023-09-15 04:12:14 +01:00
|
|
|
|
2023-06-08 02:15:39 +00:00
|
|
|
public bool Cancelled { get; private set; }
|
|
|
|
|
|
2024-02-25 22:36:17 +11:00
|
|
|
/// </summary>
|
2023-06-08 02:15:39 +00:00
|
|
|
/// Prevent the gun from shooting
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Cancel()
|
|
|
|
|
{
|
|
|
|
|
Cancelled = true;
|
|
|
|
|
}
|
|
|
|
|
|
2024-02-25 22:36:17 +11:00
|
|
|
/// </summary>
|
2023-06-08 02:15:39 +00:00
|
|
|
/// Allow the gun to shoot again, only use if you know what you are doing
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Uncancel()
|
|
|
|
|
{
|
|
|
|
|
Cancelled = false;
|
|
|
|
|
}
|
|
|
|
|
}
|