From 13a1845e6b4abdf06b39ddd7572ed40b92c3eff9 Mon Sep 17 00:00:00 2001 From: Chris Bell Date: Thu, 19 Dec 2024 20:38:54 -0600 Subject: [PATCH] Sync player piloting state --- assets/core/ships/ship_script.gd | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/assets/core/ships/ship_script.gd b/assets/core/ships/ship_script.gd index 16b88a6..e0da4c5 100644 --- a/assets/core/ships/ship_script.gd +++ b/assets/core/ships/ship_script.gd @@ -143,13 +143,15 @@ func _on_property_update(uuid: String, property_name: String, value: Variant): _handle_ship_sync_rotation(value) else: node.set(property_name, value) - else: printerr("Received property update but node_id is wrong? Expected " + str(uuid) + " but got " + str(uuid)) func _sync_piloting_state(): NetworkManager.sync_property(network_uuid, "ship_is_piloted", ship_is_piloted) - NetworkManager.sync_property(network_uuid, "piloting_player", piloting_player) + if piloting_player != null: + NetworkManager.sync_property(network_uuid, "piloting_player", piloting_player.network_uuid) + else: + NetworkManager.sync_property(network_uuid, "piloting_player", "") func _send_ship_sync(): if Time.get_ticks_msec() - last_sync_time > sync_interval * 1000: @@ -176,4 +178,4 @@ func _handle_ship_sync_rotation(rot: Vector3): angular_velocity = delta_rot.get_euler() / delta_time # Apply server rotation directly - global_rotation = Quaternion.from_euler(rot).get_euler() + global_rotation = Quaternion.from_euler(rot).get_euler() \ No newline at end of file