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)
|
||||
|
||||
|
||||
@@ -1345,6 +1345,13 @@ func start_movement_along_path(path: Array, clear_visual: bool = true):
|
||||
if sng_manager.check_win_condition(name.to_int(), current_position):
|
||||
sng_main.rpc("sync_game_end_stop_n_go", name.to_int())
|
||||
|
||||
# Tekton Doors Win Check
|
||||
elif LobbyManager.game_mode == "Tekton Doors":
|
||||
var main_node = get_tree().root.get_node_or_null("Main")
|
||||
if main_node and main_node.portal_mode_manager:
|
||||
if main_node.portal_mode_manager.check_win_condition(name.to_int(), current_position):
|
||||
main_node.rpc("sync_game_end_portal_mode", name.to_int())
|
||||
|
||||
# FORCE SNAP: Update target visual position to the perfect grid center
|
||||
# This ensures that when interpolation resumes (in _process), it pulls to the correct spot
|
||||
target_visual_position = grid_to_world(current_position)
|
||||
|
||||
@@ -21,7 +21,7 @@ emission = Color(0.0, 0.4, 1.0, 1)
|
||||
emission_energy_multiplier = 2.0
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_trigger"]
|
||||
size = Vector3(1.4, 2.1, 0.6)
|
||||
size = Vector3(1.4, 2.1, 0.5)
|
||||
|
||||
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_portal"]
|
||||
properties/0/path = NodePath(":target_room_id")
|
||||
|
||||
Reference in New Issue
Block a user