Removed synchronizatino of exit routine as it can cause issues due to threads getting terminated.

This commit is contained in:
Randi
2025-11-11 21:55:53 -05:00
parent a2d27fd4c3
commit 5cbf7ea366
+2 -7
View File
@@ -8,9 +8,7 @@ from utils.misc import wait
from ui_manager import wait_until_hidden, wait_until_visible, detect_screen_object, select_screen_object_match, ScreenObjects, list_visible_objects, is_visible
from inventory import common
from screen import convert_screen_to_monitor
from threading import Thread, Lock
exit_mutex = Lock()
from threading import Thread
def enable_no_pickup() -> bool:
# """
@@ -39,7 +37,6 @@ def fast_save_and_exit() -> bool:
Performes save and exit action from within game as fast as possible
:return: Bool if action was successful
"""
exit_mutex.acquire() #We don't want two threads trying to exit game at the same time
keyboard.send("esc") #Open save and exit menu
keyboard.send("down") #Move down twice in case point selects wrong menu option
keyboard.send("down") #Should move to bottom button
@@ -53,7 +50,7 @@ def fast_save_and_exit() -> bool:
keyboard.send("down")
keyboard.send("up")
keyboard.send("enter")
exit_mutex.release()
success = wait_until_hidden(ScreenObjects.InGame, 3)
if not success:
Logger.debug("Failed to perform fast save/exit")
@@ -67,7 +64,6 @@ def save_and_exit() -> bool:
# if exit button isn't detected already, press escape
attempts = 1
success = False
exit_mutex.acquire() #We don't want two threads trying to exit game at the same time
while attempts <= 2 and not success:
if not (exit_button := detect_screen_object(ScreenObjects.SaveAndExit)).valid:
keyboard.send("esc")
@@ -81,7 +77,6 @@ def save_and_exit() -> bool:
# if center icon on player bar disappears then save/exit was successful
success = wait_until_hidden(ScreenObjects.InGame, 3)
attempts += 1
exit_mutex.release()
if not success:
Logger.debug("Failed to find or click save/exit button")
return success