enterroom中枢分低超时再退出
All checks were successful
ci/woodpecker/push/check_format Pipeline was successful

This commit is contained in:
Elaina 2025-01-30 11:36:28 +08:00
parent dd035232de
commit 500ddf13dd

View file

@ -99,6 +99,7 @@ class EnterRoomSolver(BaseSolver, BaseMixin):
self.room = room
self.detail = detail
self.avoid_bug_start_time = None
self.animation_start_time = None
super().run()
def bug_timeout(self) -> bool:
@ -106,6 +107,11 @@ class EnterRoomSolver(BaseSolver, BaseMixin):
self.avoid_bug_start_time = datetime.now()
return datetime.now() > self.avoid_bug_start_time + timedelta(minutes=3)
def animation_timeout(self) -> bool:
if self.animation_start_time is None:
self.animation_start_time = datetime.now()
return datetime.now() > self.animation_start_time + timedelta(seconds=10)
@staticmethod
def segment(central: tp.Scope) -> dict[str, tp.Rectangle]:
top_left = central[0]
@ -125,7 +131,7 @@ class EnterRoomSolver(BaseSolver, BaseMixin):
def transition(self) -> bool:
if (scene := self.scene()) == Scene.INFRA_MAIN:
if self.animation(interval=1):
if self.animation():
return
if self.bug_timeout(): # yj的bug
self.back()
@ -136,8 +142,9 @@ class EnterRoomSolver(BaseSolver, BaseMixin):
pos = self.segment(scope)[self.room]
self.ctap(pos, 1, id="enter_room")
return
else:
elif self.animation_timeout():
self.cback(3, id="infra_back")
self.animation_start_time = None
elif scene in [Scene.CTRLCENTER_ASSISTANT, Scene.INFRA_DETAILS]:
if self.detect_room() != self.room: