The calibration site spawn sat 16 m from the south bounds edge, inside the 40 m warning margin. The vehicle_test recipe now extends the terrain and playable bounds 42 m to the south so the spawn is inside the zone. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
80 lines
2.8 KiB
GDScript
80 lines
2.8 KiB
GDScript
class_name CockpitHud
|
|
extends Control
|
|
|
|
const DiveUpdate = preload("res://game/domain/dive/dive_update.gd")
|
|
const DiveAlertLevel = preload("res://game/domain/dive/dive_alert_level.gd")
|
|
const DiveTerminalReason = preload("res://game/domain/dive/dive_terminal_reason.gd")
|
|
const VehicleTelemetry = preload("res://game/application/dive/vehicle_telemetry.gd")
|
|
const PlayableBoundsStatus = preload("res://game/application/sites/playable_bounds_status.gd")
|
|
|
|
@onready var _alert_panel: PanelContainer = %AlertPanel
|
|
@onready var _alert_label: Label = %AlertLabel
|
|
@onready var _bounds_panel: PanelContainer = %BoundsPanel
|
|
@onready var _bounds_label: Label = %BoundsLabel
|
|
@onready var _ejection_panel: PanelContainer = %EjectionPanel
|
|
@onready var _ejection_label: Label = %EjectionLabel
|
|
@onready var _terminal_panel: PanelContainer = %TerminalPanel
|
|
@onready var _terminal_label: Label = %TerminalLabel
|
|
|
|
|
|
func present(update: DiveUpdate, telemetry: VehicleTelemetry) -> void:
|
|
if update == null or update.snapshot == null or telemetry == null:
|
|
return
|
|
var snapshot = update.snapshot
|
|
_alert_panel.visible = snapshot.alerts.maximum != DiveAlertLevel.Value.NORMAL
|
|
_alert_label.text = "ALERTE · %s" % _alert_text(snapshot.alerts.maximum)
|
|
_ejection_panel.visible = snapshot.ejection.held_seconds > 0.0
|
|
_ejection_label.text = "ÉJECTION %.0f %%" % (snapshot.ejection.ratio * 100.0)
|
|
_terminal_panel.visible = snapshot.is_terminal()
|
|
if snapshot.is_terminal():
|
|
_terminal_label.text = "%s\nÉchap pour ouvrir le menu de pause." % [
|
|
_terminal_text(snapshot.terminal_reason)
|
|
]
|
|
|
|
|
|
func present_bounds(status: PlayableBoundsStatus) -> void:
|
|
if status == null or not status.requires_warning():
|
|
_bounds_panel.visible = false
|
|
return
|
|
_bounds_panel.visible = true
|
|
if status.state == PlayableBoundsStatus.State.OUTSIDE:
|
|
_bounds_label.text = tr("HORS ZONE · FAITES DEMI-TOUR")
|
|
else:
|
|
_bounds_label.text = "%s · %d m" % [tr("LIMITE DE ZONE"), int(status.distance_to_edge_m)]
|
|
|
|
|
|
func bounds_warning_visible() -> bool:
|
|
return _bounds_panel.visible
|
|
|
|
|
|
func alert_overlay_visible() -> bool:
|
|
return _alert_panel.visible
|
|
|
|
|
|
func _alert_text(level: DiveAlertLevel.Value) -> String:
|
|
match level:
|
|
DiveAlertLevel.Value.NORMAL:
|
|
return tr("NORMAL")
|
|
DiveAlertLevel.Value.ATTENTION:
|
|
return tr("ATTENTION")
|
|
DiveAlertLevel.Value.RETURN:
|
|
return tr("RETOUR")
|
|
DiveAlertLevel.Value.CRITICAL:
|
|
return tr("CRITIQUE")
|
|
DiveAlertLevel.Value.FAILURE:
|
|
return tr("DÉFAILLANCE")
|
|
return tr("INCONNU")
|
|
|
|
|
|
func _terminal_text(reason: DiveTerminalReason.Value) -> String:
|
|
match reason:
|
|
DiveTerminalReason.Value.VOLUNTARY_EJECTION:
|
|
return tr("ÉJECTION DÉCLENCHÉE")
|
|
DiveTerminalReason.Value.OXYGEN_DEPLETED:
|
|
return tr("OXYGÈNE ÉPUISÉ")
|
|
DiveTerminalReason.Value.HULL_DESTROYED:
|
|
return tr("COQUE DÉTRUITE")
|
|
DiveTerminalReason.Value.RETURNED:
|
|
return tr("RETOUR TERMINÉ")
|
|
return tr("PLONGÉE TERMINÉE")
|