From c25b76913227a275f51cfd5defc5c4b6479e0a7c Mon Sep 17 00:00:00 2001 From: deltanedas <39013340+deltanedas@users.noreply.github.com> Date: Fri, 15 Sep 2023 04:12:14 +0100 Subject: [PATCH] fix ninja no guns (#20184) Co-authored-by: deltanedas <@deltanedas:kde.org> --- Content.Shared/Weapons/Ranged/Events/ShotAttemptedEvent.cs | 5 +++++ Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Weapons/Ranged/Events/ShotAttemptedEvent.cs b/Content.Shared/Weapons/Ranged/Events/ShotAttemptedEvent.cs index 2b5628f751..40925ad614 100644 --- a/Content.Shared/Weapons/Ranged/Events/ShotAttemptedEvent.cs +++ b/Content.Shared/Weapons/Ranged/Events/ShotAttemptedEvent.cs @@ -12,6 +12,11 @@ public record struct ShotAttemptedEvent /// public EntityUid User; + /// + /// The gun being shot. + /// + public EntityUid Used; + public bool Cancelled { get; private set; } /// diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 5ef5112152..1c80f73ad6 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -226,12 +226,17 @@ public abstract partial class SharedGunSystem : EntitySystem // check if anything wants to prevent shooting var prevention = new ShotAttemptedEvent { - User = user + User = user, + Used = gunUid }; RaiseLocalEvent(gunUid, ref prevention); if (prevention.Cancelled) return; + RaiseLocalEvent(user, ref prevention); + if (prevention.Cancelled) + return; + // Need to do this to play the clicking sound for empty automatic weapons // but not play anything for burst fire. if (gun.NextFire > curTime)