fix: shotgun can kill the dummy without crashing the game again
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user