Refactor game HUD scenes and harden attack checks

This commit is contained in:
dingo
2026-05-07 13:38:19 -04:00
parent 3be1099d93
commit 11c1fcb13a
9 changed files with 688 additions and 775 deletions
@@ -1,37 +1,10 @@
[gd_scene load_steps=20 format=3 uid="uid://b17evi1hw4dqu"]
[gd_scene load_steps=6 format=3 uid="uid://b17evi1hw4dqu"]
[ext_resource type="Script" uid="uid://b8x84lb58h6gx" path="res://scenes/game/game_screen.gd" id="1_gscr"]
[ext_resource type="Texture2D" uid="uid://dvmripj4jux0b" path="res://icons/SP-Symbol-White.png" id="2_056su"]
[ext_resource type="PackedScene" path="res://scenes/game/InGameSettings.tscn" id="2_igs"]
[ext_resource type="Texture2D" uid="uid://csvmdo2kwnh7c" path="res://icons/ST-Symbol-White.png" id="3_wukpb"]
[ext_resource type="Texture2D" uid="uid://beyeu0y34m3v4" path="res://ui/icons/Deck Icon.png" id="4_ld7sk"]
[ext_resource type="Texture2D" uid="uid://c65s8sn4p7s37" path="res://ui/icons/Discard Icon.png" id="5_pryjh"]
[ext_resource type="Texture2D" uid="uid://psjb7swm36jx" path="res://ui/icons/Green_Gem_Arrow_Button_Click.png" id="6_pryjh"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wukpb"]
[sub_resource type="Theme" id="Theme_056su"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ld7sk"]
bg_color = Color(0.38039216, 0.38039216, 0.38039216, 0.58431375)
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xjmfi"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pryjh"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_pnc6c"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_2dkum"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_7me7j"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_msfbn"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ld7sk"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_w2jaq"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_fuou0"]
[ext_resource type="PackedScene" path="res://scenes/game/components/hud/hud_controller.tscn" id="3_hudctrl"]
[ext_resource type="PackedScene" uid="uid://cowqg2xdx0x7g" path="res://scenes/game/components/hud/hand_manager.tscn" id="4_handmgr"]
[ext_resource type="PackedScene" path="res://scenes/game/components/overlays/game_over_overlay.tscn" id="5_goo"]
[node name="GameScreen" type="Node3D"]
script = ExtResource("1_gscr")
@@ -59,368 +32,13 @@ transform = Transform3D(1, 0, 0, 0, 0.766044, 0.642788, 0, -0.642788, 0.766044,
[node name="HUD" type="CanvasLayer" parent="."]
layer = 10
[node name="TopBar" type="HBoxContainer" parent="HUD"]
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 48.0
theme_override_constants/separation = 0
[node name="PhaseLabel" type="Label" parent="HUD/TopBar"]
[node name="HudController" parent="HUD" instance=ExtResource("3_hudctrl")]
unique_name_in_owner = true
custom_minimum_size = Vector2(140, 48)
layout_mode = 2
theme_override_font_sizes/font_size = 13
text = "Phase: —"
vertical_alignment = 1
layout_mode = 3
[node name="TurnLabel" type="Label" parent="HUD/TopBar"]
[node name="HandManager" parent="HUD" instance=ExtResource("4_handmgr")]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_font_sizes/font_size = 13
text = "Turn 1 — Your turn"
horizontal_alignment = 1
vertical_alignment = 1
[node name="TurnOrderStrip" type="HBoxContainer" parent="HUD/TopBar"]
unique_name_in_owner = true
visible = false
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 4
[node name="OpponentPanel" type="HBoxContainer" parent="HUD/TopBar"]
unique_name_in_owner = true
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
[node name="OppHandLabel" type="Label" parent="HUD/TopBar/OpponentPanel"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 12
text = "Hand: 0"
vertical_alignment = 1
[node name="OppDeckLabel" type="Label" parent="HUD/TopBar/OpponentPanel"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 12
text = "Deck: 0"
vertical_alignment = 1
[node name="OppDiscardBtn" type="Button" parent="HUD/TopBar/OpponentPanel"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 11
text = "Discard"
[node name="SP-ST Panel Container" type="PanelContainer" parent="HUD"]
anchors_preset = -1
anchor_top = 0.675
anchor_bottom = 0.675
offset_top = -156.40002
offset_right = 76.0
offset_bottom = -0.4000244
theme_override_styles/panel = SubResource("StyleBoxEmpty_wukpb")
[node name="VBoxContainer" type="VBoxContainer" parent="HUD/SP-ST Panel Container"]
layout_mode = 2
alignment = 2
[node name="TextureRect" type="TextureRect" parent="HUD/SP-ST Panel Container/VBoxContainer"]
self_modulate = Color(0, 0.8117647, 0.77254903, 0.38039216)
texture_filter = 5
custom_minimum_size = Vector2(1.78, 76)
layout_mode = 2
theme = SubResource("Theme_056su")
texture = ExtResource("2_056su")
expand_mode = 1
[node name="SpLabel" type="Label" parent="HUD/SP-ST Panel Container/VBoxContainer/TextureRect"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.513
anchor_top = 0.36800003
anchor_right = 0.513
anchor_bottom = 0.36800003
offset_left = -18.987999
offset_top = -22.968002
offset_right = 19.012001
offset_bottom = 23.031998
tooltip_text = "Spirit Points"
mouse_filter = 1
theme_override_colors/font_color = Color(0.012617188, 0.012617188, 0.012617188, 1)
theme_override_font_sizes/font_size = 33
text = "88"
horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="TextureRect2" type="TextureRect" parent="HUD/SP-ST Panel Container/VBoxContainer"]
self_modulate = Color(0, 0.8117647, 0.77254903, 0.38039216)
texture_filter = 5
custom_minimum_size = Vector2(1.78, 76)
layout_mode = 2
theme = SubResource("Theme_056su")
texture = ExtResource("3_wukpb")
expand_mode = 1
[node name="StLabel" type="Label" parent="HUD/SP-ST Panel Container/VBoxContainer/TextureRect2"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_top = 0.32200003
anchor_right = 0.5
anchor_bottom = 0.32200003
offset_left = -20.0
offset_top = -20.472002
offset_right = 22.0
offset_bottom = 25.527998
tooltip_text = "Sacrifice Tokens"
mouse_filter = 1
theme_override_colors/font_color = Color(0.06469653, 0.06469653, 0.06469653, 1)
theme_override_font_sizes/font_size = 33
text = "88"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ActionRail" type="PanelContainer" parent="HUD"]
anchors_preset = 3
anchor_left = 1.0
anchor_top = 1.0
anchor_right = 1.0
anchor_bottom = 1.0
offset_left = -262.0
offset_top = -220.0
offset_right = -70.0
offset_bottom = -56.0
grow_horizontal = 0
grow_vertical = 0
theme_override_styles/panel = SubResource("StyleBoxFlat_ld7sk")
[node name="RailMargin" type="MarginContainer" parent="HUD/ActionRail"]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 8
[node name="RailHBox" type="HBoxContainer" parent="HUD/ActionRail/RailMargin"]
layout_mode = 2
theme_override_constants/separation = 12
[node name="Deck-Discard Panel Container" type="Control" parent="HUD/ActionRail/RailMargin/RailHBox"]
custom_minimum_size = Vector2(76, 0)
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
alignment = 2
[node name="TextureRect" type="TextureRect" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer"]
self_modulate = Color(0, 0.8117647, 0.77254903, 0.38039216)
texture_filter = 5
custom_minimum_size = Vector2(1.78, 76)
layout_mode = 2
theme = SubResource("Theme_056su")
texture = ExtResource("4_ld7sk")
expand_mode = 1
[node name="DeckLabel" type="Label" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer/TextureRect"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.507
anchor_top = 0.40789473
anchor_right = 0.507
anchor_bottom = 0.40789473
offset_left = -22.532001
offset_top = -36.0
offset_right = 22.467999
offset_bottom = 10.0
grow_horizontal = 2
grow_vertical = 2
tooltip_text = "Cards in Deck"
mouse_filter = 1
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 33
text = "88"
horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_use_anchors_ = true
[node name="TextureRect2" type="TextureRect" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer"]
self_modulate = Color(0, 0.8117647, 0.77254903, 0.38039216)
texture_filter = 5
custom_minimum_size = Vector2(1.78, 76)
layout_mode = 2
theme = SubResource("Theme_056su")
expand_mode = 1
[node name="DiscardBtn" type="Button" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer/TextureRect2"]
unique_name_in_owner = true
layout_mode = 0
offset_left = -4.000001
offset_top = -5.000001
offset_right = 568.0
offset_bottom = 275.0
scale = Vector2(0.14754085, 0.23068035)
tooltip_text = "View Discard"
theme_override_colors/icon_normal_color = Color(0.18431373, 0.49411765, 0.47843137, 1)
theme_override_colors/icon_focus_color = Color(0.18431373, 0.49411765, 0.47843137, 1)
theme_override_colors/icon_pressed_color = Color(0.35976923, 0.7944459, 0.77106035, 1)
theme_override_colors/icon_hover_color = Color(0.18431373, 0.49411765, 0.47843137, 1)
theme_override_colors/icon_hover_pressed_color = Color(0.18431373, 0.49411765, 0.47843137, 1)
theme_override_font_sizes/font_size = 12
theme_override_icons/icon = ExtResource("5_pryjh")
theme_override_styles/normal = SubResource("StyleBoxEmpty_xjmfi")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_pryjh")
theme_override_styles/hover = SubResource("StyleBoxEmpty_pnc6c")
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_2dkum")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_7me7j")
theme_override_styles/focus = SubResource("StyleBoxEmpty_msfbn")
[node name="DiscardLabel" type="Label" parent="HUD/ActionRail/RailMargin/RailHBox/Deck-Discard Panel Container/VBoxContainer/TextureRect2"]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.5
anchor_top = 0.32200003
anchor_right = 0.5
anchor_bottom = 0.32200003
offset_left = -20.0
offset_top = -31.472002
offset_right = 22.0
offset_bottom = 14.527998
theme_override_colors/font_color = Color(0.06469653, 0.06469653, 0.06469653, 1)
theme_override_font_sizes/font_size = 33
text = "88"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Controls" type="Control" parent="HUD/ActionRail/RailMargin/RailHBox"]
layout_mode = 2
size_flags_horizontal = 3
[node name="RightVBox" type="VBoxContainer" parent="HUD/ActionRail/RailMargin/RailHBox/Controls"]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 6
[node name="EndTurnBtn" type="Button" parent="HUD/ActionRail/RailMargin/RailHBox/Controls/RightVBox"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 36)
layout_mode = 2
theme_override_font_sizes/font_size = 13
text = "End Turn"
[node name="DrawBtn" type="Button" parent="HUD/ActionRail/RailMargin/RailHBox/Controls/RightVBox"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 36)
layout_mode = 2
theme_override_font_sizes/font_size = 13
text = "Draw Card"
[node name="SettingsBtn" type="Button" parent="HUD/ActionRail/RailMargin/RailHBox/Controls/RightVBox"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 36)
layout_mode = 2
theme_override_font_sizes/font_size = 12
text = "Settings"
[node name="ChatBubbleHost" type="Control" parent="HUD/ActionRail/RailMargin/RailHBox/Controls/RightVBox"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 36)
layout_mode = 2
[node name="SpectatorLeaveBtn" type="Button" parent="HUD/ActionRail/RailMargin/RailHBox/Controls/RightVBox"]
unique_name_in_owner = true
visible = false
custom_minimum_size = Vector2(0, 36)
layout_mode = 2
theme_override_font_sizes/font_size = 12
text = "Leave Spectator"
[node name="HandArea" type="PanelContainer" parent="HUD"]
anchors_preset = -1
anchor_top = 1.0
anchor_right = 0.75
anchor_bottom = 1.0
offset_top = -248.0
offset_bottom = 2.0
mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_ld7sk")
[node name="HandScroll" type="Control" parent="HUD/HandArea"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
[node name="HandCards" type="Control" parent="HUD/HandArea/HandScroll"]
unique_name_in_owner = true
anchors_preset = 0
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="Panel" type="Panel" parent="HUD/HandArea"]
layout_mode = 2
mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_w2jaq")
[node name="HandSpinLeft" type="TextureButton" parent="HUD/HandArea/Panel"]
unique_name_in_owner = true
custom_minimum_size = Vector2(22, 22)
layout_mode = 0
offset_left = -2.0
offset_top = -4.0
offset_right = 69.0
offset_bottom = 104.0
scale = Vector2(1.9999998, 1.44)
texture_normal = ExtResource("6_pryjh")
ignore_texture_size = true
stretch_mode = 5
flip_h = true
[node name="Panel2" type="Panel" parent="HUD/HandArea"]
layout_mode = 2
mouse_filter = 2
theme_override_styles/panel = SubResource("StyleBoxEmpty_fuou0")
[node name="HandSpinRight" type="TextureButton" parent="HUD/HandArea/Panel2"]
unique_name_in_owner = true
custom_minimum_size = Vector2(22, 22)
layout_mode = 0
offset_left = 963.0
offset_top = 6.0
offset_right = 1030.0
offset_bottom = 108.0
scale = Vector2(2.08, 1.6)
texture_normal = ExtResource("6_pryjh")
ignore_texture_size = true
stretch_mode = 5
visible = true
[node name="RightPanel" type="PanelContainer" parent="HUD"]
visible = false
@@ -435,33 +53,6 @@ offset_right = -1.0
offset_bottom = 9.0
scale = Vector2(1, 0.96000004)
[node name="SpectatorPlayersPanel" type="PanelContainer" parent="HUD"]
unique_name_in_owner = true
visible = false
anchors_preset = -1
anchor_top = 1.0
anchor_right = 0.75
anchor_bottom = 1.0
offset_top = -200.0
[node name="SpectatorMargin" type="MarginContainer" parent="HUD/SpectatorPlayersPanel"]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
[node name="SpectatorScroll" type="ScrollContainer" parent="HUD/SpectatorPlayersPanel/SpectatorMargin"]
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="SpectatorPlayerList" type="VBoxContainer" parent="HUD/SpectatorPlayersPanel/SpectatorMargin/SpectatorScroll"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 4
[node name="TileDrawerToggleBtn" type="Button" parent="HUD"]
unique_name_in_owner = true
custom_minimum_size = Vector2(36, 48)
@@ -526,89 +117,8 @@ layout_mode = 2
theme_override_font_sizes/font_size = 12
text = "Close"
[node name="DiscardViewer" type="PanelContainer" parent="HUD"]
[node name="GameOverOverlay" parent="HUD" instance=ExtResource("5_goo")]
unique_name_in_owner = true
visible = false
anchors_preset = -1
anchor_left = 0.1
anchor_top = 0.05
anchor_right = 0.9
anchor_bottom = 0.95
[node name="DVMargin" type="MarginContainer" parent="HUD/DiscardViewer"]
layout_mode = 2
theme_override_constants/margin_left = 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"]
layout_mode = 2
theme_override_constants/separation = 8
[node name="DVTitle" type="Label" parent="HUD/DiscardViewer/DVMargin/DVVBox"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 16
text = "Discard Pile"
[node name="DVScroll" type="ScrollContainer" parent="HUD/DiscardViewer/DVMargin/DVVBox"]
layout_mode = 2
size_flags_vertical = 3
horizontal_scroll_mode = 0
[node name="DVList" type="VBoxContainer" parent="HUD/DiscardViewer/DVMargin/DVVBox/DVScroll"]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 4
[node name="DVCloseBtn" type="Button" parent="HUD/DiscardViewer/DVMargin/DVVBox"]
unique_name_in_owner = true
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
visible = false
anchors_preset = -1
anchor_left = 0.25
anchor_top = 0.25
anchor_right = 0.75
anchor_bottom = 0.75
[node name="GOMargin" type="MarginContainer" parent="HUD/GameOverOverlay"]
layout_mode = 2
theme_override_constants/margin_left = 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"]
layout_mode = 2
theme_override_constants/separation = 16
[node name="GOResultLabel" type="Label" parent="HUD/GameOverOverlay/GOMargin/GOVBox"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 28
text = "Game Over"
horizontal_alignment = 1
[node name="GORankLabel" type="Label" parent="HUD/GameOverOverlay/GOMargin/GOVBox"]
unique_name_in_owner = true
layout_mode = 2
theme_override_font_sizes/font_size = 15
horizontal_alignment = 1
[node name="GOMainMenuBtn" type="Button" parent="HUD/GameOverOverlay/GOMargin/GOVBox"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 44)
layout_mode = 2
theme_override_font_sizes/font_size = 15
text = "Return to Main Menu"
[node name="CamCtrlPanel" type="PanelContainer" parent="HUD"]
unique_name_in_owner = true