|
@@ -1,33 +1,17 @@
|
1
|
1
|
from synergine.synergy.Simulation import Simulation as BaseSimulation
|
2
|
|
-from synergine_xyz.cst import POSITION, POSITIONS
|
3
|
|
-#from intelligine.synergy.event.attack.NearAttackableAction import NearAttackableAction
|
|
2
|
+from synergine_xyz.cst import POSITIONS
|
4
|
3
|
from intelligine.synergy.event.transport.PutableAction import PutableAction
|
5
|
4
|
from intelligine.synergy.event.transport.TakeableAction import TakeableAction
|
6
|
|
-from intelligine.synergy.event.move.MoveAction import MoveAction
|
7
|
|
-from intelligine.synergy.event.CycleAction import CycleAction
|
8
|
|
-from intelligine.cst import COL_TRANSPORTER_CARRYING, COL_TRANSPORTER_NOT_CARRYING, COL_TRANSPORTER, \
|
9
|
|
- COL_WALKER, ACTION_DIE, COL_ALIVE, ALIVE, ATTACKABLE
|
|
5
|
+from intelligine.cst import COL_TRANSPORTER_CARRYING, COL_TRANSPORTER_NOT_CARRYING
|
10
|
6
|
|
11
|
7
|
|
12
|
8
|
class Simulation(BaseSimulation):
|
13
|
9
|
|
14
|
|
- @staticmethod
|
15
|
|
- def event_bug_die(bug, context):
|
16
|
|
- context.metas.collections.remove_list(bug.get_id(),
|
17
|
|
- [COL_TRANSPORTER, \
|
18
|
|
- COL_TRANSPORTER_CARRYING, \
|
19
|
|
- COL_TRANSPORTER_NOT_CARRYING, \
|
20
|
|
- COL_WALKER, \
|
21
|
|
- COL_ALIVE],
|
22
|
|
- allow_not_in=True)
|
23
|
|
- context.metas.states.remove_list(bug.get_id(), [ALIVE, ATTACKABLE], allow_not_in=True)
|
24
|
|
-
|
25
|
10
|
def connect_actions_signals(self, Signals):
|
26
|
11
|
Signals.signal(PutableAction).connect(lambda obj, context: \
|
27
|
12
|
context.metas.collections.add_remove(obj.get_id(), COL_TRANSPORTER_NOT_CARRYING, COL_TRANSPORTER_CARRYING))
|
28
|
13
|
Signals.signal(TakeableAction).connect(lambda obj, context: \
|
29
|
14
|
context.metas.collections.add_remove(obj.get_id(), COL_TRANSPORTER_CARRYING, COL_TRANSPORTER_NOT_CARRYING))
|
30
|
|
- Signals.signal(ACTION_DIE).connect(lambda obj, context: self.event_bug_die(obj, context))
|
31
|
15
|
|
32
|
16
|
def end_cycle(self, context):
|
33
|
17
|
if context.get_cycle() % 100 is 0:
|