From 37a17878e43c6495990607309c88bebd5d6fd803 Mon Sep 17 00:00:00 2001 From: Rendo Date: Sat, 29 Nov 2025 02:27:05 +0500 Subject: [PATCH] death multiplayer sync --- TODO_LIST | 5 +++-- scenes/weapons/active_bomb.tscn | 2 +- scripts/multiplayer/session.gd | 2 +- scripts/player/player.gd | 9 ++++++++- scripts/weapon_system/bomb/active_bomb.gd | 1 + 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/TODO_LIST b/TODO_LIST index 5c1f3b6..9d114c5 100644 --- a/TODO_LIST +++ b/TODO_LIST @@ -12,8 +12,9 @@ Current plans: ^ Animation ^ In-game animation ^ Droppable - Explosion after time - Bomb site + Defuse + ^ Explosion after time + ^ Bomb site ^ Weapon system's drop Molikman's abilities: Molik diff --git a/scenes/weapons/active_bomb.tscn b/scenes/weapons/active_bomb.tscn index 3f78dfc..0ee1b9a 100644 --- a/scenes/weapons/active_bomb.tscn +++ b/scenes/weapons/active_bomb.tscn @@ -18,6 +18,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1307683, 0) replication_config = SubResource("SceneReplicationConfig_yh58y") [node name="Timer" type="Timer" parent="."] -wait_time = 45.0 +wait_time = 5.0 one_shot = true autostart = true diff --git a/scripts/multiplayer/session.gd b/scripts/multiplayer/session.gd index 6cd00d2..e70a97b 100644 --- a/scripts/multiplayer/session.gd +++ b/scripts/multiplayer/session.gd @@ -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() diff --git a/scripts/player/player.gd b/scripts/player/player.gd index dec1df3..90b2789 100644 --- a/scripts/player/player.gd +++ b/scripts/player/player.gd @@ -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 diff --git a/scripts/weapon_system/bomb/active_bomb.gd b/scripts/weapon_system/bomb/active_bomb.gd index 12b8d7e..cd030ae 100644 --- a/scripts/weapon_system/bomb/active_bomb.gd +++ b/scripts/weapon_system/bomb/active_bomb.gd @@ -11,3 +11,4 @@ func on_timeout(): return Session.kill_site(plant) + print("boom")