feat: Introduce an EnhancedGridMap with advanced generation, randomization, pathfinding, and data serialization, along with new player, powerup, and portal managers.

This commit is contained in:
Yogi Wiguna
2026-03-04 17:40:10 +08:00
parent 8f03cc15c5
commit cd7881bc3f
12 changed files with 128 additions and 107 deletions
+4 -3
View File
@@ -299,7 +299,8 @@ func temporarily_change_floor(center: Vector2i, radius: int, new_id: int, durati
var original = enhanced_gridmap.get_cell_item(cell_3d)
# Only change if not already the new ID (avoid redundant updates or overriding existing freeze)
if original != new_id:
# PROTECTED FLOOR CHECK: avoid overwriting Start (1), Safe (2), Finish (3), or Wall (4)
if original != new_id and not original in [1, 2, 3, 4]:
# PRE-FIX: If we capture a "Hole" (Void or Pickup 7-14) here, we must record it as Floor (0)
# so that we restore a valid floor later.
if original == -1 or (original >= 7 and original <= 14):
@@ -370,10 +371,10 @@ func spawn_tiles_around(count: int = 4):
if _is_position_blocked_by_stand(pos):
continue
if enhanced_gridmap.is_position_valid(pos):
# EXTRA CHECK: Do not spawn tiles on walls (ID 4) or empty void (ID -1) on Floor 0
# Note: We allow spawning on Safe Zones, Start, and Finish as it's on Layer 1.
var floor_0_item = enhanced_gridmap.get_cell_item(Vector3i(pos.x, 0, pos.y))
if floor_0_item == 4 or floor_0_item == -1:
if floor_0_item in [4, -1]:
continue
# 50% chance to spawn something