feat: Add PlayerActionManager for handling player actions and highlights, and SpecialTilesManager for managing special tile effects and powerups.

This commit is contained in:
Yogi Wiguna
2026-02-05 11:06:18 +08:00
parent 18128288d2
commit e2675d782a
2 changed files with 32 additions and 7 deletions
+19 -3
View File
@@ -85,8 +85,9 @@ func highlight_cells_if_authorized(cells_to_highlight: Array, item_id: int = -1)
for cell in cells_to_highlight:
highlighted_cells.append(cell)
# Use Layer 2 for overlay highlights (prevents overwriting walls on Layer 0)
enhanced_gridmap.set_cell_item(
Vector3i(cell.x, 0, cell.y),
Vector3i(cell.x, 2, cell.y),
highlight_item
)
@@ -182,10 +183,25 @@ func clear_highlights():
# Store the current action state before clearing
var main = player.get_tree().get_root().get_node_or_null("Main")
var current_state = main.ui_manager.current_action_state if main else null
var hover_id = enhanced_gridmap.hover_item
for cell in highlighted_cells:
if cell is Vector2i:
enhanced_gridmap.set_cell_item(Vector3i(cell.x, 0, cell.y), enhanced_gridmap.normal_items[0])
# Check Layer 2 (Overlay Highlight)
var l2_pos = Vector3i(cell.x, 2, cell.y)
var l2_item = enhanced_gridmap.get_cell_item(l2_pos)
# Only clear if it looks like a highlight (e.g. ID 1)
# or generally just clear layer 2 if we assume we own it for highlights?
# Safest is to check against hover_id or typical highlight IDs.
if l2_item != -1:
enhanced_gridmap.set_cell_item(l2_pos, -1)
# Check Layer 0 (Floor Highlight)
var l0_pos = Vector3i(cell.x, 0, cell.y)
var l0_item = enhanced_gridmap.get_cell_item(l0_pos)
if l0_item == hover_id:
enhanced_gridmap.set_cell_item(l0_pos, enhanced_gridmap.normal_items[0])
highlighted_cells.clear()