Bastien Sevajol 9 years ago
parent
commit
55cefd1ee6

+ 1 - 1
intelligine/synergy/event/CycleEvent.py View File

@@ -4,7 +4,7 @@ from intelligine.cst import COL_TRANSPORTER
4 4
 
5 5
 class CycleEvent(Event):
6 6
 
7
-    concern = COL_TRANSPORTER
7
+    _concern = COL_TRANSPORTER
8 8
 
9 9
     def _prepare(self, object_id, context, parameters):
10 10
         return parameters

+ 3 - 6
intelligine/synergy/event/attack/NearAttackableEvent.py View File

@@ -1,20 +1,17 @@
1 1
 from intelligine.core.exceptions import NearNothingFound
2 2
 from synergine.core.exceptions import NotConcernedEvent
3 3
 from intelligine.synergy.event.src.NearEvent import NearEvent
4
-from xyzworld.mechanism.ArroundMechanism import ArroundMechanism
4
+from xyzworld.mechanism.AroundMechanism import AroundMechanism
5 5
 from intelligine.cst import ATTACKABLE, COLONY, COL_FIGHTER, BRAIN_PART_ATTACK
6 6
 
7 7
 
8 8
 class NearAttackableEvent(NearEvent):
9 9
 
10
-    concern = COL_FIGHTER
10
+    _mechanism = AroundMechanism
11
+    _concern = COL_FIGHTER
11 12
     _near_name = 'objects_ids_attackable'
12 13
     _near_map = lambda self, near_object_id, context: context.metas.states.have(near_object_id, ATTACKABLE)
13 14
 
14
-    def __init__(self, actions):
15
-        super().__init__(actions)
16
-        self._mechanism = ArroundMechanism
17
-
18 15
     def _prepare(self, object_id, context, parameters={}):
19 16
         obj_colony_id = context.metas.value.get(COLONY, object_id)
20 17
         filter = lambda near_object_id, context: obj_colony_id != context.metas.value.get(COLONY, near_object_id)

+ 2 - 5
intelligine/synergy/event/move/MoveEvent.py View File

@@ -12,11 +12,8 @@ class MoveEvent(Event):
12 12
     PARAM_POSITION = 'pos'
13 13
     PARAM_DIRECTION = 'dir'
14 14
 
15
-    concern = COL_WALKER
16
-
17
-    def __init__(self, actions):
18
-        super().__init__(actions)
19
-        self._mechanism = Mechanism
15
+    _mechanism = Mechanism
16
+    _concern = COL_WALKER
20 17
 
21 18
     def _prepare(self, object_id, context, parameters={}):
22 19
         try:

+ 2 - 5
intelligine/synergy/event/src/NearEvent.py View File

@@ -1,17 +1,14 @@
1 1
 from intelligine.core.exceptions import NearNothingFound
2 2
 from intelligine.synergy.event.Event import Event
3
-from xyzworld.mechanism.ArroundMechanism import ArroundMechanism
3
+from xyzworld.mechanism.AroundMechanism import AroundMechanism
4 4
 
5 5
 
6 6
 class NearEvent(Event):
7 7
 
8
+    _mechanism = AroundMechanism
8 9
     _near_name = None
9 10
     _near_map = lambda self, near_object_id, context: False
10 11
 
11
-    def __init__(self, actions):
12
-        super().__init__(actions)
13
-        self._mechanism = ArroundMechanism
14
-
15 12
     # TODO: parameters en entre/sortie c pas bon ca
16 13
     def map(self, context, parameters, stop_at_first=False, filter=lambda near_object_id, context: True):
17 14
         for near_object_id in parameters['objects_ids_near']:

+ 3 - 6
intelligine/synergy/event/transport/PutableEvent.py View File

@@ -2,7 +2,7 @@ from intelligine.core.exceptions import NearNothingFound, CantFindWhereToPut
2 2
 from intelligine.synergy.event.src.NearEvent import NearEvent
3 3
 from synergine.core.exceptions import NotConcernedEvent
4 4
 from intelligine.cst import CANT_PUT_STILL, COL_TRANSPORTER_CARRYING, TRANSPORTABLE, BRAIN_SCHEMA, BRAIN_PART_PUT
5
-from xyzworld.mechanism.ArroundMechanism import ArroundMechanism
5
+from xyzworld.mechanism.AroundMechanism import AroundMechanism
6 6
 
7 7
 
8 8
 class PutableEvent(NearEvent):
@@ -12,14 +12,11 @@ class PutableEvent(NearEvent):
12 12
 
13 13
     PARAM_PUT = 'put'
14 14
     PARAM_PUT_TO = 'put_to'
15
-    concern = COL_TRANSPORTER_CARRYING
15
+    _mechanism = AroundMechanism
16
+    _concern = COL_TRANSPORTER_CARRYING
16 17
     _near_name = 'objects_ids_putable'
17 18
     _near_map = lambda self, near_object_id, context: context.metas.states.have(near_object_id, TRANSPORTABLE)
18 19
 
19
-    def __init__(self, actions):
20
-        super().__init__(actions)
21
-        self._mechanism = ArroundMechanism
22
-
23 20
     def _prepare(self, object_id, context, parameters={}):
24 21
         if not self._can_put(object_id, context):
25 22
             raise NotConcernedEvent()

+ 3 - 6
intelligine/synergy/event/transport/TakeableEvent.py View File

@@ -1,21 +1,18 @@
1 1
 from intelligine.core.exceptions import NearNothingFound
2 2
 from synergine.core.exceptions import NotConcernedEvent
3 3
 from intelligine.synergy.event.src.NearEvent import NearEvent
4
-from xyzworld.mechanism.ArroundMechanism import ArroundMechanism
4
+from xyzworld.mechanism.AroundMechanism import AroundMechanism
5 5
 from intelligine.cst import TRANSPORTABLE, CANT_CARRY_STILL, COL_TRANSPORTER_NOT_CARRYING, BRAIN_SCHEMA, BRAIN_PART_TAKE
6 6
 
7 7
 
8 8
 class TakeableEvent(NearEvent):
9 9
 
10
+    _mechanism = AroundMechanism
10 11
     PARAM_TAKE = 'take'
11
-    concern = COL_TRANSPORTER_NOT_CARRYING
12
+    _concern = COL_TRANSPORTER_NOT_CARRYING
12 13
     _near_name = 'objects_ids_transportable'
13 14
     _near_map = lambda self, near_object_id, context: context.metas.states.have(near_object_id, TRANSPORTABLE)
14 15
 
15
-    def __init__(self, actions):
16
-        super().__init__(actions)
17
-        self._mechanism = ArroundMechanism
18
-
19 16
     def _prepare(self, object_id, context, parameters={}):
20 17
         if not self._can_carry(object_id, context):
21 18
             raise NotConcernedEvent()