mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-07-11 15:32:42 +02:00
all vars are properties, removed comments
This commit is contained in:
README.md
marl_factory_grid
environment
entity
groups
modules
batteries
clean_up
destinations
maintenance
zones
utils
@ -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):
|
||||
|
||||
|
Reference in New Issue
Block a user