Fix DamageOtherOnHit.OnDoHit when the target is terminating or deleted (#28690)

This commit is contained in:
DrSmugleaf
2024-06-07 22:53:54 -07:00
committed by GitHub
parent 49496b40e5
commit a7c7cd74ec

View File

@@ -31,6 +31,8 @@ namespace Content.Server.Damage.Systems
}
private void OnDoHit(EntityUid uid, DamageOtherOnHitComponent component, ThrowDoHitEvent args)
{
if (!TerminatingOrDeleted(args.Target))
{
var dmg = _damageable.TryChangeDamage(args.Target, component.Damage, component.IgnoreResistances, origin: args.Component.Thrower);
@@ -49,6 +51,7 @@ namespace Content.Server.Damage.Systems
var direction = body.LinearVelocity.Normalized();
_sharedCameraRecoil.KickCamera(args.Target, direction);
}
}
// TODO: If more stuff touches this then handle it after.
if (TryComp<PhysicsComponent>(uid, out var physics))