From 4a17fde692b900393d796675bcf7011aa7399dad Mon Sep 17 00:00:00 2001 From: Anson Bridges Date: Fri, 30 Sep 2022 11:20:16 -0400 Subject: syncing off main --- godot/scripts/vehicles/Gunboat.gd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'godot/scripts/vehicles/Gunboat.gd') diff --git a/godot/scripts/vehicles/Gunboat.gd b/godot/scripts/vehicles/Gunboat.gd index c00479e..03252e6 100644 --- a/godot/scripts/vehicles/Gunboat.gd +++ b/godot/scripts/vehicles/Gunboat.gd @@ -39,12 +39,18 @@ func mp_init(init_info): # Called when the node enters the scene tree for the first time. func _ready(): print("adding gunboat to scene",get_tree().get_network_unique_id()) + controllable = true + for sail in $SAILS.get_children(): + sail.set_sheet(sail_out) world = get_tree().get_root().find_node("GAMEWORLD", true, false) if get_tree().get_network_unique_id() == 0: print("enabling navigation for server") $NavigationMeshInstance.set_enabled(true) func on_no_control(): + rpc("reset_controls") + +remotesync func reset_controls(): rudder = 0.0 throttle = 0.0 mainsheet = 0.0 @@ -76,7 +82,7 @@ remotesync func damage(amount, _type, _shooter, _extra = ""): # Called every frame. 'delta' is the elapsed time since the previous frame. func _physics_process(delta): if is_network_master(): - if mainsheet != 0: + if throttle != 0: for sail in $SAILS.get_children(): sail.set_sheet(sail_out) $Rudder.rotation_degrees.y = rudder_turn -- cgit v1.2.3