Compare commits
No commits in common. "ddbc4925b4d4ed39d8171485944e864bac027a1b" and "a852f9f7fa79b887db7f8281f271ac6bede5b64a" have entirely different histories.
ddbc4925b4
...
a852f9f7fa
Binary file not shown.
@ -34,7 +34,7 @@ volumetric_fog_density = 0.0
|
||||
[node name="CustomSkies" type="WorldEnvironment"]
|
||||
environment = SubResource("Environment_8p04f")
|
||||
script = ExtResource("2_unvmv")
|
||||
rateOfTime = 100.0
|
||||
rateOfTime = 500.0
|
||||
skyRotation = 18.5
|
||||
|
||||
[node name="SunMoonLine" type="Node3D" parent="."]
|
||||
@ -52,6 +52,5 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5)
|
||||
|
||||
[node name="MoonDirectionalLight3D" type="DirectionalLight3D" parent="SunMoonLine/MoonNodes"]
|
||||
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
|
||||
light_angular_distance = 1.0
|
||||
light_energy = 0.01
|
||||
shadow_enabled = true
|
||||
sky_mode = 2
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
[node name="DevLevel" type="Node3D"]
|
||||
|
||||
[node name="Sky" parent="." instance=ExtResource("4_uss2e")]
|
||||
|
||||
[node name="level" parent="." instance=ExtResource("3_vcq2f")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -10, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -20, 0)
|
||||
|
||||
[node name="ShuttleClass" parent="." instance=ExtResource("3_lsckv")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.32076, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.4922, 0)
|
||||
|
||||
[node name="Sky" parent="." instance=ExtResource("4_uss2e")]
|
||||
|
@ -12,8 +12,11 @@ func _ready():
|
||||
func interact():
|
||||
if !parent_ship.ship_is_piloted:
|
||||
player_reference.set_is_piloting(true)
|
||||
print("set player to piloting")
|
||||
parent_ship.ship_is_piloted = true
|
||||
|
||||
elif parent_ship.ship_is_piloted:
|
||||
player_reference.set_is_piloting(false)
|
||||
print("set player to NOT piloting")
|
||||
parent_ship.ship_is_piloted = false
|
||||
GameConsole.log_debug("helm pilot state - " + str(parent_ship.ship_is_piloted))
|
||||
|
@ -104,6 +104,7 @@ func _on_lobby_created(connect: int, this_lobby_id: int) -> void:
|
||||
lobby_id = this_lobby_id
|
||||
lobby_created.emit(lobby_id)
|
||||
print("Lobby created with ID: " + str(lobby_id))
|
||||
host_id = steam_id
|
||||
|
||||
Steam.setLobbyJoinable(lobby_id, true)
|
||||
Steam.setLobbyData(lobby_id, "name", str(steam_username) + "'s Lobby")
|
||||
|
@ -49,6 +49,7 @@ func _on_lobby_joined(lobby_id: int):
|
||||
func _on_user_joined_lobby(user_id: int):
|
||||
if user_id in added_users:
|
||||
return # User already added, skip
|
||||
|
||||
added_users.append(user_id)
|
||||
update()
|
||||
|
||||
|
@ -9,12 +9,12 @@ var network_uuid: String = ""
|
||||
var steam_id: int = 0
|
||||
|
||||
@export_category("Player")
|
||||
@export_range(1, 35, 1) var speed: float = 5.0
|
||||
@export_range(10, 400, 1) var acceleration: float = 100.0
|
||||
@export_range(1, 35, 1) var speed: float = 5 # m/s
|
||||
@export_range(10, 400, 1) var acceleration: float = 100 # m/s^2
|
||||
|
||||
@export_range(0.1, 3.0, 0.1) var jump_height: float = 1.0
|
||||
@export_range(0.1, 3.0, 0.1, "or_greater") var camera_sens: float = 1.0
|
||||
@export_range(0.1, 3.0, 0.1, "or_greater") var joystick_camera_sens_multiplier: float = 5.0
|
||||
@export_range(0.1, 3.0, 0.1) var jump_height: float = 1 # m
|
||||
@export_range(0.1, 3.0, 0.1, "or_greater") var camera_sens: float = 1
|
||||
@export_range(0.1, 3.0, 0.1, "or_greater") var joystick_camera_sens_multiplier: float = 2
|
||||
@export var camera: Camera3D
|
||||
|
||||
var jumping: bool = false
|
||||
@ -66,12 +66,15 @@ func _input(event):
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if !is_network_authority: return
|
||||
if is_piloting and current_ship != null:
|
||||
global_rotation.y = current_ship.global_rotation.y
|
||||
velocity = Vector3.ZERO + _gravity(delta)
|
||||
if current_ship != null:
|
||||
if is_piloting: #if we are piloting a ship
|
||||
global_transform.basis = current_ship.global_transform.basis
|
||||
global_rotation.y = current_ship.global_rotation.y
|
||||
else: #if we are NOT piloting a ship
|
||||
velocity = walk(delta) + _gravity(delta) + _jump(delta)
|
||||
global_rotation.y = current_ship.global_rotation.y
|
||||
else:
|
||||
velocity = walk(delta) + _gravity(delta) + _jump(delta)
|
||||
|
||||
global_rotation.x = 0.0
|
||||
global_rotation.z = 0.0
|
||||
|
||||
@ -160,15 +163,7 @@ func player_exited_ship(ship_global_position: Vector3, ship: Ship):
|
||||
func set_is_piloting(state: bool):
|
||||
if !is_network_authority: return
|
||||
is_piloting = state
|
||||
print("player is piloting: ", str(is_piloting))
|
||||
|
||||
|
||||
func ship_entered(_ship: Ship):
|
||||
current_ship = _ship
|
||||
|
||||
|
||||
func ship_exited():
|
||||
current_ship = null
|
||||
GameConsole.log_debug("player pilot state" + str(is_piloting))
|
||||
|
||||
|
||||
func _on_property_update(node_id: String, property_name: String, value: Variant) -> void:
|
||||
|
@ -3,14 +3,11 @@ extends RayCast3D
|
||||
@export var player: Player
|
||||
|
||||
var current_interactable: Interactable
|
||||
var has_processed_interact_frame: bool = false
|
||||
|
||||
func _process(delta):
|
||||
func _input(event):
|
||||
if is_colliding() and get_collider() is Interactable:
|
||||
if Input.is_action_just_pressed("interact") and !has_processed_interact_frame:
|
||||
if event.is_action_released("interact"):
|
||||
current_interactable = get_collider() as Interactable
|
||||
GameConsole.log_debug("interacted with interactable: " + current_interactable.name)
|
||||
current_interactable.player_reference = player
|
||||
current_interactable.interact()
|
||||
has_processed_interact_frame = true
|
||||
has_processed_interact_frame = false
|
||||
|
@ -11,15 +11,12 @@ var piloting_player: Player = null
|
||||
|
||||
var ship_id: int = 0
|
||||
var ship_is_piloted: bool = false
|
||||
var current_level
|
||||
var reparent: bool = false
|
||||
|
||||
@export_range(0.01, 1.0, 0.01) var base_turn_speed: float = 0.35
|
||||
@export var max_turn_speed: float = 0.5
|
||||
@export_range(0.01, 1.0, 0.01) var base_lift_speed: float = 2.0
|
||||
@export var top_speed: float = 5.0
|
||||
@export var move_speed: float = 1.0
|
||||
@export var acceleration: float = 0.1
|
||||
var turn_speed: float = 10.0
|
||||
var lift_speed: float = 10.0
|
||||
var top_speed: float = 10.0
|
||||
var move_speed: float = 10.0
|
||||
var acceleration: float = 10.0
|
||||
var deceleration: float = 20.0
|
||||
|
||||
|
||||
func _ready():
|
||||
@ -29,61 +26,28 @@ func _ready():
|
||||
|
||||
_add_ship_helm(ship_helm_scene) #TEMPORARY TEST
|
||||
|
||||
|
||||
ship_id = randi_range(1000, 9999) #assign a random id to the ship as a unique identifier
|
||||
GameConsole.log_debug("Ship ID: " + str(ship_id))
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
if ship_is_piloted:
|
||||
var turn_speed = base_turn_speed / max(mass, 1)
|
||||
var lift_speed = base_lift_speed / max(mass, 1)
|
||||
|
||||
if Input.is_action_pressed("move_left"):
|
||||
angular_velocity.y += turn_speed
|
||||
elif Input.is_action_pressed("move_right"):
|
||||
angular_velocity.y -= turn_speed
|
||||
else:
|
||||
global_rotation.z = lerpf(global_rotation.z, 0, 0.8)
|
||||
|
||||
if Input.is_action_pressed("jump"):
|
||||
linear_velocity.y += lift_speed
|
||||
elif Input.is_action_pressed("crouch"):
|
||||
linear_velocity.y -= lift_speed
|
||||
|
||||
var target_velocity = Vector3.ZERO
|
||||
if Input.is_action_pressed("move_forwards"):
|
||||
target_velocity = -transform.basis.z * top_speed
|
||||
elif Input.is_action_pressed("move_backwards"):
|
||||
target_velocity = transform.basis.z * top_speed
|
||||
var acceleration = (target_velocity - linear_velocity) * acceleration
|
||||
apply_central_force(acceleration * mass)
|
||||
if linear_velocity.length() > top_speed:
|
||||
linear_velocity = linear_velocity.normalized() * top_speed
|
||||
|
||||
angular_velocity.y = clamp(angular_velocity.y, -max_turn_speed, max_turn_speed)
|
||||
|
||||
# Self level slowly
|
||||
global_rotation.x = lerpf(global_rotation.x, 0, 0.1)
|
||||
global_rotation.z = lerpf(global_rotation.z, 0, 0.1)
|
||||
pass
|
||||
|
||||
|
||||
func _on_area_3d_body_entered(body):
|
||||
if body is Player:
|
||||
body.ship_entered(self)
|
||||
body.player_entered_ship(global_position, self)
|
||||
piloting_player = body
|
||||
reparent = true
|
||||
body.reparent(self, true) #reparents player onto self (RigidBody3D)
|
||||
print(self.name)
|
||||
|
||||
|
||||
func _on_area_3d_body_exited(body):
|
||||
if reparent:
|
||||
reparent = false
|
||||
return
|
||||
if body is Player:
|
||||
body.ship_exited()
|
||||
body.player_exited_ship(global_position, self)
|
||||
ship_is_piloted = false
|
||||
piloting_player = null
|
||||
body.reparent(get_node("/root/DevLevel/"), true) #reparents player back onto world node
|
||||
|
||||
|
||||
func _add_ship_helm(_ship_helm_scene: PackedScene):
|
||||
|
@ -14,7 +14,7 @@ uv1_triplanar = true
|
||||
size = Vector3(5, 0.15, 20)
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_7o08p"]
|
||||
size = Vector3(4.99609, 3.11252, 20.0022)
|
||||
size = Vector3(4.99609, 2.95453, 20.0022)
|
||||
|
||||
[node name="ShuttleClass" type="RigidBody3D" node_paths=PackedStringArray("player_detection_area")]
|
||||
collision_layer = 8
|
||||
@ -42,5 +42,5 @@ shape = SubResource("BoxShape3D_6gbwt")
|
||||
[node name="PlayerDetectionArea" type="Area3D" parent="."]
|
||||
|
||||
[node name="PlayerDetectionAreaCol" type="CollisionShape3D" parent="PlayerDetectionArea"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.47652, 0)
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.55551, 0)
|
||||
shape = SubResource("BoxShape3D_7o08p")
|
||||
|
@ -61,14 +61,13 @@ func _physics_process(delta):
|
||||
|
||||
func _on_area_3d_body_entered(body):
|
||||
if body is Player:
|
||||
piloting_player = body
|
||||
body.player_entered_ship(global_position, self)
|
||||
body.set_block_signals(true)
|
||||
piloting_player = body
|
||||
print(self.name)
|
||||
|
||||
|
||||
func _on_area_3d_body_exited(body):
|
||||
if body is Player:
|
||||
ship_helm.is_being_piloted = false
|
||||
body.player_exited_ship(global_position, self)
|
||||
ship_helm.is_being_piloted = false
|
||||
piloting_player = null
|
||||
body.set_block_signals(false)
|
||||
|
BIN
godot-jolt/windows/~godot-jolt_windows-x64_editor.dll
Normal file
BIN
godot-jolt/windows/~godot-jolt_windows-x64_editor.dll
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user