# Path: intelligine/cst.py
# COL_SMELL = IncrementedNamedInt.get('intelligine.col.smell')
# 
# CARRIED_BY = IncrementedNamedInt.get('intelligine.carried_by')
# 
# Path: intelligine/mechanism/TraversableDistanceFromMechanism.py
# class TraversableDistanceFromMechanism(DistanceFromMechanism):
#     """
#     Prepare list of traversable points around synergy object position. These point are associated with distance
#     of synergy object position.
#     """
# 
#     def _get_maximum_distance(self, object_id, context):
#         # TODO (ds surcharge) Maintenir un rayon (calculé en fonction de la taille de la colonie + ratio en
#         #  fonction de ce qui est smelling)
#         # pour le moment ...valeur hardcode
#         return 6
# 
#     def _point_is_computable(self, context, point):
#         return context.position_can_be_odorus(point)
# 
# Path: intelligine/synergy/event/Event.py
# class Event(BaseEvent):
#     pass


from intelligine.cst import COL_SMELL, CARRIED_BY
from intelligine.mechanism.TraversableDistanceFromMechanism import TraversableDistanceFromMechanism
from intelligine.synergy.event.Event import Event
from synergine.core.exceptions import NotConcernedEvent


class SmellEvent(Event):

    _mechanism = TraversableDistanceFromMechanism
    _concern = COL_SMELL
    _each_cycle = 100
    _first_cycle_force = True

    def _prepare(self, object_id, context, parameters={}):
        if not parameters['points_distances'] or not self._concerned_object(context, object_id):
            raise NotConcernedEvent()


# Path: intelligine/cst.py
# COL_SMELL = IncrementedNamedInt.get('intelligine.col.smell')
# 
# CARRIED_BY = IncrementedNamedInt.get('intelligine.carried_by')
# 
# Path: intelligine/mechanism/TraversableDistanceFromMechanism.py
# class TraversableDistanceFromMechanism(DistanceFromMechanism):
#     """
#     Prepare list of traversable points around synergy object position. These point are associated with distance
#     of synergy object position.
#     """
# 
#     def _get_maximum_distance(self, object_id, context):
#         # TODO (ds surcharge) Maintenir un rayon (calculé en fonction de la taille de la colonie + ratio en
#         #  fonction de ce qui est smelling)
#         # pour le moment ...valeur hardcode
#         return 6
# 
#     def _point_is_computable(self, context, point):
#         return context.position_can_be_odorus(point)
# 
# Path: intelligine/synergy/event/Event.py
# class Event(BaseEvent):
#     pass


# Path: intelligine/synergy/event/smell/SmellEvent.py
from intelligine.cst import COL_SMELL, CARRIED_BY
from intelligine.mechanism.TraversableDistanceFromMechanism import TraversableDistanceFromMechanism
from intelligine.synergy.event.Event import Event
from synergine.core.exceptions import NotConcernedEvent



class SmellEvent(Event):

    _mechanism = TraversableDistanceFromMechanism
    _concern = COL_SMELL
    _each_cycle = 100
    _first_cycle_force = True

    def _prepare(self, object_id, context, parameters={}):
        if not parameters['points_distances'] or not self._concerned_object(context, object_id):
            raise NotConcernedEvent()


        return parameters