all vars are properties, removed comments

This commit is contained in:
Chanumask
2023-10-22 12:05:38 +02:00
parent b1fe698d52
commit e87bd3aaa0
19 changed files with 66 additions and 193 deletions

@ -84,14 +84,12 @@ class Maintainer(Entity):
def _door_is_close(self, state):
state.print("Found a door that is close.")
try:
# return next(y for x in self.tile.neighboring_floor for y in x.guests if do.DOOR in y.name)
return next(y for x in state.entities.neighboring_positions(self.state.pos) for y in state.entities.pos_dict[x] if do.DOOR in y.name)
except StopIteration:
return None
def _predict_move(self, state):
next_pos = self._path[0]
# if len(state[c.FLOORS].by_pos(next_pos).guests_that_can_collide) > 0:
if any(x for x in state.entities.pos_dict[next_pos] if x.var_can_collide) > 0:
action = c.NOOP
else:

@ -1,14 +1,10 @@
from typing import List
from .entities import Maintainer
from marl_factory_grid.environment.entity.wall_floor import Floor
from marl_factory_grid.environment.groups.collection import Collection
from marl_factory_grid.environment.groups.mixins import PositionMixin
from .entities import Maintainer
from ..machines import constants as mc
from ..machines.actions import MachineAction
from ...utils.states import Gamestate
from ..machines import constants as mc
class Maintainers(PositionMixin, Collection):