feat: Implement the core "Tekton Doors" game mode including arena setup, portal management, special tiles, and mission tracking HUD.
Tekton Armageddon V.0.8
This commit is contained in:
+82
-19
@@ -57,6 +57,24 @@ func _ready():
|
||||
# Ensure grid is randomized with Scarcity if server
|
||||
if multiplayer.is_server():
|
||||
randomize_game_grid()
|
||||
|
||||
# Setup global multiplayer spawners (Stands, etc.)
|
||||
_setup_multiplayer_spawners()
|
||||
|
||||
func _setup_multiplayer_spawners():
|
||||
# Setup MultiplayerSpawner for Static Tekton Stands
|
||||
# Create a container node for strict pathing
|
||||
if not has_node("Stands"):
|
||||
var stands_container = Node3D.new()
|
||||
stands_container.name = "Stands"
|
||||
add_child(stands_container)
|
||||
|
||||
if not has_node("StandSpawner"):
|
||||
var stand_spawner = MultiplayerSpawner.new()
|
||||
stand_spawner.name = "StandSpawner"
|
||||
stand_spawner.spawn_path = NodePath("../Stands") # Relative to Spawner, finding sibling
|
||||
stand_spawner.add_spawnable_scene("res://scenes/static_tekton_stand.tscn")
|
||||
add_child(stand_spawner)
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_portal_configs(configs: Array):
|
||||
@@ -70,18 +88,6 @@ func sync_portal_configs(configs: Array):
|
||||
var em = $EnhancedGridMap
|
||||
if em:
|
||||
em.cell_size = Vector3(1, 0.05, 1)
|
||||
|
||||
# Setup MultiplayerSpawner for Static Tekton Stands
|
||||
# Create a container node for strict pathing
|
||||
var stands_container = Node3D.new()
|
||||
stands_container.name = "Stands"
|
||||
add_child(stands_container)
|
||||
|
||||
var stand_spawner = MultiplayerSpawner.new()
|
||||
stand_spawner.name = "StandSpawner"
|
||||
stand_spawner.spawn_path = NodePath("../Stands") # Relative to Spawner, finding sibling
|
||||
stand_spawner.add_spawnable_scene("res://scenes/static_tekton_stand.tscn")
|
||||
add_child(stand_spawner)
|
||||
|
||||
func _on_goal_count_updated(peer_id: int, count: int):
|
||||
# Only update for local player
|
||||
@@ -1588,8 +1594,30 @@ func sync_grid_item(x: int, y: int, z: int, item: int):
|
||||
if enhanced_gridmap.has_method("update_grid_data"):
|
||||
enhanced_gridmap.update_grid_data()
|
||||
|
||||
# Sync grid update (no need to sync whole grid if we do it at start, but if we do it late we might need to sync)
|
||||
# For simplicity, we trust the grid syncs via normal mechanisms or initial state.
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_grid_items_batch(data: Array):
|
||||
# data is an array of dictionaries: [{x: int, y: int, z: int, item: int}, ...]
|
||||
var enhanced_gridmap = $EnhancedGridMap
|
||||
if not enhanced_gridmap:
|
||||
return
|
||||
|
||||
for entry in data:
|
||||
var x = entry.get("x", 0)
|
||||
var y = entry.get("y", 0)
|
||||
var z = entry.get("z", 0)
|
||||
var item = entry.get("item", -1)
|
||||
|
||||
# WALL-SAFETY CHECK
|
||||
if y == 1 and item >= 7 and item <= 20:
|
||||
var f0 = enhanced_gridmap.get_cell_item(Vector3i(x, 0, z))
|
||||
if f0 == 4 or f0 == -1:
|
||||
continue
|
||||
|
||||
enhanced_gridmap.set_cell_item(Vector3i(x, y, z), item)
|
||||
|
||||
# Force visual update ONCE after batch
|
||||
if enhanced_gridmap.has_method("update_grid_data"):
|
||||
enhanced_gridmap.update_grid_data()
|
||||
|
||||
func randomize_game_grid():
|
||||
if LobbyManager.game_mode == "Stop n Go" or LobbyManager.game_mode == "Tekton Doors":
|
||||
@@ -1762,7 +1790,7 @@ func sync_game_end_stop_n_go(winner_id: int):
|
||||
winner_name = player_node.display_name
|
||||
|
||||
# Broadcast win (Validation already done in check_win_condition)
|
||||
add_message_to_bar("MATCH COMPLETE", winner_name + " Wins with 3 Missions!", MessageType.GOAL)
|
||||
add_message_to_bar("MATCH COMPLETE", winner_name + " Wins with 8 Missions!", MessageType.GOAL)
|
||||
|
||||
# Stop logic
|
||||
if stop_n_go_manager:
|
||||
@@ -1800,10 +1828,42 @@ func _on_match_ended():
|
||||
var local_player = GameStateManager.local_player_character
|
||||
if local_player:
|
||||
local_player.action_points = 0
|
||||
|
||||
# Signal Global Game End (Stops Bot ticks and logic)
|
||||
GameStateManager.end_game()
|
||||
|
||||
# Freeze all game actors (Players, Bots, Tektons)
|
||||
_freeze_all_game_actors()
|
||||
|
||||
# Show game over overlay
|
||||
_show_game_over_panel()
|
||||
|
||||
func _freeze_all_game_actors():
|
||||
"""Manually stop all game entities from processing without pausing the UI."""
|
||||
print("[Main] Freezing all game actors recursively...")
|
||||
|
||||
var groups = ["Players", "Bots", "Tektons", "StaticTektonStands"]
|
||||
for group_name in groups:
|
||||
var nodes = get_tree().get_nodes_in_group(group_name)
|
||||
for node in nodes:
|
||||
_freeze_node_recursive(node)
|
||||
|
||||
func _freeze_node_recursive(node: Node):
|
||||
"""Recursively disable processing and stop tweens for a node and its children."""
|
||||
if node.has_method("set_physics_process"):
|
||||
node.set_physics_process(false)
|
||||
if node.has_method("set_process"):
|
||||
node.set_process(false)
|
||||
|
||||
# Kill movement tweens if it's a character
|
||||
if "_movement_tween" in node and node._movement_tween:
|
||||
node._movement_tween.kill()
|
||||
node._movement_tween = null
|
||||
|
||||
# Recursive call for all children
|
||||
for child in node.get_children():
|
||||
_freeze_node_recursive(child)
|
||||
|
||||
func _show_game_over_panel():
|
||||
"""Create and display the game over panel with final leaderboard."""
|
||||
# Check if panel already exists
|
||||
@@ -1818,6 +1878,9 @@ func _show_game_over_panel():
|
||||
|
||||
if stop_n_go_manager and stop_n_go_manager.hud_layer:
|
||||
stop_n_go_manager.hud_layer.hide()
|
||||
|
||||
if portal_mode_manager and portal_mode_manager.hud_layer:
|
||||
portal_mode_manager.hud_layer.hide()
|
||||
|
||||
# Create game over panel
|
||||
var panel = PanelContainer.new()
|
||||
@@ -1829,7 +1892,7 @@ func _show_game_over_panel():
|
||||
style.bg_color = Color(0.0, 0.0, 0.0, 0.85)
|
||||
panel.add_theme_stylebox_override("panel", style)
|
||||
|
||||
# Content container
|
||||
# CONTENT VBOX
|
||||
var vbox = VBoxContainer.new()
|
||||
vbox.name = "VBox"
|
||||
vbox.set_anchors_preset(Control.PRESET_CENTER)
|
||||
@@ -2209,13 +2272,13 @@ func _toggle_pause_menu():
|
||||
var pause_menu = get_node_or_null("PauseMenu")
|
||||
if pause_menu:
|
||||
pause_menu.visible = not pause_menu.visible
|
||||
get_tree().paused = pause_menu.visible
|
||||
# get_tree().paused = pause_menu.visible # Removed for multiplayer consistency
|
||||
|
||||
func _on_resume_pressed():
|
||||
var pause_menu = get_node_or_null("PauseMenu")
|
||||
if pause_menu:
|
||||
pause_menu.visible = false
|
||||
get_tree().paused = false
|
||||
# get_tree().paused = false # Removed for multiplayer consistency
|
||||
|
||||
func _on_how_to_play_pressed():
|
||||
var pause_menu = get_node_or_null("PauseMenu")
|
||||
@@ -2255,7 +2318,7 @@ func _on_settings_pressed():
|
||||
opacity_slider.set_value_no_signal(touch_controls.button_opacity)
|
||||
|
||||
func _on_quit_match_pressed():
|
||||
get_tree().paused = false
|
||||
get_tree().paused = false # Ensure unpaused when returning to menu
|
||||
# Properly disconnect from Nakama match
|
||||
_cleanup_multiplayer()
|
||||
# Return to lobby or main menu
|
||||
|
||||
Reference in New Issue
Block a user