feat: Implement Portal Doors game mode with arena setup, dynamic portal connections, and timed events.
This commit is contained in:
@@ -471,6 +471,9 @@ func _setup_host_game():
|
||||
stop_n_go_manager._setup_arena()
|
||||
|
||||
# Arena is set up, wait for __start_game to assign positions where Socket is open
|
||||
if LobbyManager.game_mode == "Tekton Doors" and portal_mode_manager:
|
||||
portal_mode_manager.setup_arena_locally()
|
||||
|
||||
_start_game()
|
||||
|
||||
func _spawn_lobby_client_sync(peer_id: int):
|
||||
@@ -530,6 +533,10 @@ func _setup_client_game():
|
||||
add_player_character(i, true)
|
||||
print("Client: Pre-spawned potential bot ", i)
|
||||
|
||||
# Initialize arena locally for Tekton Doors
|
||||
if LobbyManager.game_mode == "Tekton Doors" and portal_mode_manager:
|
||||
portal_mode_manager.setup_arena_locally()
|
||||
|
||||
# Ensure local player setup (UI, controls) is verified
|
||||
var player_character = get_node_or_null(str(my_id))
|
||||
if player_character:
|
||||
@@ -619,6 +626,10 @@ func _start_game():
|
||||
if LobbyManager.game_mode != "Stop n Go" and LobbyManager.game_mode != "Tekton Doors":
|
||||
spawn_static_tektons()
|
||||
|
||||
# Tekton Doors: Randomize connections BEFORE countdown so colors show
|
||||
if LobbyManager.game_mode == "Tekton Doors" and portal_mode_manager:
|
||||
portal_mode_manager._randomize_connections()
|
||||
|
||||
await _start_pre_game_countdown()
|
||||
|
||||
GameStateManager.start_game()
|
||||
|
||||
@@ -18,6 +18,7 @@ var swap_timer: Timer
|
||||
var tile_refresh_timer: Timer
|
||||
var finish_spawned: bool = false
|
||||
var missions_required: int = 3
|
||||
var arena_setup_done: bool = false
|
||||
|
||||
func initialize(p_main: Node, p_gridmap: Node):
|
||||
main = p_main
|
||||
@@ -54,30 +55,33 @@ func initialize(p_main: Node, p_gridmap: Node):
|
||||
func start_game_mode():
|
||||
if not multiplayer.is_server(): return
|
||||
|
||||
print("[PortalModeManager] Starting Portal Game Mode...")
|
||||
if arena_setup_done and not doors.is_empty():
|
||||
print("[PortalModeManager] Arena already setup, starting timers and refresh only.")
|
||||
else:
|
||||
print("[PortalModeManager] Starting Portal Game Mode with full setup...")
|
||||
setup_arena_locally()
|
||||
_randomize_connections()
|
||||
|
||||
# 1. Setup Arena (GridMap walls & Doors)
|
||||
setup_arena_locally()
|
||||
# Start Timers
|
||||
if swap_timer.is_stopped():
|
||||
swap_timer.start()
|
||||
if tile_refresh_timer.is_stopped():
|
||||
tile_refresh_timer.start()
|
||||
|
||||
# 2. Skip individual door spawn as it's now in setup_arena_locally
|
||||
# _spawn_portal_doors()
|
||||
|
||||
# 3. Initialize Connections
|
||||
_randomize_connections()
|
||||
|
||||
# 4. Start Timers
|
||||
swap_timer.start()
|
||||
tile_refresh_timer.start()
|
||||
|
||||
# 5. Initial Tile Spawn
|
||||
# Initial Tile Spawn
|
||||
_refresh_tiles()
|
||||
|
||||
func setup_arena_locally():
|
||||
"""Sets up GridMap size and walls. Called on host and clients."""
|
||||
if arena_setup_done:
|
||||
print("[PortalModeManager] Arena already setup locally, skipping.")
|
||||
return
|
||||
|
||||
print("[PortalModeManager] Setting up arena locally...")
|
||||
_setup_arena_size()
|
||||
_setup_room_partitions()
|
||||
_spawn_portal_doors()
|
||||
arena_setup_done = true
|
||||
|
||||
func _setup_arena_size():
|
||||
if not gridmap: return
|
||||
|
||||
Reference in New Issue
Block a user