diff --git a/assets/core/player-controller/scripts/player.gd b/assets/core/player-controller/scripts/player.gd index 579b8d4..254c4f0 100644 --- a/assets/core/player-controller/scripts/player.gd +++ b/assets/core/player-controller/scripts/player.gd @@ -53,11 +53,16 @@ func _ready() -> void: body.hide() head.hide() player_avatar_face.hide() - + Input.mouse_mode = Input.MOUSE_MODE_CAPTURED -func _unhandled_input(event: InputEvent) -> void: +func _input(event): if !is_network_authority: return + if event.is_action_pressed("esc") and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: + release_mouse() + elif event.is_action_pressed("esc") and not Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: + capture_mouse() + if Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: if event is InputEventMouseMotion: is_using_joystick = false @@ -65,17 +70,10 @@ func _unhandled_input(event: InputEvent) -> void: _rotate_camera() elif event is InputEventJoypadMotion: is_using_joystick = true + if Input.is_action_just_pressed("jump") and !is_piloting: jumping = true - -func _input(event): - if !is_network_authority: return - if event.is_action_pressed("esc") and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: - release_mouse() - elif event.is_action_pressed("esc") and not Input.mouse_mode == Input.MOUSE_MODE_CAPTURED: - capture_mouse() - func _physics_process(delta: float) -> void: if !is_network_authority: return @@ -104,9 +102,9 @@ func _process(delta: float) -> void: NetworkManager.sync_property(network_uuid, "global_rotation", global_rotation) previous_global_rotation = global_rotation - if previous_head_vert_rotation != neck.global_rotation: + if previous_head_vert_rotation != neck.rotation: NetworkManager.sync_property(network_uuid, "neck_rotation_sync", neck_rotation_sync) - previous_global_rotation = neck.global_rotation + previous_global_rotation = neck.rotation func capture_mouse() -> void: @@ -191,8 +189,8 @@ func ship_exited(): func _on_property_update(node_id: String, property_name: String, value: Variant) -> void: if NetworkManager.node_map.has(node_id): - if property_name == "neck_rotation_sync": - neck.global_rotation = value + if property_name == "neck_rotation_sync" and !is_network_authority: + neck.rotation = value else: var node = NetworkManager.node_map[node_id] node.set(property_name, value) diff --git a/assets/core/ships/ship_script.gd b/assets/core/ships/ship_script.gd index 20ea30c..0ac9099 100644 --- a/assets/core/ships/ship_script.gd +++ b/assets/core/ships/ship_script.gd @@ -8,12 +8,12 @@ extends RigidBody3D var piloting_player: Player = null var ship_is_piloted: bool = false -@export var base_turn_speed: float = 10.0 -@export var max_turn_speed: float = 10.0 -@export var base_lift_speed: float = 20.0 -@export var top_speed: float = 30.0 -@export var move_speed: float = 15.0 -@export var acceleration: float = 5.0 +@export var base_turn_speed: float = 50.0 +@export var max_turn_speed: float = 50.0 +@export var base_lift_speed: float = 50.0 +@export var top_speed: float = 50.0 +@export var move_speed: float = 50.0 +@export var acceleration: float = 50.0 # Networking var network_uuid: String = "" @@ -22,6 +22,7 @@ var target_rotation: Quaternion = Quaternion() var previous_position: Vector3 var previous_rotation: Quaternion + func _ready(): network_uuid = NetworkManager.register_node(self) target_position = global_position diff --git a/assets/core/ships/shuttle-class/shuttle-class.tscn b/assets/core/ships/shuttle-class/shuttle-class.tscn index 9ae64ff..cb90a6f 100644 --- a/assets/core/ships/shuttle-class/shuttle-class.tscn +++ b/assets/core/ships/shuttle-class/shuttle-class.tscn @@ -26,7 +26,6 @@ script = ExtResource("1_ghft7") player_detection_area = NodePath("PlayerDetectionArea") helm_location_marker = NodePath("HelmLocationMarker") base_lift_speed = 5.0 -top_speed = 50.0 [node name="ShipToShipCol" type="CollisionShape3D" parent="."] shape = SubResource("BoxShape3D_6gbwt")