Fix muzzle flashes for other players (#10454)
This commit is contained in:
@@ -63,7 +63,7 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
UpdatesOutsidePrediction = true;
|
UpdatesOutsidePrediction = true;
|
||||||
SubscribeLocalEvent<AmmoCounterComponent, ItemStatusCollectMessage>(OnAmmoCounterCollect);
|
SubscribeLocalEvent<AmmoCounterComponent, ItemStatusCollectMessage>(OnAmmoCounterCollect);
|
||||||
SubscribeLocalEvent<GunComponent, MuzzleFlashEvent>(OnMuzzleFlash);
|
SubscribeAllEvent<MuzzleFlashEvent>(OnMuzzleFlash);
|
||||||
|
|
||||||
// Plays animated effects on the client.
|
// Plays animated effects on the client.
|
||||||
SubscribeNetworkEvent<HitscanEvent>(OnHitscan);
|
SubscribeNetworkEvent<HitscanEvent>(OnHitscan);
|
||||||
@@ -72,9 +72,9 @@ public sealed partial class GunSystem : SharedGunSystem
|
|||||||
InitializeSpentAmmo();
|
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)
|
private void OnHitscan(HitscanEvent ev)
|
||||||
|
|||||||
@@ -8,10 +8,12 @@ namespace Content.Shared.Weapons.Ranged.Events;
|
|||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
public sealed class MuzzleFlashEvent : EntityEventArgs
|
public sealed class MuzzleFlashEvent : EntityEventArgs
|
||||||
{
|
{
|
||||||
|
public EntityUid Uid;
|
||||||
public string Prototype;
|
public string Prototype;
|
||||||
|
|
||||||
public MuzzleFlashEvent(string prototype)
|
public MuzzleFlashEvent(EntityUid uid, string prototype)
|
||||||
{
|
{
|
||||||
|
Uid = uid;
|
||||||
Prototype = prototype;
|
Prototype = prototype;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ public abstract partial class SharedGunSystem : EntitySystem
|
|||||||
if (sprite == null)
|
if (sprite == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var ev = new MuzzleFlashEvent(sprite);
|
var ev = new MuzzleFlashEvent(gun, sprite);
|
||||||
|
|
||||||
CreateEffect(gun, ev, user);
|
CreateEffect(gun, ev, user);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user