Fix gauntlet_manager indentation and scope

This commit is contained in:
2026-07-01 11:28:07 +08:00
parent cc584c3251
commit 594a0ce84d
+30 -30
View File
@@ -503,39 +503,39 @@ func _spawn_mission_tiles() -> void:
# Goal items: Heart(7), Diamond(8), Star(9), Coin(10)
var goal_items = [7, 8, 9, 10]
var tiles_spawned: int = 0
var main = get_node_or_null("/root/Main")
for x in range(ARENA_COLUMNS):
for z in range(ARENA_ROWS):
var pos = Vector2i(x, z)
# Skip NPC pump zone (center 3x3)
if x >= 8 and x <= 10 and z >= 8 and z <= 10:
continue
# Check base floor — don't spawn on void (or walls if they were still obstacles)
var base_tile = gridmap.get_cell_item(Vector3i(x, 0, z))
if base_tile == -1:
continue
# Ensure we don't spawn powerups on the perimeter walls even though they look like floors
if x == 0 or x == ARENA_COLUMNS - 1 or z == 0 or z == ARENA_ROWS - 1:
continue
# Skip if something already exists on Layer 1
var current_item = gridmap.get_cell_item(Vector3i(x, 1, z))
if current_item != -1:
continue
# Spawn tiles with 60% density (40% chance to skip)
if randf() > 0.6:
continue
var tile_type = goal_items[randi() % goal_items.size()]
gridmap.set_cell_item(Vector3i(x, 1, z), tile_type)
tiles_spawned += 1
for x in range(ARENA_COLUMNS):
for z in range(ARENA_ROWS):
var pos = Vector2i(x, z)
# Skip NPC pump zone (center 3x3)
if x >= 8 and x <= 10 and z >= 8 and z <= 10:
continue
# Check base floor — don't spawn on void (or walls if they were still obstacles)
var base_tile = gridmap.get_cell_item(Vector3i(x, 0, z))
if base_tile == -1:
continue
# Ensure we don't spawn powerups on the perimeter walls even though they look like floors
if x == 0 or x == ARENA_COLUMNS - 1 or z == 0 or z == ARENA_ROWS - 1:
continue
# Skip if something already exists on Layer 1
var current_item = gridmap.get_cell_item(Vector3i(x, 1, z))
if current_item != -1:
continue
# Spawn tiles with 60% density (40% chance to skip)
if randf() > 0.6:
continue
var tile_type = goal_items[randi() % goal_items.size()]
gridmap.set_cell_item(Vector3i(x, 1, z), tile_type)
tiles_spawned += 1
# Sync to clients
var main = get_node("/root/Main")
if main:
main.rpc("sync_grid_item", x, 1, z, tile_type)