Fix: Spirit card highlights — emissive material, preserve selection through state updates

- _add_highlight: use emission (emission_energy_multiplier=2) + 75% opaque base
  so tiles glow visibly regardless of depth-sort/transparency ordering; raised
  Y to 0.58 (clear of tile top at 0.50); thicker mesh (0.06 vs 0.02)
- Remove Godot-3-only flags_transparent property (no-op in Godot 4)
- _on_state_updated: preserve CARD_FROM_HAND / TERRAMORPHA_SELECT through server
  state pushes if selected card is still in hand (re-apply highlights after
  _rebuild_hand); only clear UNIT_SELECTED and other transient modes
- Add diagnostic prints to _add_highlight and _on_state_updated to trace when
  state updates arrive relative to card selection

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-03-08 12:40:48 -04:00
co-authored by Claude Happy
parent 101e671752
commit b36a644f56
3 changed files with 73 additions and 50 deletions
@@ -1,6 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://game_screen"]
[gd_scene load_steps=2 format=3 uid="uid://b17evi1hw4dqu"]
[ext_resource type="Script" path="res://scenes/game/game_screen.gd" id="1_gscr"]
[ext_resource type="Script" uid="uid://b8x84lb58h6gx" path="res://scenes/game/game_screen.gd" id="1_gscr"]
[node name="GameScreen" type="Node3D"]
script = ExtResource("1_gscr")
@@ -29,19 +29,15 @@ transform = Transform3D(1, 0, 0, 0, 0.766044, 0.642788, 0, -0.642788, 0.766044,
layer = 10
[node name="TopBar" type="HBoxContainer" parent="HUD"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 0.0
offset_bottom = 48.0
theme_override_constants/separation = 0
[node name="PhaseLabel" type="Label" parent="HUD/TopBar"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(140, 48)
layout_mode = 2
theme_override_font_sizes/font_size = 13
text = "Phase: —"
vertical_alignment = 1
@@ -57,17 +53,17 @@ vertical_alignment = 1
[node name="OpponentPanel" type="HBoxContainer" parent="HUD/TopBar"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(240, 48)
layout_mode = 2
theme_override_constants/separation = 8
[node name="OppNameLabel" type="Label" parent="HUD/TopBar/OpponentPanel"]
unique_name_in_owner = true
modulate = Color(1, 0.5, 0.5, 1)
layout_mode = 2
theme_override_font_sizes/font_size = 12
text = "Opponent"
vertical_alignment = 1
modulate = Color(1, 0.5, 0.5, 1)
[node name="OppHandLabel" type="Label" parent="HUD/TopBar/OpponentPanel"]
unique_name_in_owner = true
@@ -90,14 +86,11 @@ theme_override_font_sizes/font_size = 11
text = "Discard"
[node name="HandArea" type="PanelContainer" parent="HUD"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.0
anchor_top = 1.0
anchor_right = 0.75
anchor_bottom = 1.0
offset_top = -220.0
offset_right = 0.0
offset_top = -250.0
[node name="HandScroll" type="ScrollContainer" parent="HUD/HandArea"]
unique_name_in_owner = true
@@ -113,19 +106,22 @@ size_flags_vertical = 4
theme_override_constants/separation = 6
[node name="RightPanel" type="PanelContainer" parent="HUD"]
layout_mode = 1
anchors_preset = -1
anchor_left = 0.75
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_top = -220.0
offset_left = -1.0
offset_top = -241.0
offset_right = -1.0
offset_bottom = 9.0
scale = Vector2(1, 0.96000004)
[node name="RightMargin" type="MarginContainer" parent="HUD/RightPanel"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 8
[node name="RightVBox" type="VBoxContainer" parent="HUD/RightPanel/RightMargin"]
@@ -156,21 +152,17 @@ layout_mode = 2
theme_override_font_sizes/font_size = 12
text = "View Discard"
[node name="Spacer" type="Control" parent="HUD/RightPanel/RightMargin/RightVBox"]
layout_mode = 2
size_flags_vertical = 3
[node name="DrawBtn" type="Button" parent="HUD/RightPanel/RightMargin/RightVBox"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 36)
layout_mode = 2
theme_override_font_sizes/font_size = 13
text = "Draw Card"
[node name="EndTurnBtn" type="Button" parent="HUD/RightPanel/RightMargin/RightVBox"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 36)
layout_mode = 2
theme_override_font_sizes/font_size = 13
text = "End Turn"
@@ -182,7 +174,7 @@ text = "Concede"
[node name="ContextPopup" type="PanelContainer" parent="HUD"]
unique_name_in_owner = true
layout_mode = 1
visible = false
anchors_preset = -1
anchor_left = 0.5
anchor_top = 0.5
@@ -192,13 +184,12 @@ offset_left = -160.0
offset_top = -120.0
offset_right = 160.0
offset_bottom = 120.0
visible = false
[node name="ContextMargin" type="MarginContainer" parent="HUD/ContextPopup"]
layout_mode = 2
theme_override_constants/margin_left = 12
theme_override_constants/margin_right = 12
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 12
theme_override_constants/margin_bottom = 8
[node name="ContextVBox" type="VBoxContainer" parent="HUD/ContextPopup/ContextMargin"]
@@ -215,16 +206,14 @@ text = "Tile (0,0) — Void"
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 12
text = ""
autowrap_mode = 3
[node name="ContextAbilitiesLabel" type="Label" parent="HUD/ContextPopup/ContextMargin/ContextVBox"]
unique_name_in_owner = true
modulate = Color(0.7, 0.7, 0.85, 1)
layout_mode = 2
theme_override_font_sizes/font_size = 11
text = ""
autowrap_mode = 3
modulate = Color(0.7, 0.7, 0.85, 1)
[node name="ContextClose" type="Button" parent="HUD/ContextPopup/ContextMargin/ContextVBox"]
unique_name_in_owner = true
@@ -234,18 +223,18 @@ text = "Close"
[node name="DiscardViewer" type="PanelContainer" parent="HUD"]
unique_name_in_owner = true
layout_mode = 1
visible = false
anchors_preset = -1
anchor_left = 0.1
anchor_top = 0.05
anchor_right = 0.9
anchor_bottom = 0.95
visible = false
[node name="DVMargin" type="MarginContainer" parent="HUD/DiscardViewer"]
layout_mode = 2
theme_override_constants/margin_left = 16
theme_override_constants/margin_right = 16
theme_override_constants/margin_top = 12
theme_override_constants/margin_right = 16
theme_override_constants/margin_bottom = 12
[node name="DVVBox" type="VBoxContainer" parent="HUD/DiscardViewer/DVMargin"]
@@ -271,25 +260,25 @@ theme_override_constants/separation = 4
[node name="DVCloseBtn" type="Button" parent="HUD/DiscardViewer/DVMargin/DVVBox"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 36)
layout_mode = 2
theme_override_font_sizes/font_size = 13
text = "Close"
[node name="GameOverOverlay" type="PanelContainer" parent="HUD"]
unique_name_in_owner = true
layout_mode = 1
visible = false
anchors_preset = -1
anchor_left = 0.25
anchor_top = 0.25
anchor_right = 0.75
anchor_bottom = 0.75
visible = false
[node name="GOMargin" type="MarginContainer" parent="HUD/GameOverOverlay"]
layout_mode = 2
theme_override_constants/margin_left = 24
theme_override_constants/margin_right = 24
theme_override_constants/margin_top = 24
theme_override_constants/margin_right = 24
theme_override_constants/margin_bottom = 24
[node name="GOVBox" type="VBoxContainer" parent="HUD/GameOverOverlay/GOMargin"]
@@ -307,13 +296,12 @@ horizontal_alignment = 1
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 15
text = ""
horizontal_alignment = 1
[node name="GOMainMenuBtn" type="Button" parent="HUD/GameOverOverlay/GOMargin/GOVBox"]
unique_name_in_owner = true
layout_mode = 2
custom_minimum_size = Vector2(0, 44)
layout_mode = 2
theme_override_font_sizes/font_size = 15
text = "Return to Main Menu"