magicciv/.project/objectives/p2-02-hud-tooltips.md
Natalie f4668ce25d fix(@projects/@magic-civilization): 🐛 resolve broken guide-web deploy import paths
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-04-17 02:51:34 -07:00

3.4 KiB

id title priority status scope owner updated_at evidence
p2-02 Tooltips on all HUD elements p2 done game1 shipwright 2026-04-17
public/games/age-of-dwarves/vocabulary.json
src/game/engine/scenes/hud/top_bar.gd
src/game/engine/scenes/hud/top_bar.tscn
src/game/engine/scenes/hud/unit_panel.gd
src/game/engine/scenes/hud/end_turn_button.gd
src/game/engine/scenes/hud/world_map_hud.gd
src/game/engine/tests/unit/test_hud_tooltips.gd

Summary

Every interactive HUD control now carries a tooltip_text resolved through ThemeVocabulary.lookup("tooltip_<key>"). The vocabulary file ships a dedicated tooltip_* namespace so theme packs can localize hover copy without touching scenes. Stat-row Labels also set mouse_filter = MOUSE_FILTER_STOP — Godot otherwise swallows hover on container-managed Labels, so without this tooltips never fire on TurnLabel / EraLabel / Gold / Science / HP / Movement rows.

Acceptance

  • ✓ Every interactive HUD element has a tooltip via Control.tooltip_texttop_bar.gd:_apply_tooltips() covers Turn, Era, Gold, Science, Happiness, GoldenAgeBadge, DiplomacySegment, Stats / Encyclopedia / BugReport buttons. unit_panel.gd:_apply_tooltips() covers Attack, Defense, HP label + bar, Movement, Fortify / Skip / FoundCity buttons. end_turn_button.gd:14 sets tooltip on the End Turn button. world_map_hud.gd sets tooltips on TechTree / Chronicle / EndTurn / FoundCity / BuildImprovement buttons.
  • ✓ Text resolves through ThemeVocabulary.lookup() (no hardcoded strings) — all 21 call-sites use lookup("tooltip_<key>"). Prior hardcoded tooltip_text = "Demographics (F9)" / "Encyclopedia (F1)" / "Report Bug" strings on top_bar.tscn:149,158,167 were removed; the runtime _apply_tooltips() pass is now authoritative. The single remaining hardcoded tooltip_text in top_bar.tscn is gone after this change.

Tests

  • src/game/engine/tests/unit/test_hud_tooltips.gd — validates that all 21 tooltip_<key> entries exist in vocabulary, each resolves to a non-fallback non-empty string (distinct from title-cased key echo), and descriptive tooltips differ from button labels. Also asserts the _apply_tooltips() init helper exists on top_bar.gd and unit_panel.gd.

Coverage matrix

Element Controller Tooltip key
TurnLabel top_bar tooltip_turn
EraLabel top_bar tooltip_era
GoldLabel top_bar tooltip_gold
ScienceLabel top_bar tooltip_science
HappinessLabel top_bar tooltip_happiness
GoldenAgeBadge top_bar tooltip_golden_age
DiplomacySegment top_bar tooltip_diplomacy
StatsButton top_bar tooltip_stats
EncyclopediaButton top_bar tooltip_encyclopedia
BugReportButton top_bar tooltip_bug_report
EndTurnButton end_turn_button tooltip_end_turn
TechButton world_map_hud tooltip_tech_tree
ChronicleButton world_map_hud tooltip_chronicle
AttackLabel unit_panel tooltip_attack
DefenseLabel unit_panel tooltip_defense
HPLabel + HPBar unit_panel tooltip_hit_points
MovementLabel unit_panel tooltip_movement
FortifyButton unit_panel tooltip_fortify
SkipButton unit_panel tooltip_skip_turn
FoundCityButton unit_panel, world_map_hud tooltip_found_city
BuildImprovementButton world_map_hud tooltip_build_improvement