Ship mostly works #10
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user