refactor(team-colors): collapse disagreeing team palettes into one source of truth

ship.gd, HUDController.gd, and goal.gd each declared their own TEAM_COLORS,
arena_boundary.gd/arena_deck.gdshader had a third pair, and HUD.tscn baked
in a fourth (hardcoded "BLUE"/"ORANGE" labels) — nose, goal rim, end zone,
and scoreboard all rendered different blues. New scripts/team_colors.gd
(class_name TeamColors) is now the single source every one of those reads
from, and team identity moves to purple/green.
This commit is contained in:
Josh Creek
2026-08-04 19:18:45 +01:00
parent ff2e40198f
commit fa9590d9c3
9 changed files with 39 additions and 30 deletions
+17 -7
View File
@@ -24,10 +24,6 @@ class_name HUDController
@onready var thrust_bar: HudGauge = get_node_or_null("Control/Instruments/Cluster/ThrustBar")
@onready var camera_mode_label = get_node_or_null("Control/Instruments/Cluster/CameraModeLabel")
# Team identity, mirroring TEAM_COLORS in ship.gd
const TEAM_NAMES := {0: "Blue", 1: "Orange"}
const TEAM_COLORS := {0: Color(0.25, 0.55, 1.0), 1: Color(1.0, 0.5, 0.15)}
var ship: Node
var _last_score := {0: 0, 1: 0}
@@ -66,6 +62,20 @@ func _initialize_hud():
if timer_label and is_instance_valid(timer_label):
timer_label.visible = has_timer
# Team identity (name + color) is fixed regardless of whether this
# mode tracks score, so set it here rather than baking it into the
# scene where it can't track TeamColors.
if team0_name_label and is_instance_valid(team0_name_label):
team0_name_label.text = TeamColors.TEAM_NAMES[0]
team0_name_label.add_theme_color_override("font_color", TeamColors.TEAM_COLORS[0])
if team0_score_label and is_instance_valid(team0_score_label):
team0_score_label.add_theme_color_override("font_color", TeamColors.TEAM_COLORS[0])
if team1_score_label and is_instance_valid(team1_score_label):
team1_score_label.add_theme_color_override("font_color", TeamColors.TEAM_COLORS[1])
if team1_name_label and is_instance_valid(team1_name_label):
team1_name_label.text = TeamColors.TEAM_NAMES[1]
team1_name_label.add_theme_color_override("font_color", TeamColors.TEAM_COLORS[1])
# Score display follows the same pattern: modes without scoring
# (e.g. free play) just don't show it
var has_score = game_manager and game_manager.has_signal("score_changed")
@@ -177,9 +187,9 @@ func _on_match_ended(winning_team: int, score: Dictionary):
result_label.remove_theme_color_override("font_color")
_set_result_panel_accent(Color(1, 1, 1, 0.2))
else:
result_label.text = "%s team wins!" % TEAM_NAMES[winning_team]
result_label.add_theme_color_override("font_color", TEAM_COLORS[winning_team])
_set_result_panel_accent(TEAM_COLORS[winning_team])
result_label.text = "%s team wins!" % TeamColors.TEAM_NAMES[winning_team]
result_label.add_theme_color_override("font_color", TeamColors.TEAM_COLORS[winning_team])
_set_result_panel_accent(TeamColors.TEAM_COLORS[winning_team])
final_score_label.text = "%d - %d" % [score.get(0, 0), score.get(1, 0)]
result_overlay.visible = true
_animate_result_panel_in()