diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index ab6868f157..a6e9c5b95b 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -63,7 +63,7 @@ public sealed partial class GunSystem : SharedGunSystem base.Initialize(); UpdatesOutsidePrediction = true; SubscribeLocalEvent(OnAmmoCounterCollect); - SubscribeLocalEvent(OnMuzzleFlash); + SubscribeAllEvent(OnMuzzleFlash); // Plays animated effects on the client. SubscribeNetworkEvent(OnHitscan); @@ -72,9 +72,9 @@ public sealed partial class GunSystem : SharedGunSystem InitializeSpentAmmo(); } - private void OnMuzzleFlash(EntityUid uid, GunComponent component, MuzzleFlashEvent args) + private void OnMuzzleFlash(MuzzleFlashEvent args) { - CreateEffect(uid, args); + CreateEffect(args.Uid, args); } private void OnHitscan(HitscanEvent ev) diff --git a/Content.Shared/Weapons/Ranged/Events/MuzzleFlashEvent.cs b/Content.Shared/Weapons/Ranged/Events/MuzzleFlashEvent.cs index 69409c6575..84479c2e12 100644 --- a/Content.Shared/Weapons/Ranged/Events/MuzzleFlashEvent.cs +++ b/Content.Shared/Weapons/Ranged/Events/MuzzleFlashEvent.cs @@ -8,10 +8,12 @@ namespace Content.Shared.Weapons.Ranged.Events; [Serializable, NetSerializable] public sealed class MuzzleFlashEvent : EntityEventArgs { + public EntityUid Uid; public string Prototype; - public MuzzleFlashEvent(string prototype) + public MuzzleFlashEvent(EntityUid uid, string prototype) { + Uid = uid; Prototype = prototype; } } diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 4c9f25935d..899d6cf249 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -349,7 +349,7 @@ public abstract partial class SharedGunSystem : EntitySystem if (sprite == null) return; - var ev = new MuzzleFlashEvent(sprite); + var ev = new MuzzleFlashEvent(gun, sprite); CreateEffect(gun, ev, user); }