Skip to content
This repository was archived by the owner on Jul 1, 2022. It is now read-only.

Commit 85a3290

Browse files
committed
Add toggle only mode to toggle_automap
1 parent 1b1b0c2 commit 85a3290

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/automap_finder.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,23 +38,23 @@ def find_cross_on_map(img: np.array, name: str, roi, YCbCr = False) -> tuple[flo
3838
return center
3939

4040

41-
def toggle_automap(active: bool = True) -> bool:
41+
def toggle_automap(active: bool = None) -> bool:
4242
"""
4343
Helper function that will check if the Automap is active (and optionally activate or deactivate it)
44-
:param active: set to "True" if Automap should be activated, set "False" if Automap should be deactivated, default True
44+
:param active: "True" - activated, "False" - deactivated, "None" - toggle without check. default "None"
4545
:returns a TemplateMatch object
4646
"""
47-
if active:
48-
if template_finder.search_and_wait(["MAP_CHECK"], roi=[1100,10,160,40], threshold=0.9, timeout=0.1, suppress_debug=True).valid: #check if the Automap is already on
47+
if active is None:
48+
keyboard.send(Config().char["show_automap"])
49+
elif active:
50+
if template_finder.search(["MAP_CHECK"], img=grab(force_new=True), roi=[1100,10,160,40], threshold=0.9).valid: #check if the Automap is already on
4951
Logger.debug("Automap Status: "+ '\033[92m' + "ALREADY ON" + '\033[0m')
5052
else:
5153
keyboard.send(Config().char["show_automap"])
5254
#we should put a keybinding for switching show_items OFF!
53-
#Logger.debug("Automap Status: is OFF -> switching " + '\033[92m' + " ON" + '\033[0m')
5455
wait(0.1,0.15)
5556
else:
5657
keyboard.send(Config().char["clear_screen"])
57-
#Logger.debug("Automap Status: switching" + '\033[91m' + " OFF" + '\033[0m')
5858
wait(0.1,0.15)
5959
return True
6060

src/pather.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ def traverse_nodes_automap(
762762
Logger.debug(f"Traverse automap: {path}")
763763

764764
if toggle_map:
765-
toggle_automap(True)
765+
toggle_automap()
766766
time.sleep(0.04)
767767
if force_tp:
768768
char.select_tp()

0 commit comments

Comments
 (0)