feat: Implement special tile power-up system with manager, levels, cooldowns, inventory, and associated assets.

This commit is contained in:
Yogi Wiguna
2026-02-03 10:16:03 +08:00
parent 753757d273
commit e8fc3f86c5
14 changed files with 157 additions and 28 deletions
+15 -6
View File
@@ -230,6 +230,7 @@ func randomize_floor(floor_index: int, custom_rng_callable: Callable = Callable(
print("Error: No MeshLibrary assigned to GridMap")
return
validate_item_indices()
var rng = RandomNumberGenerator.new()
@@ -245,19 +246,27 @@ func randomize_floor(floor_index: int, custom_rng_callable: Callable = Callable(
set_cell_item(Vector3i(x, floor_index, z), -1) # Clear item if no ground
continue
# Use custom callable if provided
# Use custom callable if provided, otherwise default to ScarcityController or internal logic
var item_index = -1
if custom_rng_callable.is_valid():
var item_index = custom_rng_callable.call()
set_cell_item(Vector3i(x, floor_index, z), item_index)
item_index = custom_rng_callable.call()
elif ResourceLoader.exists("res://scripts/controllers/scarcity_controller.gd"):
# Use ScarcityController by default if available (Project Specific)
# We use call() to avoid direct dependency if class_name isn't fully loaded in tool mode sometimes,
# but ScarcityController is a class_name so we can try valid access.
# To be safe in a tool script, we can check dynamic usage or just use the static method directly if known.
# Since this is "tekton-enet" specific codebase, we can directly use it.
item_index = ScarcityController.get_random_tile_id()
else:
# Default behavior
# Fallback default behavior
var random_value = rng.randi() % 100
var item_index
if random_value < 80:
item_index = normal_items[rng.randi() % normal_items.size()]
else:
item_index = non_walkable_items[rng.randi() % non_walkable_items.size()]
set_cell_item(Vector3i(x, floor_index, z), item_index)
set_cell_item(Vector3i(x, floor_index, z), item_index)
func randomize_grid_custom(randomize_states: Array, floor_index: int = -1):
if not mesh_library:
@@ -3,12 +3,12 @@
[ext_resource type="ArrayMesh" uid="uid://cr70nmk8djc1i" path="res://assets/models/meshes/tiles_armagedon_a3.res" id="1_ptqbt"]
[ext_resource type="ArrayMesh" uid="uid://dspusnbkr74hg" path="res://assets/models/meshes/hover.res" id="2_p5epg"]
[ext_resource type="ArrayMesh" uid="uid://dqguomxd16u0i" path="res://assets/models/meshes/start.res" id="3_8v5xv"]
[ext_resource type="ArrayMesh" uid="uid://brevl3ab0tdqe" path="res://assets/models/tiles/tile_heart_holo.tres" id="4_8v5xv"]
[ext_resource type="ArrayMesh" uid="uid://brevl3ab0tdqe" path="res://assets/models/tiles/tile_wall.tres" id="4_8v5xv"]
[ext_resource type="ArrayMesh" uid="uid://b5ta7tcw0iscd" path="res://assets/models/tiles/tile_coin.tres" id="4_76xkl"]
[ext_resource type="ArrayMesh" uid="uid://d4himvyb81in8" path="res://assets/models/meshes/non-walkable.res" id="4_sx8rm"]
[ext_resource type="ArrayMesh" uid="uid://dr80txgr61irt" path="res://assets/models/tiles/tile_diamond.tres" id="5_j2mx0"]
[ext_resource type="ArrayMesh" uid="uid://hwj23u2j561a" path="res://assets/models/tiles/tile_diamond_holo.tres" id="5_sx8rm"]
[ext_resource type="ArrayMesh" uid="uid://bqvqj3fhf5x51" path="res://assets/models/tiles/tile_star_holo.tres" id="6_r32il"]
[ext_resource type="ArrayMesh" uid="uid://dr80txgr61irt" path="res://assets/models/tiles/tile_area_freeze.tres" id="5_sx8rm"]
[ext_resource type="ArrayMesh" uid="uid://bqvqj3fhf5x51" path="res://assets/models/tiles/tile_ghost.tres" id="6_r32il"]
[ext_resource type="ArrayMesh" uid="uid://cv4bedhida00g" path="res://assets/models/tiles/tile_star.tres" id="7_p5epg"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_ghs0t"]
@@ -1,14 +1,12 @@
[gd_resource type="ArrayMesh" format=4 uid="uid://hwj23u2j561a"]
[gd_resource type="ArrayMesh" format=4 uid="uid://dr80txgr61irt"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_mwj80"]
load_path = "res://.godot/imported/tile_diamond_holo.png-e0c28a726d94831c5180dcc0376d012c.s3tc.ctex"
[ext_resource type="Texture2D" uid="uid://cp7jtg77hc078" path="res://assets/textures/power_tile/freeze_area_tile.png" id="1_3pijd"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2kxvc"]
resource_name = "boost"
transparency = 1
cull_mode = 2
albedo_color = Color(0.905882, 0.905882, 0.905882, 0.45098)
albedo_texture = SubResource("CompressedTexture2D_mwj80")
albedo_texture = ExtResource("1_3pijd")
[sub_resource type="ArrayMesh" id="ArrayMesh_ggb2g"]
_surfaces = [{
@@ -1,14 +1,12 @@
[gd_resource type="ArrayMesh" load_steps=4 format=4 uid="uid://gpnl4cjrivor"]
[gd_resource type="ArrayMesh" format=4 uid="uid://gpnl4cjrivor"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_ghs0t"]
load_path = "res://.godot/imported/tile_coin_holo.png-6a443a1d36bcd3bf79f0210c252c3d26.s3tc.ctex"
[ext_resource type="Texture2D" uid="uid://c1nvesys81nh7" path="res://assets/textures/power_tile/speed_tile.png" id="1_xysjv"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_5pajh"]
resource_name = "boost"
transparency = 1
cull_mode = 2
albedo_color = Color(0.91, 0.91, 0.91, 0.45098)
albedo_texture = SubResource("CompressedTexture2D_ghs0t")
albedo_texture = ExtResource("1_xysjv")
[sub_resource type="ArrayMesh" id="ArrayMesh_ghs0t"]
_surfaces = [{
@@ -1,14 +1,12 @@
[gd_resource type="ArrayMesh" format=4 uid="uid://brevl3ab0tdqe"]
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_txrgg"]
load_path = "res://.godot/imported/tile_heart_holo.png-5c92e04305de5aaa054336f0ec160274.s3tc.ctex"
[ext_resource type="Texture2D" uid="uid://btc2lpme1xemm" path="res://assets/textures/power_tile/wall_tile.png" id="1_74df1"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ld565"]
resource_name = "boost"
transparency = 1
cull_mode = 2
albedo_color = Color(0.905882, 0.905882, 0.905882, 0.45098)
albedo_texture = SubResource("CompressedTexture2D_txrgg")
albedo_texture = ExtResource("1_74df1")
[sub_resource type="ArrayMesh" id="ArrayMesh_1sox1"]
_surfaces = [{

Before

Width:  |  Height:  |  Size: 137 KiB

After

Width:  |  Height:  |  Size: 137 KiB

@@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cp7jtg77hc078"
path.s3tc="res://.godot/imported/freeze_area_tile.png-f6f6003021e9f9f6767f63158bd11561.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/power_tile/freeze_area_tile.png"
dest_files=["res://.godot/imported/freeze_area_tile.png-f6f6003021e9f9f6767f63158bd11561.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB

@@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c1nvesys81nh7"
path.s3tc="res://.godot/imported/speed_tile.png-fc7f1ddb55829636e1f770d63c11e5e5.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/power_tile/speed_tile.png"
dest_files=["res://.godot/imported/speed_tile.png-fc7f1ddb55829636e1f770d63c11e5e5.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 92 KiB

@@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://btc2lpme1xemm"
path.s3tc="res://.godot/imported/wall_tile.png-b9a5e6b7e946282950424d6198750cac.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/textures/power_tile/wall_tile.png"
dest_files=["res://.godot/imported/wall_tile.png-b9a5e6b7e946282950424d6198750cac.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
+8 -3
View File
@@ -22,6 +22,9 @@
[ext_resource type="StyleBox" uid="uid://d3ruc8gytoovx" path="res://assets/styles/ribbon_selected_gui.tres" id="18_u5x6e"]
[ext_resource type="StyleBox" uid="uid://cdhnwvcklbyl8" path="res://assets/styles/ribbon_hovered_gui.tres" id="19_w1rqq"]
[ext_resource type="StyleBox" uid="uid://3yog1weaqhxb" path="res://assets/styles/ribbon_unselected_gui.tres" id="20_q6bc1"]
[ext_resource type="Texture2D" uid="uid://bsgqrjx2ity4c" path="res://assets/graphics/touch_control/speed.png" id="26_2f3dj"]
[ext_resource type="Texture2D" uid="uid://cupfmb5m15kmf" path="res://assets/graphics/touch_control/wall.png" id="27_yq6so"]
[ext_resource type="Texture2D" uid="uid://3up2su2e0lfa" path="res://assets/graphics/touch_control/freeze_area.png" id="28_fv21b"]
[ext_resource type="Script" uid="uid://86ikh0wuqk7v" path="res://scripts/ui/powerup_inventory_ui.gd" id="powerup_ui_script"]
[ext_resource type="Script" uid="uid://b54tfa0n6kogi" path="res://scripts/managers/touch_controls.gd" id="touch_manager"]
[ext_resource type="Script" uid="uid://djiml4sh61dc1" path="res://scripts/ui/virtual_joystick.gd" id="virtual_joystick"]
@@ -9828,10 +9831,11 @@ offset_right = 212.0
offset_bottom = 50.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/separation = 15
[node name="CoinIcon" type="TextureRect" parent="PowerUpInventoryUI/HBoxContainer" unique_id=341904386]
layout_mode = 2
texture = ExtResource("10_my1qp")
texture = ExtResource("26_2f3dj")
expand_mode = 2
[node name="SelectRect" type="TextureRect" parent="PowerUpInventoryUI/HBoxContainer/CoinIcon" unique_id=961231613]
@@ -9846,7 +9850,7 @@ texture = ExtResource("8_8meci")
[node name="HeartIcon" type="TextureRect" parent="PowerUpInventoryUI/HBoxContainer" unique_id=61328923]
layout_mode = 2
texture = ExtResource("7_xwcc1")
texture = ExtResource("27_yq6so")
expand_mode = 2
[node name="SelectRect" type="TextureRect" parent="PowerUpInventoryUI/HBoxContainer/HeartIcon" unique_id=772732397]
@@ -9861,7 +9865,7 @@ texture = ExtResource("8_8meci")
[node name="DiamondIcon" type="TextureRect" parent="PowerUpInventoryUI/HBoxContainer" unique_id=1830849071]
layout_mode = 2
texture = ExtResource("8_quhbu")
texture = ExtResource("28_fv21b")
expand_mode = 2
[node name="SelectRect" type="TextureRect" parent="PowerUpInventoryUI/HBoxContainer/DiamondIcon" unique_id=439518389]
@@ -9875,6 +9879,7 @@ grow_vertical = 2
texture = ExtResource("8_8meci")
[node name="StarIcon" type="TextureRect" parent="PowerUpInventoryUI/HBoxContainer" unique_id=1468665065]
visible = false
layout_mode = 2
texture = ExtResource("9_i0gbs")
expand_mode = 2
@@ -178,8 +178,6 @@ func activate_effect(effect: int, target_player: Node3D = null):
func is_holo_tile(item_id: int) -> bool:
return item_id in HOLO_TILES
# =============================================================================
# Effect Implementations (New)
# =============================================================================