Files
Ransom-s-wake/game/presentation/cockpit/cockpit_side_equipment.gd
OlivierandClaude Opus 5.5 2c1ea50aba
Quality Gate / Quality Gate (pull_request) Successful in 7m6s
feat(cockpit): replace procedural cockpit with twelve scripted models
Instance twelve Blender-scripted glTF models in the cockpit scene and
rebuild the cabin around them: gauge panel, sonar, switch panel, alert
box, speaker, porthole, hull wall, caged lamps, gas bottle, handrails
and side consoles. Presentation only; no domain, application or world
rule changes beyond enabling glow in the test environment.

- Needles, alert lamps and sonar screen are driven by the existing
  snapshots; the alert box now carries SYS/ATTN/ALRM.
- Depth dial reads percent of certified depth.
- Sonar display restyled as a turquoise holographic relief with a
  shader grid and height scale; SubViewport matches the glass (960x604).
- Cabin lighting retuned: warm pooled lamp light, cool porthole rim,
  lamp shadows, dial backlight.
- Procedural stand-ins removed (bulkhead, tanks, consoles, levers,
  indicator columns, placeholder pipe run, dial face PNGs).
- Tests adapted where nodes disappeared; one assertion removed
  (pipe_segment_count) until the pipe kit is placed.
- Model .glb files are committed without LFS; textures Godot extracts
  next to them at import are ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-06 21:46:46 +02:00

106 lines
2.5 KiB
GDScript

class_name CockpitSideEquipment
extends Node3D
const CockpitMaterialPalette = preload(
"res://game/presentation/cockpit/cockpit_material_palette.gd"
)
const CockpitMeshFactory = preload(
"res://game/presentation/cockpit/cockpit_mesh_factory.gd"
)
var _materials: CockpitMaterialPalette
var _junction_box_count := 0
var _control_count := 0
func _init(materials: CockpitMaterialPalette) -> void:
_materials = materials
name = "SideEquipment"
_build_right_electrical_bank()
func junction_box_count() -> int:
return _junction_box_count
func control_count() -> int:
return _control_count
func _build_right_electrical_bank() -> void:
var root := Node3D.new()
root.name = "ElectricalBank"
# Seated on the flat end cap of the pressure hull, behind the sonar.
root.position = Vector3(0.14, -0.18, -0.055)
add_child(root)
_add_service_box(root, Vector3(0.72, 0.65, -1.17), "ELEC", 11.0)
_add_service_box(root, Vector3(0.73, 0.36, -1.16), "POMPES", 8.0)
_add_vent(root, Vector3(0.705, 0.69, -1.095))
_add_vent(root, Vector3(0.715, 0.40, -1.085))
_add_knob(root, Vector3(0.66, 0.55, -1.08))
_add_knob(root, Vector3(0.68, 0.25, -1.07))
func _add_service_box(
root: Node3D,
box_position: Vector3,
caption: String,
yaw_degrees: float
) -> void:
CockpitMeshFactory.add_box(
"JunctionBox",
root,
box_position,
Vector3(0.17, 0.23, 0.12),
_materials.overhead_steel,
Vector3(0.0, yaw_degrees, 0.0)
)
var label := Label3D.new()
label.name = "%sPlate" % caption.to_pascal_case()
label.text = caption
label.font_size = 12
label.pixel_size = 0.00065
label.modulate = Color(0.13, 0.16, 0.14)
label.position = box_position + Vector3(0.0, 0.075, 0.067)
root.add_child(label)
for corner: Vector2 in [
Vector2(-0.065, -0.085),
Vector2(-0.065, 0.085),
Vector2(0.065, -0.085),
Vector2(0.065, 0.085),
]:
CockpitMeshFactory.add_cylinder(
"BoxFastener",
root,
box_position + Vector3(corner.x, corner.y, 0.065),
0.008,
0.01,
_materials.dark_steel,
Vector3(90.0, 0.0, 0.0)
)
_junction_box_count += 1
func _add_vent(root: Node3D, center: Vector3) -> void:
for row in 5:
CockpitMeshFactory.add_box(
"VentSlit",
root,
center + Vector3(0.0, (row - 2) * 0.018, 0.0),
Vector3(0.085, 0.007, 0.009),
_materials.dark_steel
)
func _add_knob(root: Node3D, knob_position: Vector3) -> void:
CockpitMeshFactory.add_cylinder(
"ControlKnob",
root,
knob_position,
0.027,
0.026,
_materials.rubber,
Vector3(90.0, 0.0, 0.0)
)
_control_count += 1