fix: on_init save+exit recovery when stranded mid-town with no visible marker

Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
alex
2026-06-10 13:34:43 +02:00
co-authored by Claude Fable 5
parent a06e46df09
commit a05a13be67
+10
View File
@@ -333,6 +333,16 @@ class Bot:
if (match := template_finder.search_and_wait(list(transition_to_screens.keys()), best_match=True)).valid:
self.trigger_or_stop(transition_to_screens[match.name])
else:
# Stranded mid-town: town markers are position-dependent, so a char left
# standing away from the spawn shows NO known marker. If we're in-game,
# save+exit to character select and re-detect instead of giving up.
if is_visible(ScreenObjects.InGame):
Logger.warning("on_init: in-game but no known marker visible — save+exit to recover")
view.save_and_exit()
wait(2, 3)
if (match := template_finder.search_and_wait(list(transition_to_screens.keys()), best_match=True, timeout=20)).valid:
self.trigger_or_stop(transition_to_screens[match.name])
return
self.restart_or_exit(f"Failed to detect {list(transition_to_screens.keys())}.")
def on_select_character(self):