Skip to content

Commit

Permalink
#229 葛朗台逻辑更新+bug修复
Browse files Browse the repository at this point in the history
  • Loading branch information
Shawnsdaddy committed Sep 17, 2023
1 parent 4ed095c commit 34204e8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
15 changes: 8 additions & 7 deletions arknights_mower/solvers/base_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ def agent_get_mood(self, skip_dorm=False, force=False):
_agent = miss_list[key]
if _agent.group != '' and next((k for k, v in self.op_data.operators.items() if
v.group == _agent.group and not v.not_valid() and v.is_resting()),
None) is not None:
None) is not None and _agent.mood == 24:
continue
elif _agent.group != '':
# 把所有小组成员都移到工作站
Expand Down Expand Up @@ -726,9 +726,8 @@ def plan_solver(self):
logger.exception(e)
# 如果下个 普通任务 >5 分钟则补全宿舍
logger.debug('tasks:' + str(self.tasks))
if find_next_task(self.tasks, datetime.now() + timedelta(seconds=300),
task_type=TaskTypes.RUN_ORDER) is not None:
logger.info("5分钟内有跑单任务")
if find_next_task(self.tasks, datetime.now() + timedelta(seconds=300)) is not None:
logger.info("5分钟内有其他任务,跳过宿舍纠错")
return
if self.agent_get_mood() is None:
self.backup_plan_solver()
Expand Down Expand Up @@ -1909,10 +1908,11 @@ def agent_arrange(self, plan: tp.BasePlan, get_time=False):
plan[room][current_idx] = self.op_data.get_current_room(room, True)[current_idx]
if room in self.op_data.run_order_rooms and len(new_plan) == 0:
if plan[room] != self.op_data.get_current_room(room):
run_order_task = find_next_task(self.tasks, task_type=TaskTypes.RUN_ORDER,
logger.info("检测到插拔房间人员变动!")
run_order_task = find_next_task(self.tasks, datetime.now()+ timedelta(minutes=10), task_type=TaskTypes.RUN_ORDER,
meta_data=room)
if run_order_task is not None:
logger.info("检测到插拔房间人员变动!")
logger.debug("移除超过10分钟的跑单任务以刷新时间")
self.tasks.remove(run_order_task)
checked = True
current_room = self.op_data.get_current_room(room, True)
Expand Down Expand Up @@ -2015,7 +2015,8 @@ def agent_arrange(self, plan: tp.BasePlan, get_time=False):
int(self.recog.w * 815 / 2496), int(self.recog.h * 710 / 1404)),
use_digit_reader=True)
wait_time = round((execute_time - datetime.now()).total_seconds(), 1)
if 0 < wait_time < self.op_data.config.run_order_buffer_time:
logger.debug(f"停止{wait_time}秒等待订单完成")
if 0 < wait_time < self.run_order_delay*60:
logger.info(f"停止{wait_time}秒等待订单完成")
self.sleep(wait_time)
# 等待服务器交互
Expand Down
2 changes: 2 additions & 0 deletions arknights_mower/utils/operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ def available_free(self, free_type='high'):
ret += 1
elif dorm.time is not None and dorm.time < datetime.now():
logger.info("检测到房间休息完毕,释放Free位")
if dorm.name in agent_list:
self.operators[dorm.name].mood = 24
dorm.name = ''
ret += 1
return ret
Expand Down

0 comments on commit 34204e8

Please sign in to comment.