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"]