From 75dfbdb57f584a8430b79b4510e2df44609f8884 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Tue, 9 Aug 2022 14:30:32 +1000 Subject: [PATCH] Fix muzzle flashes for other players (#10454) --- Content.Client/Weapons/Ranged/Systems/GunSystem.cs | 6 +++--- Content.Shared/Weapons/Ranged/Events/MuzzleFlashEvent.cs | 4 +++- Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) 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); }