Integrate gauges into cockpit dashboard

This commit is contained in:
chindit committed 2026-10-03 09:40:36 +02:00
1 parent 0b79bf9b82
commit 53288b48c8
7 files changed
+213 -17

No files matched your search

+24 -12
View File
@@ -5,6 +5,9 @@ const DiveUpdate = preload("res://game/domain/dive/dive_update.gd")
const DiveAlertLevel = preload("res://game/domain/dive/dive_alert_level.gd")
const VehicleTelemetry = preload("res://game/application/dive/vehicle_telemetry.gd")
const CockpitAnalogGauges = preload("res://game/presentation/cockpit/cockpit_analog_gauges.gd")
const CockpitDashboardDetailing = preload(
"res://game/presentation/cockpit/cockpit_dashboard_detailing.gd"
)
const CockpitMaterialPalette = preload("res://game/presentation/cockpit/cockpit_material_palette.gd")
const CockpitMeshFactory = preload("res://game/presentation/cockpit/cockpit_mesh_factory.gd")
@@ -14,9 +17,8 @@ var _dark_steel: Material
var _overhead_steel: Material
var _brass: Material
var _copper: Material
var _rubber: Material
var _warm_emission: StandardMaterial3D
var _analog_gauges: CockpitAnalogGauges
var _dashboard_detailing: CockpitDashboardDetailing
var _warm_practical: OmniLight3D
var _emergency_light: OmniLight3D
@@ -28,7 +30,7 @@ func _ready() -> void:
_build_life_support_pipes()
_build_overhead_console()
_build_panel_hardware()
_build_analog_gauges()
_build_dashboard_instrumentation()
_build_practical_lights()
@@ -74,6 +76,14 @@ func textures_are_loaded() -> bool:
)
func dashboard_control_count() -> int:
return 0 if _dashboard_detailing == null else _dashboard_detailing.control_count()
func gauges_are_dashboard_mounted() -> bool:
return _analog_gauges != null and _analog_gauges.get_parent() == get_parent().get_node("Dashboard")
func _create_materials() -> void:
_materials = CockpitMaterialPalette.new()
_painted_steel = _materials.painted_steel
@@ -81,8 +91,6 @@ func _create_materials() -> void:
_overhead_steel = _materials.overhead_steel
_brass = _materials.brass
_copper = _materials.copper
_rubber = _materials.rubber
_warm_emission = _materials.warm_emission
func _apply_materials_to_existing_cockpit() -> void:
@@ -91,7 +99,6 @@ func _apply_materials_to_existing_cockpit() -> void:
[
"CabinShell/LeftWall",
"CabinShell/RightWall",
"Dashboard/MainPanel",
"LeftConsole",
"RightConsole",
]
@@ -112,6 +119,7 @@ func _apply_materials_to_existing_cockpit() -> void:
[
"CabinShell/Ceiling",
"PortholeAssembly/TopBulkhead",
"Dashboard/MainPanel",
]
)
_apply_material_to_paths(
@@ -125,8 +133,6 @@ func _apply_materials_to_existing_cockpit() -> void:
"VerticalKnob",
]
)
func _apply_material_to_paths(material: Material, paths: Array[String]) -> void:
var cockpit := get_parent()
for path: String in paths:
@@ -241,7 +247,7 @@ func _build_overhead_console() -> void:
root,
Vector3(0.0, 0.895, -0.985),
Vector3(0.13, 0.010, 0.026),
_warm_emission,
_materials.warm_emission,
Vector3(-8.0, 0.0, 0.0)
)
for guard_index in 5:
@@ -262,7 +268,7 @@ func _build_overhead_console() -> void:
Vector3(x, 0.965, -0.985),
0.004,
0.018,
_rubber,
_materials.rubber,
Vector3(90.0, 0.0, 0.0)
)
@@ -302,9 +308,15 @@ func _build_panel_hardware() -> void:
root.add_child(label)
func _build_analog_gauges() -> void:
func _build_dashboard_instrumentation() -> void:
var dashboard := get_parent().get_node_or_null("Dashboard") as Node3D
if dashboard == null:
return
_dashboard_detailing = CockpitDashboardDetailing.new(_materials)
dashboard.add_child(_dashboard_detailing)
_dashboard_detailing.apply_screen_materials(dashboard)
_analog_gauges = CockpitAnalogGauges.new(_materials)
add_child(_analog_gauges)
dashboard.add_child(_analog_gauges)
func _build_practical_lights() -> void: