Movement printing and Results, state, state reset.

This commit is contained in:
Steffen Illium
2023-11-16 17:08:08 +01:00
parent 7f1d99fe18
commit 6c27aa8eaf
11 changed files with 45 additions and 21 deletions

View File

@ -26,16 +26,22 @@ class Maintainer(Entity):
self._last_serviced = 'None'
def tick(self, state):
self.clear_temp_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)
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):