From c16a0043bc9d20c68d031cefe5d8634334eb455e Mon Sep 17 00:00:00 2001 From: Yogi Wiguna Date: Mon, 2 Mar 2026 15:32:50 +0800 Subject: [PATCH] feat: Introduce a new modular bot AI system for decision-making, movement, and actions. --- scenes/main.gd | 3 +++ scripts/bot_controller.gd | 19 ++----------------- scripts/managers/portal_mode_manager.gd | 8 ++++++++ 3 files changed, 13 insertions(+), 17 deletions(-) diff --git a/scenes/main.gd b/scenes/main.gd index cdec56f..f3d34e2 100644 --- a/scenes/main.gd +++ b/scenes/main.gd @@ -1203,6 +1203,9 @@ func sync_game_start(player_list: Array, is_turn_based: bool): stop_n_go_manager.name = "StopNGoManager" add_child(stop_n_go_manager) stop_n_go_manager.activate_client_side() + elif LobbyManager.game_mode == "Tekton Doors": + if portal_mode_manager: + portal_mode_manager.activate_client_side() # Initialize leaderboard for all peers (after a delay to ensure players loaded) call_deferred("_deferred_init_leaderboard") diff --git a/scripts/bot_controller.gd b/scripts/bot_controller.gd index f21447e..0dd4903 100644 --- a/scripts/bot_controller.gd +++ b/scripts/bot_controller.gd @@ -400,23 +400,8 @@ func _find_tile_to_grab(tiles_needed: Array) -> Dictionary: print("[BotController] %s found HOLO tile %d at current pos." % [actor.name, item]) result = {"position": actor.current_position, "type": item} - # Check adjacent cells - var neighbors = enhanced_gridmap.get_neighbors(actor.current_position, 0) - # print("[BotController] %s has %d walkable neighbors" % [actor.name, neighbors.size()]) - - for neighbor in neighbors: - var cell = Vector3i(neighbor.position.x, 1, neighbor.position.y) - item = enhanced_gridmap.get_cell_item(cell) - norm_item = _normalize_tile(item) - - # print("[BotController] %s checking neighbor %s. Item: %d" % [actor.name, neighbor.position, item]) - - if norm_item in tiles_needed: - print("[BotController] %s found NEEDED tile %d (normalized %d) at neighbor %s!" % [actor.name, item, norm_item, neighbor.position]) - return {"position": neighbor.position, "type": item} - - if item in HOLO_TILES and not result.position: - result = {"position": neighbor.position, "type": item} + # Refined: Only grab at current position (per user request) + # Removed neighbor check to prevent bots from "sucking" tiles from 1-tile away return result diff --git a/scripts/managers/portal_mode_manager.gd b/scripts/managers/portal_mode_manager.gd index 535bbc1..96e2039 100644 --- a/scripts/managers/portal_mode_manager.gd +++ b/scripts/managers/portal_mode_manager.gd @@ -94,6 +94,13 @@ func _activate_hud(): hud_layer.visible = true _update_hud_visuals() +func activate_client_side(): + """Called on clients to show HUD and prepare local state.""" + print("[PortalModeManager] Activating client-side HUD") + _activate_hud() + # Initial update to catch any missed goal counts + _update_hud_visuals() + func setup_arena_locally(): """Sets up GridMap size and walls. Called on host and clients.""" if arena_setup_done: @@ -405,6 +412,7 @@ func _on_global_goal_count_updated(_peer_id: int, _count: int): pass func _on_goal_count_updated(peer_id: int, _count: int): + # Update HUD if relevant (always check if it's the local player whose count changed) if peer_id == multiplayer.get_unique_id(): _update_hud_visuals()