# Path: intelligine/synergy/event/move/MoveAction.py
# class MoveAction(Action):
# 
#     _listen = MoveEvent
# 
#     def __init__(self, object_id, parameters):
#         super().__init__(object_id, parameters)
#         self._move_to_point = None
#         self._move_to_direction = None
# 
#     def run(self, obj, context, synergy_manager):
#         if self._parameters.get(MoveEvent.PARAM_NEW_MODE, None):
#             obj.get_brain().switch_to_mode(self._parameters[MoveEvent.PARAM_NEW_MODE])
#             return
# 
#         try:
#             self._apply_move(obj, context)
#         except ActionAborted:
#             # TODO: Dans l'obj ces lignes
#             blocked_since = context.metas.value.get(BLOCKED_SINCE, self._object_id, allow_empty=True, empty_value=0)
#             context.metas.value.set(BLOCKED_SINCE, obj.get_id(), blocked_since+1)
# 
#     def _apply_move(self, obj, context):
#         # TODO: il ne faut pas choisir une direction 14.
#         if MoveEvent.PARAM_DIRECTION not in self._parameters or self._parameters[MoveEvent.PARAM_DIRECTION] == 14:
#             raise ActionAborted()
# 
#         obj.set_position(self._parameters[MoveEvent.PARAM_POSITION])
#         obj.set_previous_direction(self._parameters[MoveEvent.PARAM_DIRECTION])
#         obj.get_brain().get_part(BRAIN_PART_MOVE).done()
# 
# Path: intelligine/tests/src/event/MoveEvent.py
# class MoveEvent(BaseMoveEvent):
# 
#     force_direction = lambda self, object_id, context: NORTH
# 
#     def _get_direction(self, object_id, context):
#         return self.force_direction(object_id, context)


from intelligine.synergy.event.move.MoveAction import MoveAction as BaseMoveAction
from intelligine.tests.src.event.MoveEvent import MoveEvent


class MoveAction(BaseMoveAction):

    @classmethod
    def set_move_event(cls, force_direction_function, event=MoveEvent):

# Path: intelligine/synergy/event/move/MoveAction.py
# class MoveAction(Action):
# 
#     _listen = MoveEvent
# 
#     def __init__(self, object_id, parameters):
#         super().__init__(object_id, parameters)
#         self._move_to_point = None
#         self._move_to_direction = None
# 
#     def run(self, obj, context, synergy_manager):
#         if self._parameters.get(MoveEvent.PARAM_NEW_MODE, None):
#             obj.get_brain().switch_to_mode(self._parameters[MoveEvent.PARAM_NEW_MODE])
#             return
# 
#         try:
#             self._apply_move(obj, context)
#         except ActionAborted:
#             # TODO: Dans l'obj ces lignes
#             blocked_since = context.metas.value.get(BLOCKED_SINCE, self._object_id, allow_empty=True, empty_value=0)
#             context.metas.value.set(BLOCKED_SINCE, obj.get_id(), blocked_since+1)
# 
#     def _apply_move(self, obj, context):
#         # TODO: il ne faut pas choisir une direction 14.
#         if MoveEvent.PARAM_DIRECTION not in self._parameters or self._parameters[MoveEvent.PARAM_DIRECTION] == 14:
#             raise ActionAborted()
# 
#         obj.set_position(self._parameters[MoveEvent.PARAM_POSITION])
#         obj.set_previous_direction(self._parameters[MoveEvent.PARAM_DIRECTION])
#         obj.get_brain().get_part(BRAIN_PART_MOVE).done()
# 
# Path: intelligine/tests/src/event/MoveEvent.py
# class MoveEvent(BaseMoveEvent):
# 
#     force_direction = lambda self, object_id, context: NORTH
# 
#     def _get_direction(self, object_id, context):
#         return self.force_direction(object_id, context)


# Path: intelligine/tests/src/event/MoveAction.py
from intelligine.synergy.event.move.MoveAction import MoveAction as BaseMoveAction
from intelligine.tests.src.event.MoveEvent import MoveEvent



class MoveAction(BaseMoveAction):

    @classmethod
    def set_move_event(cls, force_direction_function, event=MoveEvent):

        event.force_direction = force_direction_function