Fixed Stalagmites
This commit is contained in:
@@ -0,0 +1,315 @@
|
||||
[gd_scene load_steps=3 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="PackedScene" path="res://scenes/game/InGameSettings.tscn" id="2_igs"]
|
||||
|
||||
[node name="GameScreen" type="Node3D"]
|
||||
script = ExtResource("1_gscr")
|
||||
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
|
||||
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||
transform = Transform3D(0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -0.5, 0.5, 0, 8, 0)
|
||||
light_energy = 1.2
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="CameraRig" type="Node3D" parent="."]
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="CameraRig"]
|
||||
transform = Transform3D(1, 0, 0, 0, 0.766044, 0.642788, 0, -0.642788, 0.766044, 0, 10, 9)
|
||||
|
||||
[node name="BoardRoot" type="Node3D" parent="."]
|
||||
|
||||
[node name="TilesRoot" type="Node3D" parent="BoardRoot"]
|
||||
|
||||
[node name="UnitsRoot" type="Node3D" parent="BoardRoot"]
|
||||
|
||||
[node name="HighlightsRoot" type="Node3D" parent="BoardRoot"]
|
||||
|
||||
[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"]
|
||||
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
|
||||
|
||||
[node name="TurnLabel" type="Label" parent="HUD/TopBar"]
|
||||
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="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="HandArea" type="PanelContainer" parent="HUD"]
|
||||
anchors_preset = -1
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.75
|
||||
anchor_bottom = 1.0
|
||||
offset_top = -250.0
|
||||
|
||||
[node name="HandScroll" type="ScrollContainer" parent="HUD/HandArea"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
vertical_scroll_mode = 0
|
||||
|
||||
[node name="HandCards" type="HBoxContainer" parent="HUD/HandArea/HandScroll"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 4
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="RightPanel" type="PanelContainer" parent="HUD"]
|
||||
anchors_preset = -1
|
||||
anchor_left = 0.75
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.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_top = 8
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 8
|
||||
|
||||
[node name="RightVBox" type="VBoxContainer" parent="HUD/RightPanel/RightMargin"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="SpLabel" type="Label" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
text = "SP: 0"
|
||||
|
||||
[node name="StLabel" type="Label" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 14
|
||||
text = "ST: 0"
|
||||
|
||||
[node name="DeckLabel" type="Label" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "Deck: 0"
|
||||
|
||||
[node name="DiscardBtn" type="Button" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "View Discard"
|
||||
|
||||
[node name="DrawBtn" type="Button" parent="HUD/RightPanel/RightMargin/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="EndTurnBtn" type="Button" parent="HUD/RightPanel/RightMargin/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="SettingsBtn" type="Button" parent="HUD/RightPanel/RightMargin/RightVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "Settings"
|
||||
|
||||
[node name="ContextPopup" type="PanelContainer" parent="HUD"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
anchors_preset = 8
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -160.0
|
||||
offset_top = -120.0
|
||||
offset_right = 160.0
|
||||
offset_bottom = 120.0
|
||||
|
||||
[node name="ContextMargin" type="MarginContainer" parent="HUD/ContextPopup"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 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"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="ContextTileLabel" type="Label" parent="HUD/ContextPopup/ContextMargin/ContextVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 13
|
||||
text = "Tile (0,0) — Void"
|
||||
|
||||
[node name="ContextUnitLabel" type="Label" parent="HUD/ContextPopup/ContextMargin/ContextVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
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
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="ContextClose" type="Button" parent="HUD/ContextPopup/ContextMargin/ContextVBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "Close"
|
||||
|
||||
[node name="DiscardViewer" type="PanelContainer" parent="HUD"]
|
||||
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="InGameSettings" parent="HUD" instance=ExtResource("2_igs")]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="HoldTimer" type="Timer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
wait_time = 0.5
|
||||
one_shot = true
|
||||
@@ -512,11 +512,17 @@ func _try_load_tile_model(body: StaticBody3D, affinity: String) -> void:
|
||||
child.queue_free()
|
||||
|
||||
b.add_child(model_node)
|
||||
# Scale so the XZ footprint fits the 0.98-unit tile square.
|
||||
# Scale so the XZ footprint fits the 0.98-unit tile square, then lift
|
||||
# the model so its base sits on the tile's TOP surface.
|
||||
# _fit_model_to_tile seats the AABB bottom at body-local Y=0, which is
|
||||
# world Y = tile_h/2 (the tile centre). Shifting by +tile_h/2 moves the
|
||||
# base up to body-local Y = tile_h/2 = world Y = tile_h (tile top).
|
||||
_fit_model_to_tile(model_node, 0.98)
|
||||
var tile_h_m : float = float(b.get_meta("tile_height", 1.0))
|
||||
model_node.position.y += tile_h_m * 0.5
|
||||
|
||||
# Attach a random stalagmite bottom model below the tile (if any are configured).
|
||||
var bottom_url := ContentCache.get_random_tile_bottom_url()
|
||||
var bottom_url : String = ContentCache.get_random_tile_bottom_url()
|
||||
if not bottom_url.is_empty():
|
||||
_try_load_tile_bottom(body_ref, bottom_url)
|
||||
)
|
||||
@@ -532,14 +538,18 @@ func _try_load_tile_bottom(body_ref: Variant, url: String) -> void:
|
||||
return
|
||||
if bottom_node == null:
|
||||
return
|
||||
# The body centre is at world Y = h/2. The bottom of the tile is at
|
||||
# body-local Y = -h/2. Scale the stalagmite to fit the tile footprint,
|
||||
# then flip it upside-down (scale Y = -1) so it hangs downward, and
|
||||
# seat its origin at the tile-bottom local position.
|
||||
# The body centre is at world Y = tile_h/2. The bottom of the tile is at
|
||||
# body-local Y = -tile_h/2 (world Y = 0).
|
||||
# Fit the model to the tile XZ footprint, then rotate 180° around X
|
||||
# (equivalent to a Y-flip but preserves mesh normals, unlike scale.y=-1).
|
||||
# After the rotation the wide base is still at body-local Y=0 and the
|
||||
# narrow spike is at -scaled_height. Setting position.y = -tile_h/2
|
||||
# shifts the whole thing so the base lands at the tile bottom (world Y=0)
|
||||
# and the spike hangs further downward.
|
||||
var tile_h : float = float(b.get_meta("tile_height", 1.0))
|
||||
_fit_model_to_tile(bottom_node, 0.98)
|
||||
bottom_node.scale.y = -absf(bottom_node.scale.y) # flip to hang down
|
||||
bottom_node.position.y = -tile_h * 0.5 # move to tile bottom
|
||||
bottom_node.rotate_x(PI) # flip upside-down, normals intact
|
||||
bottom_node.position.y = -tile_h * 0.5 # seat flipped base at tile bottom
|
||||
b.add_child(bottom_node)
|
||||
)
|
||||
|
||||
@@ -764,11 +774,16 @@ func _add_unit_mesh(unit: Dictionary, team_color: Color, is_enemy: bool = false)
|
||||
# Apply multiplicative tint to all StandardMaterial3D surfaces.
|
||||
_apply_model_tint(model_node, model_tint)
|
||||
|
||||
# Position model so its local origin sits at the body's position.
|
||||
# Skip reset if a move tween is driving this body — it controls position.
|
||||
# Restore the body to its correct world height (uses y_offset captured
|
||||
# from the outer scope, which accounts for tile_h and the unit's
|
||||
# half-height). Skip if a move tween is currently driving the body.
|
||||
if not _move_anims.has(iid):
|
||||
b.position = wp + Vector3(0, 0.5, 0)
|
||||
b.position = wp + Vector3(0, y_offset, 0)
|
||||
b.add_child(model_node)
|
||||
# Seat the model's local-Y=0 (feet) on the tile's top surface.
|
||||
# The body centre is at tile_h + half_height; tile_h - y_offset = -half_height
|
||||
# shifts the model so its feet land exactly at world Y = tile_h.
|
||||
model_node.position.y = tile_h - y_offset
|
||||
_unit_meshes[iid] = model_node
|
||||
|
||||
# Find and store the AnimationPlayer, then start the Idle loop.
|
||||
|
||||
Reference in New Issue
Block a user