diff --git a/scenes/main.gd b/scenes/main.gd index bb5d7b6..f8ccb28 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -361,12 +361,9 @@ func _setup_host_game(): # 1. PVT: Pre-calculate Static Tekton positions so we know where NOT to spawn players _precalculate_static_positions() - # IMMEDIATELY assign random spawn positions before any player _ready() completes - # Player _ready() has 0.1s await, so we assign before that completes - # IMMEDIATELY assign spawn positions (Fixed or Random) - # Always run this to ensure players don't spawn at (0,0) overlap - _assign_random_spawn_positions() - + # Delay spawn assignment until ALL players (including bots) are spawned + # Moved _assign_random_spawn_positions() to after bot loop + # Wait for players to be fully ready (player.gd has 0.1s await in _ready before managers init) await get_tree().create_timer(0.3).timeout @@ -400,6 +397,13 @@ func _setup_host_game(): var current_players = lobby_players.size() for i in range(current_players + 1, GameStateManager.max_players + 1): _add_bot(i) + + # Ensure Bots are in the tree before assigning positions + await get_tree().process_frame + + # NOW assign random spawn positions for EVERYONE (Host, Client, Bots) + # This ensures we respect the static tekton reserved zones for all characters + _assign_random_spawn_positions() _start_game()