mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 17:43:42 +00:00
fix(hud): have game mode hand HUD its target ship instead of group lookup
HUDController found its ship via get_first_node_in_group("ship"), a group
that has 2+ members once a match has an AI opponent — it only worked
because the player ship happened to spawn first. spawn_camera_rig now
wires the HUD's ship the same way it already wires the camera rig's
target.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
# HUD Controller - discovers the ship/camera/game mode via groups and routes
|
||||
# their signals to the display widgets. All flight data is rendered by
|
||||
# aircraft-style instruments (attitude indicator, heading tape, bar gauges) —
|
||||
# this node is only the wiring hub; the instruments are dumb displays.
|
||||
# HUD Controller - receives its target ship from the game mode (see
|
||||
# GameMode.spawn_camera_rig), discovers the camera rig/game mode via groups,
|
||||
# and routes their signals to the display widgets. All flight data is
|
||||
# rendered by aircraft-style instruments (attitude indicator, heading tape,
|
||||
# bar gauges) — this node is only the wiring hub; the instruments are dumb
|
||||
# displays.
|
||||
extends CanvasLayer
|
||||
class_name HUDController
|
||||
|
||||
@@ -33,10 +35,11 @@ func _ready():
|
||||
_initialize_hud()
|
||||
|
||||
func _initialize_hud():
|
||||
# Find the ship
|
||||
ship = get_tree().get_first_node_in_group("ship")
|
||||
# `ship` is assigned by the game mode (GameMode.spawn_camera_rig) before
|
||||
# this runs — not discovered via group, since the "ship" group can have
|
||||
# 2+ members and there's no reliable way to tell which one is "ours".
|
||||
if not ship:
|
||||
push_error("HUDController: No ship found in 'ship' group")
|
||||
push_error("HUDController: No ship assigned")
|
||||
return
|
||||
|
||||
print("HUDController: Found ship: ", ship.name)
|
||||
|
||||
Reference in New Issue
Block a user