Context.py 736B

123456789101112131415161718192021
  1. from synergine_xyz.Context import Context as XyzContext
  2. from intelligine.cst import IMPENETRABLE
  3. from synergine_xyz.cst import POSITIONS
  4. from intelligine.synergy.stigmergy.PheromonesManager import PheromonesManager
  5. class Context(XyzContext):
  6. def __init__(self):
  7. super().__init__()
  8. self._pheromones = PheromonesManager(self)
  9. def pheromones(self):
  10. return self._pheromones
  11. def position_is_penetrable(self, position):
  12. objects_ids_on_this_point = self.metas.list.get(POSITIONS, position, allow_empty=True)
  13. for object_id_on_this_point in objects_ids_on_this_point:
  14. if self.metas.states.have(object_id_on_this_point, IMPENETRABLE):
  15. return False
  16. return True