death multiplayer sync

This commit is contained in:
Rendo 2025-11-29 02:27:05 +05:00
commit 37a17878e4
5 changed files with 14 additions and 5 deletions

View file

@ -97,4 +97,4 @@ func kill_site(site: StringName) -> void:
for body in plant_deadzones[site].get_overlapping_bodies():
if body is Player:
body.die()
body.kill_request.rpc()

View file

@ -33,12 +33,19 @@ func _physics_process(_delta: float) -> void:
move_and_slide()
func die() -> void:
if not is_multiplayer_authority():
if (not is_multiplayer_authority()):
return
global_position = TEMP_start_pos
hp = MAX_HP
@rpc("any_peer","call_local","reliable")
func kill_request() -> void:
if multiplayer.get_remote_sender_id() != 1:
return
die()
@rpc("any_peer","call_local","reliable")
func set_after_spawn(start_position: Vector3,new_team: int):
global_position = start_position

View file

@ -11,3 +11,4 @@ func on_timeout():
return
Session.kill_site(plant)
print("boom")