From: TGRCDev Date: Sat, 26 Apr 2025 02:12:18 +0000 (-0700) Subject: Fixed stinger grenade lag spikes (#36641) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=79ae7e7abe47b94c28a47ab58789df50ef36cd96;p=space-station-14.git Fixed stinger grenade lag spikes (#36641) * Fixed stinger lag spikes * Simplify nullable checks * More cleanup of projectile grenades * Remove null default from ShootProjectile --- diff --git a/Content.Server/Explosion/EntitySystems/ProjectileGrenadeSystem.cs b/Content.Server/Explosion/EntitySystems/ProjectileGrenadeSystem.cs index 555ce3399e..dbb96e06a5 100644 --- a/Content.Server/Explosion/EntitySystems/ProjectileGrenadeSystem.cs +++ b/Content.Server/Explosion/EntitySystems/ProjectileGrenadeSystem.cs @@ -77,7 +77,7 @@ public sealed class ProjectileGrenadeSystem : EntitySystem // slightly uneven, doesn't really change much, but it looks better var direction = angle.ToVec().Normalized(); var velocity = _random.NextVector2(component.MinVelocity, component.MaxVelocity); - _gun.ShootProjectile(contentUid, direction, velocity, uid, null); + _gun.ShootProjectile(contentUid, direction, velocity, null); } } diff --git a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs index 8ed9e4949e..bebfe6f922 100644 --- a/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs +++ b/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.cs @@ -415,7 +415,7 @@ public abstract partial class SharedGunSystem : EntitySystem EntityUid? user = null, bool throwItems = false); - public void ShootProjectile(EntityUid uid, Vector2 direction, Vector2 gunVelocity, EntityUid gunUid, EntityUid? user = null, float speed = 20f) + public void ShootProjectile(EntityUid uid, Vector2 direction, Vector2 gunVelocity, EntityUid? gunUid, EntityUid? user = null, float speed = 20f) { var physics = EnsureComp(uid); Physics.SetBodyStatus(uid, physics, BodyStatus.InAir); @@ -426,8 +426,10 @@ public abstract partial class SharedGunSystem : EntitySystem Physics.SetLinearVelocity(uid, finalLinear, body: physics); var projectile = EnsureComp(uid); - Projectiles.SetShooter(uid, projectile, user ?? gunUid); projectile.Weapon = gunUid; + var shooter = user ?? gunUid; + if (shooter != null) + Projectiles.SetShooter(uid, projectile, shooter.Value); TransformSystem.SetWorldRotation(uid, direction.ToWorldAngle() + projectile.Angle); }