fix: shotgun can kill the dummy without crashing the game again

This commit is contained in:
DottsGit
2026-06-06 00:15:00 -04:00
parent 6aae02bef8
commit cb5708e19e
2 changed files with 13 additions and 5 deletions
+4 -2
View File
@@ -193,9 +193,11 @@ func _shoot_hitscan() -> void:
var falloff_factor = clampf((hit_dist - falloff_start) / (max_range - falloff_start), 0.0, 1.0)
damage = lerpf(base_dmg, min_dmg, falloff_factor)
if result.collider.has_method("apply_impulse"):
result.collider.apply_impulse(pellet_dir * 8.0) # Apply strong physical force for ragdoll
if result.collider.has_method("take_damage"):
var hit_impulse = pellet_dir * 8.0 # Apply strong physical force for ragdoll
result.collider.take_damage(damage, result.position, player, hit_impulse)
result.collider.take_damage(damage, result.position, player)
else:
ImpactSpawner.spawn(get_tree(), "bullet", result.position, result.normal, 0.08)