feat: Implement PortalDoor functionality and integrate PortalModeManager for the Tekton Doors game mode.
This commit is contained in:
+30
-1
@@ -12,6 +12,8 @@ var touch_controls
|
||||
var camera_context_manager
|
||||
var stop_n_go_manager
|
||||
var stop_n_go_winner_id: int = -1 # Track who finished first in Stop n Go mode
|
||||
var portal_mode_winner_id: int = -1
|
||||
var is_match_ended: bool = false
|
||||
var obstacle_manager
|
||||
var portal_mode_manager
|
||||
|
||||
@@ -1758,6 +1760,27 @@ func sync_game_end_stop_n_go(winner_id: int):
|
||||
# Trigger match end
|
||||
_on_match_ended()
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_game_end_portal_mode(winner_id: int):
|
||||
print("[TEKTON DOORS] Game ended! Winner: ", winner_id)
|
||||
portal_mode_winner_id = winner_id
|
||||
|
||||
var winner_name = "Player " + str(winner_id)
|
||||
var player_node = get_node_or_null(str(winner_id))
|
||||
if player_node:
|
||||
winner_name = player_node.display_name
|
||||
|
||||
# Broadcast win
|
||||
add_message_to_bar("MATCH COMPLETE", winner_name + " Wins with 8 Missions!", MessageType.GOAL)
|
||||
|
||||
# Stop logic
|
||||
if portal_mode_manager:
|
||||
if portal_mode_manager.swap_timer: portal_mode_manager.swap_timer.stop()
|
||||
if portal_mode_manager.tile_refresh_timer: portal_mode_manager.tile_refresh_timer.stop()
|
||||
|
||||
# Trigger match end
|
||||
_on_match_ended()
|
||||
|
||||
func _on_match_ended():
|
||||
"""Called when the global match timer ends - show game over screen."""
|
||||
print("[Main] Match ended! Showing game over screen...")
|
||||
@@ -1846,13 +1869,19 @@ func _show_game_over_panel():
|
||||
"score": goals_cycle_manager.get_player_score(p.name.to_int()) if goals_cycle_manager else 0
|
||||
})
|
||||
|
||||
# Custom Sort for Stop n Go: Winner always first
|
||||
# Custom Sort for Stop n Go and Tekton Doors: Winner always first
|
||||
if LobbyManager.game_mode == "Stop n Go" and stop_n_go_winner_id != -1:
|
||||
player_scores.sort_custom(func(a, b):
|
||||
if a.peer_id == stop_n_go_winner_id: return true
|
||||
if b.peer_id == stop_n_go_winner_id: return false
|
||||
return a.score > b.score
|
||||
)
|
||||
elif LobbyManager.game_mode == "Tekton Doors" and portal_mode_winner_id != -1:
|
||||
player_scores.sort_custom(func(a, b):
|
||||
if a.peer_id == portal_mode_winner_id: return true
|
||||
if b.peer_id == portal_mode_winner_id: return false
|
||||
return a.score > b.score
|
||||
)
|
||||
else:
|
||||
player_scores.sort_custom(func(a, b): return a.score > b.score)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user