Merge branch 'main' into unit_testing

This commit is contained in:
Chanumask
2023-11-16 19:45:52 +01:00
27 changed files with 290 additions and 126 deletions

View File

@ -28,14 +28,19 @@ class Maintainer(Entity):
def tick(self, state):
if found_objective := h.get_first(state[self.objective].by_pos(self.pos)):
if found_objective.name != self._last_serviced:
self.action.do(self, state)
result = self.action.do(self, state)
self._last_serviced = found_objective.name
else:
action = self.get_move_action(state)
return action.do(self, state)
result = action.do(self, state)
else:
action = self.get_move_action(state)
return action.do(self, state)
result = action.do(self, state)
self.set_state(result)
return result
def set_state(self, action_result):
self._status = action_result
def get_move_action(self, state) -> Action:
if self._path is None or not len(self._path):