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

@ -12,8 +12,9 @@ Current plans:
^ Animation ^ Animation
^ In-game animation ^ In-game animation
^ Droppable ^ Droppable
Explosion after time Defuse
Bomb site ^ Explosion after time
^ Bomb site
^ Weapon system's drop ^ Weapon system's drop
Molikman's abilities: Molikman's abilities:
Molik Molik

View file

@ -18,6 +18,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1307683, 0)
replication_config = SubResource("SceneReplicationConfig_yh58y") replication_config = SubResource("SceneReplicationConfig_yh58y")
[node name="Timer" type="Timer" parent="."] [node name="Timer" type="Timer" parent="."]
wait_time = 45.0 wait_time = 5.0
one_shot = true one_shot = true
autostart = true autostart = true

View file

@ -97,4 +97,4 @@ func kill_site(site: StringName) -> void:
for body in plant_deadzones[site].get_overlapping_bodies(): for body in plant_deadzones[site].get_overlapping_bodies():
if body is Player: 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() move_and_slide()
func die() -> void: func die() -> void:
if not is_multiplayer_authority(): if (not is_multiplayer_authority()):
return return
global_position = TEMP_start_pos global_position = TEMP_start_pos
hp = MAX_HP 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") @rpc("any_peer","call_local","reliable")
func set_after_spawn(start_position: Vector3,new_team: int): func set_after_spawn(start_position: Vector3,new_team: int):
global_position = start_position global_position = start_position

View file

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