feat: Implement Portal Doors game mode with arena setup, dynamic portal connections, and timed events.
This commit is contained in:
@@ -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