Files
Ransom-s-wake/game/presentation/sonar/sonar_display.gd
T
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

85 lines
2.1 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
class_name SonarDisplay
extends Control
const SonarScan = preload("res://game/domain/sonar/sonar_scan.gd")
const SonarScanState = preload("res://game/domain/sonar/sonar_scan_state.gd")
const BathymetricSonarRendererScript = preload(
"res://game/presentation/sonar/sonar_relief_renderer.gd"
)
@onready var _renderer: Node = %SonarReliefRenderer
@onready var _expanded_panel: PanelContainer = %ExpandedPanel
@onready var _expanded_view: TextureRect = %ExpandedView
@onready var _status_label: Label = %StatusLabel
func _ready() -> void:
_expanded_view.texture = _renderer.render_texture()
_expanded_panel.visible = false
func present(
current_scan: SonarScan,
previous_scan: SonarScan,
visible_rows: int,
previous_opacity: float
) -> void:
if current_scan == null:
_status_label.text = "SONAR PRÊT · F POUR ÉMETTRE"
return
_renderer.present(current_scan, previous_scan, visible_rows, previous_opacity)
_status_label.text = "%s · %.0f %% · %.0f–%.0f m · %d CONTACT(S)" % [
_state_text(current_scan.state),
current_scan.reveal_progress * 100.0,
current_scan.minimum_elevation_m,
current_scan.maximum_elevation_m,
_renderer.visible_contact_count(),
]
func toggle_expanded() -> void:
_expanded_panel.visible = not _expanded_panel.visible
func is_expanded() -> bool:
return _expanded_panel.visible
func sonar_texture() -> Texture2D:
return _renderer.render_texture()
func built_row_count() -> int:
return _renderer.built_row_count()
func built_triangle_count() -> int:
return _renderer.built_triangle_count()
func built_grid_segment_count() -> int:
return _renderer.built_grid_segment_count()
func depth_scale_texts() -> PackedStringArray:
return _renderer.depth_scale_texts()
func idle_prompt_visible() -> bool:
return _renderer.idle_prompt_visible()
func status_text() -> String:
return _status_label.text
func _state_text(state: SonarScanState.Value) -> String:
match state:
SonarScanState.Value.REVEALING:
return "RELEVÉ EN COURS"
SonarScanState.Value.RECOVERY:
return "RÉCUPÉRATION"
SonarScanState.Value.READY:
return "RELEVÉ DISPONIBLE"
return "CAPTURE"