Build validated industrial submarine cockpit

This commit is contained in:
chindit committed 2026-10-04 10:39:56 +02:00
1 parent dffe790926
commit fdebbafeae
19 files changed
+906 -277

No files matched your search

+52 -106
View File
@@ -10,6 +10,15 @@ const CockpitDashboardDetailing = preload(
)
const CockpitMaterialPalette = preload("res://game/presentation/cockpit/cockpit_material_palette.gd")
const CockpitMeshFactory = preload("res://game/presentation/cockpit/cockpit_mesh_factory.gd")
const CockpitSideEquipment = preload(
"res://game/presentation/cockpit/cockpit_side_equipment.gd"
)
const CockpitSonarConsole = preload(
"res://game/presentation/cockpit/cockpit_sonar_console.gd"
)
const CockpitPracticalLighting = preload(
"res://game/presentation/cockpit/cockpit_practical_lighting.gd"
)
var _materials: CockpitMaterialPalette
var _painted_steel: Material
@@ -18,8 +27,9 @@ var _brass: Material
var _copper: Material
var _analog_gauges: CockpitAnalogGauges
var _dashboard_detailing: CockpitDashboardDetailing
var _warm_practical: OmniLight3D
var _emergency_light: OmniLight3D
var _side_equipment: CockpitSideEquipment
var _sonar_console: CockpitSonarConsole
var _practical_lighting: CockpitPracticalLighting
func _ready() -> void:
@@ -27,10 +37,9 @@ func _ready() -> void:
_apply_materials_to_existing_cockpit()
_build_pressure_hull_ribs()
_build_life_support_pipes()
_build_overhead_console()
_build_panel_hardware()
_build_dashboard_instrumentation()
_build_practical_lights()
_build_equipment_assemblies()
func present(update: DiveUpdate, telemetry: VehicleTelemetry) -> void:
@@ -50,10 +59,7 @@ func present(update: DiveUpdate, telemetry: VehicleTelemetry) -> void:
snapshot.alerts.maximum
)
var alert_level: DiveAlertLevel.Value = snapshot.alerts.maximum
_emergency_light.visible = alert_level >= DiveAlertLevel.Value.CRITICAL
_warm_practical.light_energy = (
0.28 if alert_level >= DiveAlertLevel.Value.CRITICAL else 0.72
)
_practical_lighting.present(alert_level)
func pressure_hull_rib_count() -> int:
@@ -74,7 +80,10 @@ func textures_are_loaded() -> bool:
return (
_materials != null
and _materials.overhead_steel.albedo_texture != null
and _materials.gauge_face.albedo_texture != null
and _materials.oxygen_gauge_face.albedo_texture != null
and _materials.battery_gauge_face.albedo_texture != null
and _materials.hull_gauge_face.albedo_texture != null
and _materials.depth_gauge_face.albedo_texture != null
)
@@ -82,6 +91,24 @@ func dashboard_control_count() -> int:
return 0 if _dashboard_detailing == null else _dashboard_detailing.control_count()
func side_equipment_count() -> int:
if _side_equipment == null:
return 0
return _side_equipment.tank_count() + _side_equipment.junction_box_count()
func side_control_count() -> int:
return 0 if _side_equipment == null else _side_equipment.control_count()
func sonar_control_count() -> int:
return 0 if _sonar_console == null else _sonar_console.control_count()
func practical_light_count() -> int:
return 0 if _practical_lighting == null else _practical_lighting.practical_light_count()
func gauges_are_dashboard_mounted() -> bool:
return _analog_gauges != null and _analog_gauges.get_parent() == get_parent().get_node("Dashboard")
@@ -219,58 +246,13 @@ func _build_life_support_pipes() -> void:
0.052,
_copper
)
CockpitMeshFactory.add_cylinder(
"OverheadCrossPipe",
root,
Vector3(0.0, 0.93, -1.12),
0.031,
1.82,
_copper,
Vector3(0.0, 0.0, 90.0)
)
func _build_overhead_console() -> void:
var root := Node3D.new()
root.name = "OverheadConsole"
add_child(root)
CockpitMeshFactory.add_box(
"BreakerHousing",
root,
Vector3(0.0, 0.94, -1.06),
Vector3(0.30, 0.09, 0.12),
_materials.overhead_steel,
Vector3(-8.0, 0.0, 0.0)
)
CockpitMeshFactory.add_box(
"WarmLightDiffuser",
root,
Vector3(0.0, 0.895, -0.985),
Vector3(0.13, 0.010, 0.026),
_materials.warm_emission,
Vector3(-8.0, 0.0, 0.0)
)
for guard_index in 5:
var guard_x := -0.05 + guard_index * 0.025
CockpitMeshFactory.add_box(
"LampGuard",
CockpitMeshFactory.add_cylinder_between(
"UpperBranchPipe",
root,
Vector3(guard_x, 0.896, -0.968),
Vector3(0.005, 0.045, 0.008),
_dark_steel,
Vector3(-8.0, 0.0, 0.0)
)
for switch_index in 5:
var x := -0.10 + switch_index * 0.05
CockpitMeshFactory.add_cylinder(
"BreakerSwitch",
root,
Vector3(x, 0.965, -0.985),
0.004,
0.018,
_materials.rubber,
Vector3(90.0, 0.0, 0.0)
Vector3(x, 0.84, -1.12),
Vector3(side * 0.72, 0.77, -1.10),
0.019,
_brass
)
@@ -290,23 +272,6 @@ func _build_panel_hardware() -> void:
Vector3(90.0, 0.0, 0.0)
)
for side: float in [-1.0, 1.0]:
CockpitMeshFactory.add_box(
"ServiceBox",
root,
Vector3(side * 0.89, 0.08, -1.10),
Vector3(0.18, 0.34, 0.19),
_painted_steel,
Vector3(0.0, side * -12.0, 0.0)
)
var label := Label3D.new()
label.name = "ServicePlate"
label.text = "O₂" if side < 0.0 else "ELEC"
label.font_size = 16
label.pixel_size = 0.0009
label.modulate = Color(0.72, 0.69, 0.56)
label.position = Vector3(side * 0.89, 0.10, -0.99)
root.add_child(label)
func _build_dashboard_instrumentation() -> void:
@@ -315,36 +280,17 @@ func _build_dashboard_instrumentation() -> void:
return
_dashboard_detailing = CockpitDashboardDetailing.new(_materials)
dashboard.add_child(_dashboard_detailing)
_dashboard_detailing.apply_screen_materials(dashboard)
_dashboard_detailing.hide_placeholder_indicators(get_parent())
_dashboard_detailing.hide_obsolete_elements(get_parent())
_analog_gauges = CockpitAnalogGauges.new(_materials)
dashboard.add_child(_analog_gauges)
func _build_practical_lights() -> void:
_warm_practical = OmniLight3D.new()
_warm_practical.name = "WarmPracticalLight"
_warm_practical.position = Vector3(0.0, 0.82, -0.50)
_warm_practical.light_color = Color(1.0, 0.52, 0.22)
_warm_practical.light_energy = 0.58
_warm_practical.omni_range = 2.2
_warm_practical.shadow_enabled = false
add_child(_warm_practical)
var cool_fill := OmniLight3D.new()
cool_fill.name = "CoolRearFill"
cool_fill.position = Vector3(0.0, 0.42, 0.35)
cool_fill.light_color = Color(0.24, 0.46, 0.47)
cool_fill.light_energy = 0.48
cool_fill.omni_range = 3.0
cool_fill.shadow_enabled = false
add_child(cool_fill)
_emergency_light = OmniLight3D.new()
_emergency_light.name = "EmergencyLight"
_emergency_light.position = Vector3(-0.58, 0.44, -0.83)
_emergency_light.light_color = Color(1.0, 0.04, 0.015)
_emergency_light.light_energy = 1.4
_emergency_light.omni_range = 2.4
_emergency_light.visible = false
add_child(_emergency_light)
func _build_equipment_assemblies() -> void:
_side_equipment = CockpitSideEquipment.new(_materials)
add_child(_side_equipment)
var sonar_monitor := get_parent().get_node_or_null("SonarMonitor") as Node3D
if sonar_monitor != null:
_sonar_console = CockpitSonarConsole.new(_materials)
sonar_monitor.add_child(_sonar_console)
_practical_lighting = CockpitPracticalLighting.new(_materials)
add_child(_practical_lighting)