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: