Maintainer and pos_dicts fixed. Are sets now.

This commit is contained in:
Steffen Illium
2023-11-10 14:16:48 +01:00
parent 6711a0976b
commit 9b289591ba
22 changed files with 100 additions and 131 deletions

View File

@@ -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}')

View File

@@ -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()

View File

@@ -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()

View File

@@ -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)])