Fix effects (#27533)

* Fix effects

- Fix muzzle flash rotations.
- Fix effects so they update every frame.
- Fix effects tanking client performance.

* Fix merge artifact
This commit is contained in:
metalgearsloth
2024-05-02 12:40:07 +10:00
committed by GitHub
parent 6596584722
commit 5053c8afdb
8 changed files with 91 additions and 51 deletions

View File

@@ -136,7 +136,6 @@ public abstract partial class SharedGunSystem : EntitySystem
return;
gun.ShootCoordinates = GetCoordinates(msg.Coordinates);
Log.Debug($"Set shoot coordinates to {gun.ShootCoordinates}");
AttemptShoot(user.Value, ent, gun);
}
@@ -195,7 +194,6 @@ public abstract partial class SharedGunSystem : EntitySystem
if (gun.ShotCounter == 0)
return;
Log.Debug($"Stopped shooting {ToPrettyString(uid)}");
gun.ShotCounter = 0;
gun.ShootCoordinates = null;
Dirty(uid, gun);
@@ -461,7 +459,7 @@ public abstract partial class SharedGunSystem : EntitySystem
RemCompDeferred<AmmoComponent>(uid);
}
protected void MuzzleFlash(EntityUid gun, AmmoComponent component, EntityUid? user = null)
protected void MuzzleFlash(EntityUid gun, AmmoComponent component, Angle worldAngle, EntityUid? user = null)
{
var attemptEv = new GunMuzzleFlashAttemptEvent();
RaiseLocalEvent(gun, ref attemptEv);
@@ -473,7 +471,7 @@ public abstract partial class SharedGunSystem : EntitySystem
if (sprite == null)
return;
var ev = new MuzzleFlashEvent(GetNetEntity(gun), sprite, user == gun);
var ev = new MuzzleFlashEvent(GetNetEntity(gun), sprite, worldAngle);
CreateEffect(gun, ev, user);
}
@@ -522,7 +520,7 @@ public abstract partial class SharedGunSystem : EntitySystem
Dirty(gun);
}
protected abstract void CreateEffect(EntityUid uid, MuzzleFlashEvent message, EntityUid? user = null);
protected abstract void CreateEffect(EntityUid gunUid, MuzzleFlashEvent message, EntityUid? user = null);
/// <summary>
/// Used for animated effects on the client.