Skip to content

Commit e9e8051

Browse files
committed
🐛 fix(task): 修复子任务 info_set 状态管理
- 临时替换子任务的 info_set 为当前任务的 info_set
1 parent 4ecb9eb commit e9e8051

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

src/tasks/fullauto/Auto65ArtifactTask_Fast.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,17 @@ def run(self):
4141
try:
4242
_to_do_task = self.get_task_by_class(AutoDefence)
4343
_to_do_task.config_external_movement(self.walk_to_aim, self.config)
44+
original_info_set = _to_do_task.info_set
45+
_to_do_task.info_set = self.info_set
4446
return _to_do_task.do_run()
4547
except TaskDisabledException:
4648
pass
4749
except Exception as e:
4850
logger.error("AutoMyDungeonTask error", e)
4951
raise
52+
finally:
53+
if _to_do_task is not self:
54+
_to_do_task.info_set = original_info_set
5055

5156
# def do_run(self):
5257
# """执行任务的核心逻辑"""

src/tasks/fullauto/Auto70jjbTask.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ def run(self):
3333
try:
3434
_to_do_task = self.get_task_by_class(AutoDefence)
3535
_to_do_task.config_external_movement(self.walk_to_aim, self.config)
36+
original_info_set = _to_do_task.info_set
37+
_to_do_task.info_set = self.info_set
3638
return _to_do_task.do_run()
3739
except TaskDisabledException:
3840
pass
3941
except Exception as e:
4042
logger.error('AutoDefence error', e)
4143
raise
44+
finally:
45+
if _to_do_task is not self:
46+
_to_do_task.info_set = original_info_set
4247

4348
# def do_run(self):
4449
# self.init_param()

src/tasks/fullauto/AutoExploration_Fast.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ def run(self):
7171
try:
7272
_to_do_task = self.get_task_by_class(AutoExploration)
7373
_to_do_task.config_external_movement(self.walk_to_aim, self.config)
74+
original_info_set = _to_do_task.info_set
75+
_to_do_task.info_set = self.info_set
7476
while True:
7577
try:
7678
return _to_do_task.do_run()
@@ -82,6 +84,9 @@ def run(self):
8284
except Exception as e:
8385
logger.error('AutoDefence error', e)
8486
raise
87+
finally:
88+
if _to_do_task is not self:
89+
_to_do_task.info_set = original_info_set
8590

8691
def walk_to_aim(self, delay=0):
8792
self.sleep(delay)

0 commit comments

Comments
 (0)