Fixed players dying multiple times
parent
cf6ce06a27
commit
a10c4fe74d
|
@ -369,7 +369,7 @@ func _process(delta):
|
||||||
@rpc(call_local, any_peer, reliable) func take_damage(attacker: int, hit_position: Vector3, hit_normal: Vector3, damage:int, source_position: Vector3, damage_type, push: float):
|
@rpc(call_local, any_peer, reliable) func take_damage(attacker: int, hit_position: Vector3, hit_normal: Vector3, damage:int, source_position: Vector3, damage_type, push: float):
|
||||||
var attacker_node = main.get_node("Players").get_node(str(attacker))
|
var attacker_node = main.get_node("Players").get_node(str(attacker))
|
||||||
|
|
||||||
if is_multiplayer_authority():
|
if is_multiplayer_authority() and not dead:
|
||||||
print("Taken damage: ", damage, " by: ", attacker, " from: ", source_position)
|
print("Taken damage: ", damage, " by: ", attacker, " from: ", source_position)
|
||||||
hud.damage(damage)
|
hud.damage(damage)
|
||||||
health -= damage # reduce health
|
health -= damage # reduce health
|
||||||
|
|
Reference in New Issue