Browse Source

move function

Bastien Sevajol 9 years ago
parent
commit
2c4c5a82f4

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

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

+ 11 - 10
intelligine/synergy/Simulation.py View File

@@ -8,24 +8,25 @@ from intelligine.synergy.event.CycleAction import CycleAction
8 8
 from intelligine.cst import COL_TRANSPORTER_CARRYING, COL_TRANSPORTER_NOT_CARRYING, \
9 9
     COL_WALKER, ACTION_DIE, COL_ALIVE, ALIVE, ATTACKABLE
10 10
 
11
-# TODO: Mettre ailleurs ?
12
-def bug_die(bug, context):
13
-    context.metas.collections.remove_list(bug.get_id(),
14
-                                          [COL_TRANSPORTER_CARRYING, \
15
-                                           COL_TRANSPORTER_NOT_CARRYING, \
16
-                                           COL_WALKER, \
17
-                                           COL_ALIVE],
18
-                                          allow_not_in=True)
19
-    context.metas.states.remove_list(bug.get_id(), [ALIVE, ATTACKABLE], allow_not_in=True)
20 11
 
21 12
 class Simulation(BaseSimulation):
22 13
 
14
+    @staticmethod
15
+    def event_bug_die(bug, context):
16
+        context.metas.collections.remove_list(bug.get_id(),
17
+                                              [COL_TRANSPORTER_CARRYING, \
18
+                                               COL_TRANSPORTER_NOT_CARRYING, \
19
+                                               COL_WALKER, \
20
+                                               COL_ALIVE],
21
+                                              allow_not_in=True)
22
+        context.metas.states.remove_list(bug.get_id(), [ALIVE, ATTACKABLE], allow_not_in=True)
23
+
23 24
     def connect_actions_signals(self, Signals):
24 25
         Signals.signal(PutableAction).connect(lambda obj, context: \
25 26
             context.metas.collections.add_remove(obj.get_id(), COL_TRANSPORTER_NOT_CARRYING, COL_TRANSPORTER_CARRYING))
26 27
         Signals.signal(TakeableAction).connect(lambda obj, context: \
27 28
             context.metas.collections.add_remove(obj.get_id(), COL_TRANSPORTER_CARRYING, COL_TRANSPORTER_NOT_CARRYING))
28
-        Signals.signal(ACTION_DIE).connect(lambda obj, context: bug_die(obj, context))
29
+        Signals.signal(ACTION_DIE).connect(lambda obj, context: self.event_bug_die(obj, context))
29 30
 
30 31
     def end_cycle(self, context):
31 32
         if context.get_cycle() % 100 is 0: