feat: Introduce PlayerActionManager for action point and grid highlighting, SpecialTilesManager for special tile effects, and a tile_freeze mesh resource.

This commit is contained in:
Yogi Wiguna
2026-03-25 15:53:55 +08:00
parent 5a6f704569
commit 5acf40c122
3 changed files with 28 additions and 17 deletions
+21 -14
View File
@@ -400,34 +400,41 @@ func _execute_area_freeze(target_pos: Vector2i = Vector2i(-9999, -9999)):
else:
NotificationManager.send_message(player, "Hit %d Players!" % hit_count, NotificationManager.MessageType.GOAL)
# Visual Feedback (Layer 2 - Overlay Level)
# Visual Feedback (Layer 0 - Ground Level, matching Wall logic)
if player.is_multiplayer_authority():
var main_node = get_node_or_null("/root/Main")
if main_node and main_node.has_method("sync_grid_items_batch"):
var batch_data = []
var restoration_data = [] # Stores {pos, item} to restore later
for rx in range(-radius, radius + 1):
for rz in range(-radius, radius + 1):
var cell_x = center_pos.x + rx
var cell_z = center_pos.y + rz
# Put back on Layer 2 (Overlay) as requested
batch_data.append({"x": cell_x, "y": 2, "z": cell_z, "item": 5})
var cx = center_pos.x + rx
var cz = center_pos.y + rz
var pos = Vector3i(cx, 0, cz)
# Get original ground item to restore later
var original_ground = enhanced_gridmap.get_cell_item(pos)
# Ignore if it is an immutable tile (Safe Zone 2, Wall 4, etc)
if original_ground in [1, 2, 3, 4, 15, 16]: continue
restoration_data.append({"pos": pos, "item": original_ground})
batch_data.append({"x": cx, "y": 0, "z": cz, "item": 5})
if not batch_data.is_empty():
main_node.rpc("sync_grid_items_batch", batch_data)
# Removal timer
# Removal timer with accurate restoration
get_tree().create_timer(FREEZE_SLOW_DURATION).timeout.connect(func():
var cl_node = get_node_or_null("/root/Main")
if not cl_node: return
var clear_batch = []
for rx in range(-radius, radius + 1):
for rz in range(-radius, radius + 1):
var cx = center_pos.x + rx
var cz = center_pos.y + rz
# Check if it is STILL Freeze Overlay on Layer 2
if enhanced_gridmap.get_cell_item(Vector3i(cx, 2, cz)) == 5:
# Remove Item (back to -1)
clear_batch.append({"x": cx, "y": 2, "z": cz, "item": -1})
for entry in restoration_data:
var p = entry.pos
# Only restore if it is STILL our Freeze tile
if enhanced_gridmap.get_cell_item(p) == 5:
clear_batch.append({"x": p.x, "y": 0, "z": p.z, "item": entry.item})
if not clear_batch.is_empty():
cl_node.rpc("sync_grid_items_batch", clear_batch)
)