maybe maybe maybe

This commit is contained in:
Chris Bell 2024-12-28 21:17:55 -06:00
parent 4bf6eaae0b
commit 283d313f88

View File

@ -123,21 +123,25 @@ func _on_player_exited(body):
func send_network_update():
if NetworkManager.is_host:
if ship_is_piloted and piloting_player.steam_id == NetworkManager.steam_id or !ship_is_piloted:
if global_position != previous_position or global_transform.basis.get_rotation_quaternion() != previous_rotation:
NetworkManager.sync_property_to_all_except_host(network_uuid, "global_position", global_position)
NetworkManager.sync_property_to_all_except_host(network_uuid, "global_rotation", global_rotation)
NetworkManager.sync_property_to_all_except_host(network_uuid, "global_rotation", global_transform.basis.get_rotation_quaternion())
previous_position = global_position
previous_rotation = global_transform.basis.get_rotation_quaternion()
elif ship_is_piloted and piloting_player.steam_id == NetworkManager.steam_id:
if global_position != previous_position or global_transform.basis.get_rotation_quaternion() != previous_rotation:
NetworkManager.sync_property_to_all(network_uuid, "global_position", global_position)
NetworkManager.sync_property_to_all(network_uuid, "global_rotation", global_rotation)
else:
GameConsole.log_warning("This should never be hit. If it is, something is wrong with send network logic on the ship.")
NetworkManager.sync_property_to_all(network_uuid, "global_rotation", global_transform.basis.get_rotation_quaternion())
previous_position = global_position
previous_rotation = global_transform.basis.get_rotation_quaternion()
func receive_global_position_update(value: Vector3):
target_position = value
func receive_global_rotation_update(value: Quaternion):
target_rotation = value
func receive_global_rotation_update(value: Vector3):
target_rotation = Quaternion().from_euler(value)
func _on_property_update(node_id: String, property_name: String, value: Variant) -> void: