From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sun, 21 Jul 2024 06:09:16 +0000 (+1000) Subject: Fix muzzle flash tracking (#30163) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=b4ec629b9fe5ad5bf9c4c011234e282774d73ae9;p=space-station-14.git Fix muzzle flash tracking (#30163) * Fix muzzle flash tracking User was never set on the networked event but we don't really need it anyway. * Also this one --- diff --git a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs index 840d1a9091..1af471f28a 100644 --- a/Content.Client/Weapons/Ranged/Systems/GunSystem.cs +++ b/Content.Client/Weapons/Ranged/Systems/GunSystem.cs @@ -88,7 +88,9 @@ public sealed partial class GunSystem : SharedGunSystem private void OnMuzzleFlash(MuzzleFlashEvent args) { - CreateEffect(GetEntity(args.Uid), args); + var gunUid = GetEntity(args.Uid); + + CreateEffect(gunUid, args, gunUid); } private void OnHitscan(HitscanEvent ev) @@ -271,7 +273,7 @@ public sealed partial class GunSystem : SharedGunSystem PopupSystem.PopupEntity(message, uid.Value, user.Value); } - protected override void CreateEffect(EntityUid gunUid, MuzzleFlashEvent message, EntityUid? user = null) + protected override void CreateEffect(EntityUid gunUid, MuzzleFlashEvent message, EntityUid? tracked = null) { if (!Timing.IsFirstTimePredicted) return; @@ -280,7 +282,7 @@ public sealed partial class GunSystem : SharedGunSystem // TODO: Check to see why invalid entities are firing effects. if (gunUid == EntityUid.Invalid) { - Log.Debug($"Invalid Entity sent MuzzleFlashEvent (proto: {message.Prototype}, user: {user})"); + Log.Debug($"Invalid Entity sent MuzzleFlashEvent (proto: {message.Prototype}, gun: {ToPrettyString(gunUid)})"); return; } @@ -304,10 +306,10 @@ public sealed partial class GunSystem : SharedGunSystem var ent = Spawn(message.Prototype, coordinates); TransformSystem.SetWorldRotationNoLerp(ent, message.Angle); - if (user != null) + if (tracked != null) { var track = EnsureComp(ent); - track.User = user; + track.User = tracked; track.Offset = Vector2.UnitX / 2f; } diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 47648a07ad..794237b145 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -476,7 +476,7 @@ public abstract partial class SharedGunSystem : EntitySystem return; var ev = new MuzzleFlashEvent(GetNetEntity(gun), sprite, worldAngle); - CreateEffect(gun, ev, user); + CreateEffect(gun, ev, gun); } public void CauseImpulse(EntityCoordinates fromCoordinates, EntityCoordinates toCoordinates, EntityUid user, PhysicsComponent userPhysics)