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