From ce672acf9147340d72ad013c169e0df6c925a264 Mon Sep 17 00:00:00 2001 From: Winkarst <74284083+Winkarst-cpu@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:20:27 +0300 Subject: [PATCH] Fix meteor's ArithmeticException (#33556) Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co> --- Content.Server/Projectiles/ProjectileSystem.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Content.Server/Projectiles/ProjectileSystem.cs b/Content.Server/Projectiles/ProjectileSystem.cs index 970536f42b0272..5cbc56b8fbc75b 100644 --- a/Content.Server/Projectiles/ProjectileSystem.cs +++ b/Content.Server/Projectiles/ProjectileSystem.cs @@ -45,7 +45,6 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St RaiseLocalEvent(uid, ref ev); var otherName = ToPrettyString(target); - var direction = args.OurBody.LinearVelocity.Normalized(); var modifiedDamage = _damageableSystem.TryChangeDamage(target, ev.Damage, component.IgnoreResistances, origin: component.Shooter); var deleted = Deleted(target); @@ -64,7 +63,9 @@ private void OnStartCollide(EntityUid uid, ProjectileComponent component, ref St if (!deleted) { _guns.PlayImpactSound(target, modifiedDamage, component.SoundHit, component.ForceSound); - _sharedCameraRecoil.KickCamera(target, direction); + + if (!args.OurBody.LinearVelocity.IsLengthZero()) + _sharedCameraRecoil.KickCamera(target, args.OurBody.LinearVelocity.Normalized()); } component.DamagedEntity = true;