made some adjustments to brights of rooms
This commit is contained in:
@@ -80,4 +80,15 @@ func _on_body_entered(body):
|
||||
# Push the hit target away slightly
|
||||
if body is CharacterBody2D:
|
||||
var knockback_dir = (body.global_position - global_position).normalized()
|
||||
body.velocity = knockback_dir * 200.0
|
||||
if body.is_in_group("player") and "is_dead" in body and body.is_dead:
|
||||
# Corpse: reduced force, sync to victim's client so they see the push
|
||||
const CORPSE_KNOCKBACK: float = 50.0
|
||||
var pid = body.get_multiplayer_authority()
|
||||
if pid == multiplayer.get_unique_id():
|
||||
body.rpc_apply_corpse_knockback(knockback_dir.x, knockback_dir.y, CORPSE_KNOCKBACK)
|
||||
elif pid != 0:
|
||||
body.rpc_apply_corpse_knockback.rpc_id(pid, knockback_dir.x, knockback_dir.y, CORPSE_KNOCKBACK)
|
||||
else:
|
||||
body.rpc_apply_corpse_knockback.rpc(knockback_dir.x, knockback_dir.y, CORPSE_KNOCKBACK)
|
||||
else:
|
||||
body.velocity = knockback_dir * 200.0
|
||||
|
||||
Reference in New Issue
Block a user