save changes
This commit is contained in:
parent
37021e494d
commit
f30b5b79d3
@ -71,18 +71,19 @@ func _physics_process(_delta):
|
||||
|
||||
angular_velocity.y = clamp(angular_velocity.y, -max_turn_speed, max_turn_speed)
|
||||
|
||||
if NetworkManager.is_host:
|
||||
# Self level slowly if host
|
||||
global_rotation.x = lerpf(global_rotation.x, 0, 0.1)
|
||||
global_rotation.z = lerpf(global_rotation.z, 0, 0.1)
|
||||
# Self level slowly if host
|
||||
global_rotation.x = lerpf(global_rotation.x, 0, 0.1)
|
||||
global_rotation.z = lerpf(global_rotation.z, 0, 0.1)
|
||||
|
||||
if old_global_position_cache != global_position:
|
||||
NetworkManager.sync_property(uuid, "global_position", global_position)
|
||||
old_global_position_cache = global_position
|
||||
#if NetworkManager.is_host:
|
||||
|
||||
if old_global_rotation_cache != global_rotation:
|
||||
NetworkManager.sync_property(uuid, "global_rotation", global_rotation)
|
||||
old_global_rotation_cache = global_rotation
|
||||
if old_global_position_cache != global_position:
|
||||
NetworkManager.sync_property(uuid, "global_position", global_position)
|
||||
old_global_position_cache = global_position
|
||||
|
||||
if old_global_rotation_cache != global_rotation:
|
||||
NetworkManager.sync_property(uuid, "global_rotation", global_rotation)
|
||||
old_global_rotation_cache = global_rotation
|
||||
|
||||
|
||||
|
||||
@ -112,6 +113,13 @@ func _add_ship_helm(_ship_helm_scene: PackedScene):
|
||||
func _on_property_update(uuid: String, property_name: String, value: Variant):
|
||||
if NetworkManager.node_map.has(uuid):
|
||||
var node = NetworkManager.node_map[uuid]
|
||||
if piloting_player != null and !piloting_player.is_network_authority:
|
||||
if property_name == "global_position":
|
||||
node.global_position = value
|
||||
return
|
||||
if property_name == "global_rotation":
|
||||
node.global_position = value
|
||||
return
|
||||
node.set(property_name, value)
|
||||
else:
|
||||
printerr("Received property update but node_id is wrong? Expected " + str(uuid) + " but got " + str(uuid))
|
||||
|
Loading…
Reference in New Issue
Block a user