maybe maybe maybe

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

View File

@ -118,26 +118,30 @@ func _on_player_exited(body):
body.call_deferred("reparent", get_node("/root/DevLevel/"), true)
body.ship_exited()
print("Player exited the ship area.")
func send_network_update():
if NetworkManager.is_host:
if ship_is_piloted and piloting_player.steam_id == NetworkManager.steam_id or !ship_is_piloted:
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)
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_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:
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.")
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_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: