feat: Implement core playerboard management including item grabbing, power-up handling, goal completion, and grid refilling, alongside new Tekton entity and various game managers.

This commit is contained in:
2026-03-02 03:10:38 +08:00
parent 1c5c3d47f6
commit a7442bb1a6
17 changed files with 78 additions and 42 deletions
+13 -7
View File
@@ -58,8 +58,14 @@ func _ready():
queue_free()
return
# Wait for actor to be fully ready (player._ready awaits 0.5s then creates managers)
await get_tree().create_timer(1.5).timeout
# Wait for actor to be fully ready (poll for EnhancedGridMap)
var wait_timeout = 3.0
var wait_elapsed = 0.0
while wait_elapsed < wait_timeout:
await get_tree().create_timer(0.1).timeout
wait_elapsed += 0.1
if actor and actor.get("enhanced_gridmap") and actor.enhanced_gridmap:
break
enhanced_gridmap = actor.enhanced_gridmap
if not enhanced_gridmap:
@@ -107,7 +113,7 @@ func _physics_process(delta):
# Rate limiting (with difficulty scaling for Stop n Go)
var current_tick_rate = tick_rate
if LobbyManager.game_mode == "Stop n Go" and actor.current_position.x > 10:
if LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO) and actor.current_position.x > 10:
current_tick_rate = int(tick_rate * 0.6) # 40% faster updates after column 10
_tick_counter += 1
@@ -133,7 +139,7 @@ func _run_ai_tick():
return
# STOP N GO: Don't process if already at finish line
if LobbyManager.game_mode == "Stop n Go" and actor.current_position.x >= 21:
if LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO) and actor.current_position.x >= 21:
return
# STOP N GO: Red light freezing logic
@@ -150,7 +156,7 @@ func _run_ai_tick():
print("[BotController] %s AI Tick. Goals: %s, Fullness: %.2f" % [actor.name, actor.goals, board_fullness])
# 0. BOT AGGRESSION THRESHOLD (Stop n Go)
var is_sng = LobbyManager.game_mode == "Stop n Go"
var is_sng = LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO)
var can_be_aggressive = not is_sng or actor.current_position.x > 10
# PRIORITY OVERRIDE: If board is getting full, prioritize clearing space!
@@ -289,7 +295,7 @@ func _try_attack_chase() -> bool:
var next_step = Vector2i(path[1].x, path[1].y)
# STOP N GO BOUNDARY PROTECTION
if LobbyManager.game_mode == "Stop n Go" and next_step.x >= 21:
if LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO) and next_step.x >= 21:
var main = get_tree().root.get_node_or_null("Main")
var gc_manager = main.get_node_or_null("GoalsCycleManager") if main else null
var time_remaining = gc_manager.get_global_time_remaining() if gc_manager else 999.0
@@ -683,7 +689,7 @@ func _get_board_fullness_ratio() -> float:
func _is_goals_achieved() -> bool:
"""Check if goal pattern is complete (Standard) or mission complete (Stop n Go)."""
if LobbyManager.game_mode == "Stop n Go":
if LobbyManager.is_game_mode(GameMode.Mode.STOP_N_GO):
var main = get_tree().root.get_node_or_null("Main")
if main:
var sng_manager = main.get_node_or_null("StopNGoManager")