feat: Introduce a new modular bot AI system for decision-making, movement, and actions.
This commit is contained in:
@@ -1203,6 +1203,9 @@ func sync_game_start(player_list: Array, is_turn_based: bool):
|
|||||||
stop_n_go_manager.name = "StopNGoManager"
|
stop_n_go_manager.name = "StopNGoManager"
|
||||||
add_child(stop_n_go_manager)
|
add_child(stop_n_go_manager)
|
||||||
stop_n_go_manager.activate_client_side()
|
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)
|
# Initialize leaderboard for all peers (after a delay to ensure players loaded)
|
||||||
call_deferred("_deferred_init_leaderboard")
|
call_deferred("_deferred_init_leaderboard")
|
||||||
|
|||||||
@@ -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])
|
print("[BotController] %s found HOLO tile %d at current pos." % [actor.name, item])
|
||||||
result = {"position": actor.current_position, "type": item}
|
result = {"position": actor.current_position, "type": item}
|
||||||
|
|
||||||
# Check adjacent cells
|
# Refined: Only grab at current position (per user request)
|
||||||
var neighbors = enhanced_gridmap.get_neighbors(actor.current_position, 0)
|
# Removed neighbor check to prevent bots from "sucking" tiles from 1-tile away
|
||||||
# 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}
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,13 @@ func _activate_hud():
|
|||||||
hud_layer.visible = true
|
hud_layer.visible = true
|
||||||
_update_hud_visuals()
|
_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():
|
func setup_arena_locally():
|
||||||
"""Sets up GridMap size and walls. Called on host and clients."""
|
"""Sets up GridMap size and walls. Called on host and clients."""
|
||||||
if arena_setup_done:
|
if arena_setup_done:
|
||||||
@@ -405,6 +412,7 @@ func _on_global_goal_count_updated(_peer_id: int, _count: int):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
func _on_goal_count_updated(peer_id: int, _count: int):
|
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():
|
if peer_id == multiplayer.get_unique_id():
|
||||||
_update_hud_visuals()
|
_update_hud_visuals()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user