mirror of
https://github.com/illiumst/marl-factory-grid.git
synced 2025-09-17 16:12:00 +02:00
Maintainer and pos_dicts fixed. Are sets now.
This commit is contained in:
@@ -15,7 +15,7 @@ class DoorUse(Action):
|
||||
# Check if agent really is standing on a door:
|
||||
e = state.entities.get_entities_near_pos(entity.pos)
|
||||
try:
|
||||
# Only one door opens TODO introcude loop
|
||||
# Only one door opens TODO introduce loop
|
||||
door = next(x for x in e if x.name.startswith(d.DOOR))
|
||||
valid = door.use()
|
||||
state.print(f'{entity.name} just used a {door.name} at {door.pos}')
|
||||
|
@@ -117,3 +117,7 @@ class Door(Entity):
|
||||
def _reset_timer(self):
|
||||
self._time_to_close = self._auto_close_interval
|
||||
return True
|
||||
|
||||
def reset(self):
|
||||
self._close()
|
||||
self._reset_timer()
|
||||
|
@@ -23,3 +23,7 @@ class Doors(Collection):
|
||||
results.append(tick_result)
|
||||
# TODO: Should return a Result object, not a random dict.
|
||||
return results
|
||||
|
||||
def reset(self):
|
||||
for door in self:
|
||||
door.reset()
|
||||
|
@@ -40,6 +40,6 @@ class IndicateDoorAreaInObservation(Rule):
|
||||
# Could then be combined with the "Combine"-approach.
|
||||
super().__init__()
|
||||
|
||||
def on_init(self, state, lvl_map):
|
||||
def on_reset(self, state, lvl_map):
|
||||
for door in state[d.DOORS]:
|
||||
state[d.DOORS].add_items([DoorIndicator(x) for x in state.entities.neighboring_positions(door.pos)])
|
||||
|
Reference in New Issue
Block a user