Browse Source

Adapt code to synergine [master 6d63269] SynergyObject now need collection on innit and collection is not passed to Action::run

Bastien Sevajol 9 years ago
parent
commit
eccacb2b8c

+ 1 - 1
intelligine/sandbox/colored/RedColonyConfiguration.py View File

@@ -15,7 +15,7 @@ class RedColonyConfiguration(ColonyConfiguration):
15 15
         for x in range(50):
16 16
           for y in range(1, 50):
17 17
             if x % 3 == 0 and y % 3 == 0:
18
-              egg = Egg(context)
18
+              egg = Egg(collection, context)
19 19
               egg.set_position((0, 1+x, 50+y))
20 20
               # TODO: Ce COLONY doit devenir un truc automatise au niveau de la collection (qd get_object)
21 21
               context.metas.value.set(COLONY, egg.get_id(), collection.get_id())

+ 2 - 2
intelligine/synergy/ColonyConfiguration.py View File

@@ -11,8 +11,8 @@ class ColonyConfiguration(Configuration):
11 11
     def get_start_objects(self, collection, context):
12 12
 
13 13
       ants = []
14
-      for i in range(20):
15
-          ant = self._ant_class(context)
14
+      for i in range(50):
15
+          ant = self._ant_class(collection, context)
16 16
           context.metas.value.set(COLONY, ant.get_id(), collection.get_id())
17 17
           ant.set_position(self._start_position)
18 18
           ants.append(ant)

+ 1 - 1
intelligine/synergy/RocksConfiguration.py View File

@@ -29,7 +29,7 @@ class RocksConfiguration(Configuration):
29 29
       rocks_positions.append((0, 100, 100))
30 30
 
31 31
       for rock_position in rocks_positions:
32
-          rock = Rock(context)
32
+          rock = Rock(collection, context)
33 33
           rock.set_position(rock_position)
34 34
           rocks.append(rock)
35 35
 

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

@@ -7,7 +7,7 @@ class CycleAction(Action):
7 7
 
8 8
     _listen = CycleEvent
9 9
 
10
-    def run(self, obj, collection, context, synergy_manager):
10
+    def run(self, obj, context, synergy_manager):
11 11
       # TODO: refact ...
12 12
       cant_carry_still = context.metas.value.get(CANT_CARRY_STILL, obj.get_id(), allow_empty=True, empty_value=0)
13 13
       if cant_carry_still > 0:

+ 1 - 1
intelligine/synergy/event/attack/NearAttackableAction.py View File

@@ -15,7 +15,7 @@ class NearAttackableAction(Action):
15 15
     def prepare(self, context):
16 16
         pass
17 17
 
18
-    def run(self, obj, collection, context, synergy_manager):
18
+    def run(self, obj, context, synergy_manager):
19 19
         # TODO: reprendre ?
20 20
         for obj_id_attackable in self._parameters['objects_ids_attackable']:
21 21
             obj_attackable = synergy_manager.get_map().get_object(obj_id_attackable)

+ 1 - 1
intelligine/synergy/event/move/MoveAction.py View File

@@ -53,7 +53,7 @@ class MoveAction(Action):
53 53
     def _direction_point_is_possible(self, context, direction_point):
54 54
         return context.position_is_penetrable(direction_point)
55 55
 
56
-    def run(self, obj, collection, context, synergy_manager):
56
+    def run(self, obj, context, synergy_manager):
57 57
         if self._move_to_point is not None:
58 58
             obj.set_position(self._move_to_point)
59 59
             context.metas.value.set(PREVIOUS_DIRECTION, self._object_id, self._move_to_direction)

+ 1 - 1
intelligine/synergy/event/transport/PutableAction.py View File

@@ -15,7 +15,7 @@ class PutableAction(Action):
15 15
     def prepare(self, context):
16 16
         pass
17 17
 
18
-    def run(self, obj, collection, context, synergy_manager):
18
+    def run(self, obj, context, synergy_manager):
19 19
         # TODO: DEV
20 20
         obj_id_transportable = self._parameters['objects_ids_transportable'][0]
21 21
         obj_transportable = synergy_manager.get_map().get_object(obj_id_transportable)

+ 1 - 1
intelligine/synergy/event/transport/TakeableAction.py View File

@@ -14,7 +14,7 @@ class TakeableAction(Action):
14 14
     def prepare(self, context):
15 15
         pass
16 16
 
17
-    def run(self, obj, collection, context, synergy_manager):
17
+    def run(self, obj, context, synergy_manager):
18 18
         # TODO: TEST
19 19
         # TODO: Enlever le state de transportable a ce qui est transporte
20 20
         # ?! Comment gerer lorsque deux obj vont vouloir transporter le meme objet ? process !

+ 2 - 2
intelligine/synergy/object/BaseBug.py View File

@@ -4,8 +4,8 @@ from intelligine.cst import ALIVE, ATTACKABLE, TRANSPORTABLE, COL_ALIVE
4 4
 
5 5
 class BaseBug(XyzSynergyObject):
6 6
 
7
-    def __init__(self, context):
8
-        super().__init__(context)
7
+    def __init__(self, collection, context):
8
+        super().__init__(collection, context)
9 9
         context.metas.states.add_list(self.get_id(), [ALIVE, ATTACKABLE])
10 10
         context.metas.collections.add(self.get_id(), COL_ALIVE)
11 11
         self._life_points = 10

+ 2 - 2
intelligine/synergy/object/Bug.py View File

@@ -4,7 +4,7 @@ from intelligine.cst import WALKER, COL_WALKER
4 4
 
5 5
 class Bug(BaseBug):
6 6
 
7
-    def __init__(self, context):
8
-        super().__init__(context)
7
+    def __init__(self, collection, context):
8
+        super().__init__(collection, context)
9 9
         context.metas.states.add(self.get_id(), WALKER)
10 10
         context.metas.collections.add(self.get_id(), COL_WALKER)

+ 2 - 2
intelligine/synergy/object/Egg.py View File

@@ -4,7 +4,7 @@ from intelligine.cst import TRANSPORTABLE
4 4
 
5 5
 class Egg(BaseBug):
6 6
 
7
-    def __init__(self, context):
8
-        super().__init__(context)
7
+    def __init__(self, collection, context):
8
+        super().__init__(collection, context)
9 9
         context.metas.states.add(self.get_id(), TRANSPORTABLE)
10 10
         self._life_points = 1

+ 2 - 2
intelligine/synergy/object/Rock.py View File

@@ -4,6 +4,6 @@ from intelligine.cst import IMPENETRABLE
4 4
 
5 5
 class Rock(XyzSynergyObject):
6 6
 
7
-    def __init__(self, context):
8
-        super().__init__(context)
7
+    def __init__(self, collection, context):
8
+        super().__init__(collection, context)
9 9
         context.metas.states.add(self.get_id(), IMPENETRABLE)

+ 2 - 2
intelligine/synergy/object/ant/Ant.py View File

@@ -5,8 +5,8 @@ from intelligine.cst import CARRYING, TRANSPORTER, ATTACKER, \
5 5
 
6 6
 class Ant(Bug):
7 7
 
8
-    def __init__(self, context):
9
-        super().__init__(context)
8
+    def __init__(self, collection, context):
9
+        super().__init__(collection, context)
10 10
         context.metas.states.add_list(self.get_id(), [TRANSPORTER, ATTACKER])
11 11
         context.metas.collections.add_list(self.get_id(), [COL_TRANSPORTER_NOT_CARRYING, COL_FIGHTER])
12 12
         self._carried = []