Files
tbd-station-14/Content.Shared/Weapons/Ranged/Events/ShotAttemptedEvent.cs
DrSmugleaf f22e5404aa Make failing to fire a gun that requires wielding not delay the next shot (#27973)
Make failing to fire a wield-only gun not delay the next shot
2024-05-13 21:53:47 -07:00

40 lines
881 B
C#

using Content.Shared.Weapons.Ranged.Components;
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;
/// <summary>
/// The gun being shot.
/// </summary>
public Entity<GunComponent> Used;
public bool Cancelled { get; private set; }
/// </summary>
/// Prevent the gun from shooting
/// </summary>
public void Cancel()
{
Cancelled = true;
}
/// </summary>
/// Allow the gun to shoot again, only use if you know what you are doing
/// </summary>
public void Uncancel()
{
Cancelled = false;
}
}