bugfix, desync, and add UI function

This commit is contained in:
2026-01-14 00:20:20 +08:00
parent 6948a4aed1
commit bee9c30f0e
14 changed files with 362 additions and 112 deletions
+12 -1
View File
@@ -33,6 +33,11 @@ func _ready():
rng.seed = name.hash()
_tick_counter = rng.randi() % tick_rate
# Mobile Optimization: Throttling
if OS.has_feature("mobile") or OS.has_feature("android") or OS.has_feature("ios"):
tick_rate = int(tick_rate * 1.5) # 50% slower updates on mobile
print("[BotController] Mobile detected! Throttling tick rate to: ", tick_rate)
# Get parent (should be player character)
actor = get_parent()
# ... (rest of _ready) ...
@@ -153,7 +158,13 @@ func _run_ai_tick():
print("[BotController] Action Taken: Arrange")
return
print("[BotController] No action taken (Idle). AP: %d, GoalsAchieved: %s" % [actor.action_points, _is_goals_achieved()])
print("[BotController] %s - No action taken (Idle). AP: %d, GoalsAchieved: %s" % [actor.name, actor.action_points, _is_goals_achieved()])
# STALL PREVENTION: If we have AP but couldn't do anything, we are stuck.
# Skip turn to prevent game freeze in turn-based mode.
if TurnManager.turn_based_mode and actor.action_points > 0:
print("[BotController] %s is STUCK with AP %d! Skipping turn to proceed flow." % [actor.name, actor.action_points])
actor.consume_action_points(actor.action_points)
# =============================================================================
# Power-Up / Sabotage