Fix: Avoid interrupting human contact in daemon

This commit is contained in:
LmeSzinc 2024-01-17 19:08:16 +08:00
parent 6214c8d494
commit 98876f9245

View File

@ -1,5 +1,6 @@
from module.base.timer import Timer
from module.daemon.daemon_base import DaemonBase
from module.device.method import maatouch
from module.logger import logger
from tasks.base.assets.assets_base_daemon import *
from tasks.base.main_page import MainPage
@ -10,6 +11,17 @@ from tasks.map.interact.aim import AimDetectorMixin
from tasks.rogue.route.base import RouteBase
class SecondaryMaatouchBuilder(maatouch.MaatouchBuilder):
def __init__(self, device, contact=0, handle_orientation=False):
"""
Click on secondary contact to avoid interruption of real-person contact
"""
super().__init__(device, contact=1, handle_orientation=handle_orientation)
maatouch.MaatouchBuilder = SecondaryMaatouchBuilder
class Daemon(RouteBase, DaemonBase, AimDetectorMixin):
aim_interval = Timer(0.3, count=1)
@ -40,6 +52,12 @@ class Daemon(RouteBase, DaemonBase, AimDetectorMixin):
def run(self):
# Rebind daemon settings along with rogue settings
self.config.bind('Daemon', func_list=['Rogue'])
# Check contact
builder = self.device.maatouch_builder
if builder.contact >= 1:
logger.info(f'Maatouch contact on {builder.contact}')
else:
logger.warning(f'Maatouch contact on {builder.contact}, may cause interruptions')
teleport_confirm = Timer(1, count=5)
while 1: