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
This commit is contained in:
@@ -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<TrackUserComponent>(ent);
|
||||
track.User = user;
|
||||
track.User = tracked;
|
||||
track.Offset = Vector2.UnitX / 2f;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user