various fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
TODO:
|
TODO:
|
||||||
|
|
||||||
DONE Controller/possession refactor (input out of Boat).
|
DONE Controller/possession refactor (input out of Boat).
|
||||||
WeaponDef resource + WeaponSlot + one dumb gun that prints instead of shooting.
|
DONE WeaponDef resource + WeaponSlot + one dumb gun that prints instead of shooting.
|
||||||
Projectile base (with group self-registration) + real firing.
|
DONE Projectile base (with group self-registration) + real firing.
|
||||||
Loadout-driven mounting.
|
DONE Loadout-driven mounting.
|
||||||
Second boat scene to prove the whole seam.
|
Second boat scene to prove the whole seam.
|
||||||
|
|||||||
@@ -74,4 +74,3 @@ current_controlled = NodePath("../Boat")
|
|||||||
world_manager = NodePath("../WorldManager")
|
world_manager = NodePath("../WorldManager")
|
||||||
camera_rig = NodePath("../CameraRig")
|
camera_rig = NodePath("../CameraRig")
|
||||||
hud = NodePath("../Hud")
|
hud = NodePath("../Hud")
|
||||||
throttle_ramp = null
|
|
||||||
|
|||||||
@@ -3,14 +3,8 @@
|
|||||||
[ext_resource type="Material" uid="uid://6p5bg1nyso6d" path="res://materials/stylized_water.tres" id="1_j38dg"]
|
[ext_resource type="Material" uid="uid://6p5bg1nyso6d" path="res://materials/stylized_water.tres" id="1_j38dg"]
|
||||||
[ext_resource type="Script" uid="uid://co5xetl8amg4j" path="res://scripts/ocean.gd" id="2_nb2vx"]
|
[ext_resource type="Script" uid="uid://co5xetl8amg4j" path="res://scripts/ocean.gd" id="2_nb2vx"]
|
||||||
|
|
||||||
[sub_resource type="PlaneMesh" id="PlaneMesh_ocean"]
|
|
||||||
size = Vector2(200, 200)
|
|
||||||
subdivide_width = 200
|
|
||||||
subdivide_depth = 200
|
|
||||||
|
|
||||||
[node name="Ocean" type="MeshInstance3D" unique_id=521355215 groups=["follow_focus", "ocean"]]
|
[node name="Ocean" type="MeshInstance3D" unique_id=521355215 groups=["follow_focus", "ocean"]]
|
||||||
material_override = ExtResource("1_j38dg")
|
material_override = ExtResource("1_j38dg")
|
||||||
mesh = SubResource("PlaneMesh_ocean")
|
|
||||||
script = ExtResource("2_nb2vx")
|
script = ExtResource("2_nb2vx")
|
||||||
sea_height = 1.0
|
sea_height = 1.0
|
||||||
sea_choppy = 8.0
|
sea_choppy = 8.0
|
||||||
|
|||||||
@@ -30,4 +30,4 @@ func _unhandled_input(event: InputEvent) -> void:
|
|||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if target:
|
if target:
|
||||||
global_position = global_position.lerp(target.global_position, follow_speed * delta)
|
global_position = global_position.lerp(target.global_position, 1.0 - exp(-follow_speed * delta))
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ extends RigidBody3D
|
|||||||
var _probe_offsets: Array[Vector3] = [] # local space
|
var _probe_offsets: Array[Vector3] = [] # local space
|
||||||
|
|
||||||
var _ocean: Ocean
|
var _ocean: Ocean
|
||||||
# var _probes: Array[Marker3D] = [] TODO: Probably unused
|
|
||||||
var _gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
|
var _gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||||
var submerged_ratio := 0.0
|
var submerged_ratio := 0.0
|
||||||
|
|
||||||
@@ -39,10 +38,12 @@ func _ready() -> void:
|
|||||||
if _probe_offsets.is_empty():
|
if _probe_offsets.is_empty():
|
||||||
for col in probe_grid.x:
|
for col in probe_grid.x:
|
||||||
for row in probe_grid.y:
|
for row in probe_grid.y:
|
||||||
|
var tx := 0.5 if probe_grid.x <= 1 else col / float(probe_grid.x - 1)
|
||||||
|
var tz := 0.5 if probe_grid.y <= 1 else row / float(probe_grid.y - 1)
|
||||||
_probe_offsets.append(Vector3(
|
_probe_offsets.append(Vector3(
|
||||||
lerpf(-probe_extents.x, probe_extents.x, col / float(probe_grid.x - 1)),
|
lerpf(-probe_extents.x, probe_extents.x, tx),
|
||||||
probe_extents.y,
|
probe_extents.y,
|
||||||
lerpf(-probe_extents.z, probe_extents.z, row / float(probe_grid.y - 1))))
|
lerpf(-probe_extents.z, probe_extents.z, tz)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+9
-4
@@ -30,16 +30,21 @@ extends MeshInstance3D
|
|||||||
set(value):
|
set(value):
|
||||||
iter_geometry = value
|
iter_geometry = value
|
||||||
_push("ITER_GEOMETRY", value)
|
_push("ITER_GEOMETRY", value)
|
||||||
## Node the ocean mesh stays centered under (camera rig or boat).
|
|
||||||
## Half-size of the rendered ocean square, in meters.
|
## Half-size of the rendered ocean square, in meters
|
||||||
@export var render_distance := 100.0:
|
@export var render_distance := 100.0:
|
||||||
set(value):
|
set(value):
|
||||||
render_distance = value
|
render_distance = value
|
||||||
if is_node_ready():
|
if is_node_ready():
|
||||||
_rebuild_mesh()
|
_rebuild_mesh()
|
||||||
## World-space distance between mesh vertices; smaller = more wave detail.
|
|
||||||
|
|
||||||
@export var vertex_spacing := 1.0
|
## World-space distance between mesh vertices; smaller = more wave detail.
|
||||||
|
@export var vertex_spacing := 1.0:
|
||||||
|
set(value):
|
||||||
|
vertex_spacing = value
|
||||||
|
if is_node_ready():
|
||||||
|
_rebuild_mesh()
|
||||||
|
|
||||||
var _phase := 0.0
|
var _phase := 0.0
|
||||||
var _wave_offset := Vector2.ZERO
|
var _wave_offset := Vector2.ZERO
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ extends Node
|
|||||||
|
|
||||||
@export var current_controlled : Boat:
|
@export var current_controlled : Boat:
|
||||||
set(value):
|
set(value):
|
||||||
|
if current_controlled != null and current_controlled != value:
|
||||||
|
current_controlled.desired_throttle = 0.0
|
||||||
|
current_controlled.steer_input = 0.0
|
||||||
current_controlled = value
|
current_controlled = value
|
||||||
if is_node_ready():
|
if is_node_ready():
|
||||||
if current_controlled != null:
|
if current_controlled != null:
|
||||||
@@ -57,6 +60,9 @@ func _process(delta: float) -> void:
|
|||||||
current_controlled.fire_weapons()
|
current_controlled.fire_weapons()
|
||||||
|
|
||||||
func _possess() -> void:
|
func _possess() -> void:
|
||||||
camera_rig.target = current_controlled
|
if camera_rig != null:
|
||||||
world_manager.focus = current_controlled
|
camera_rig.target = current_controlled
|
||||||
hud.boat = current_controlled
|
if world_manager != null:
|
||||||
|
world_manager.focus = current_controlled
|
||||||
|
if hud != null:
|
||||||
|
hud.boat = current_controlled
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ func launch(def: AmmoDef, muzzle: Transform3D, speed_scale := 1.0) -> void:
|
|||||||
reset_physics_interpolation()
|
reset_physics_interpolation()
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if Vector3.UP.cross(linear_velocity).length_squared() > 0.01:
|
if linear_velocity.length_squared() > 0.01 and absf(linear_velocity.normalized().dot(Vector3.UP)) < 0.999:
|
||||||
look_at(global_position + linear_velocity)
|
look_at(global_position + linear_velocity)
|
||||||
|
|
||||||
_time_left -= delta
|
_time_left -= delta
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
extends Label
|
extends Label
|
||||||
|
|
||||||
@export var boat: Boat
|
var boat: Boat # Assigned by hud
|
||||||
@export var world: WorldManager
|
var world: WorldManager # Assigned by hud
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
func _process(_delta: float) -> void:
|
||||||
if boat == null or world == null:
|
if boat == null or world == null:
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ func can_mount(def: WeaponDef) -> bool:
|
|||||||
|
|
||||||
func mount(def: WeaponDef) -> bool:
|
func mount(def: WeaponDef) -> bool:
|
||||||
if not can_mount(def):
|
if not can_mount(def):
|
||||||
|
push_warning("%s can't mount %s" % [
|
||||||
|
name,
|
||||||
|
def.display_name if def != null else "<null def>"
|
||||||
|
])
|
||||||
return false
|
return false
|
||||||
unmount()
|
unmount()
|
||||||
weapon = def.weapon_scene.instantiate()
|
weapon = def.weapon_scene.instantiate()
|
||||||
|
|||||||
Reference in New Issue
Block a user