Browse Source

position instead trace

Bastien Sevajol 9 years ago
parent
commit
8c78f3388a

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

10
     def get_start_objects(self):
10
     def get_start_objects(self):
11
 
11
 
12
       ants = []
12
       ants = []
13
-      for i in range(20):
13
+      for i in range(10):
14
           ant = Ant()
14
           ant = Ant()
15
-          ant.add_trace((0, 20, 20))
15
+          ant.set_position((0, 20, 20))
16
           metas.list.add(Simulation.STATE, ant.get_id(), ALIVE)
16
           metas.list.add(Simulation.STATE, ant.get_id(), ALIVE)
17
           ants.append(ant)
17
           ants.append(ant)
18
 
18
 

+ 21 - 4
socialintengine/synergy/RocksConfiguration.py View File

11
 
11
 
12
       rocks = []
12
       rocks = []
13
 
13
 
14
-      for i in range(20):
14
+      for i in range(50):
15
           rock = Rock()
15
           rock = Rock()
16
           metas.list.add(Simulation.STATE, rock.get_id(), IMPENETRABLE)
16
           metas.list.add(Simulation.STATE, rock.get_id(), IMPENETRABLE)
17
-          rock.add_trace((0, 10+i, 15))
17
+          rock.set_position((0, 0+i, 0))
18
           rocks.append(rock)
18
           rocks.append(rock)
19
 
19
 
20
-      for i in range(20):
20
+      for i in range(50):
21
           rock = Rock()
21
           rock = Rock()
22
-          rock.add_trace((0, 10+i, 25))
23
           metas.list.add(Simulation.STATE, rock.get_id(), IMPENETRABLE)
22
           metas.list.add(Simulation.STATE, rock.get_id(), IMPENETRABLE)
23
+          rock.set_position((0, 0+i, 50))
24
           rocks.append(rock)
24
           rocks.append(rock)
25
 
25
 
26
+      for i in range(50):
27
+          rock = Rock()
28
+          rock.set_position((0, 0, 0+i))
29
+          metas.list.add(Simulation.STATE, rock.get_id(), IMPENETRABLE)
30
+          rocks.append(rock)
31
+
32
+      for i in range(50):
33
+          rock = Rock()
34
+          rock.set_position((0, 50, 0+i))
35
+          metas.list.add(Simulation.STATE, rock.get_id(), IMPENETRABLE)
36
+          rocks.append(rock)
37
+
38
+      rock = Rock()
39
+      rock.set_position((0, 50, 50))
40
+      metas.list.add(Simulation.STATE, rock.get_id(), IMPENETRABLE)
41
+      rocks.append(rock)
42
+
26
       return rocks
43
       return rocks

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

40
             try:
40
             try:
41
                 previous_direction = context.metas.value.get(PREVIOUS_DIRECTION, self._object_id)
41
                 previous_direction = context.metas.value.get(PREVIOUS_DIRECTION, self._object_id)
42
                 directions_list = directions_slighty[previous_direction]
42
                 directions_list = directions_slighty[previous_direction]
43
+                # TODO: TMP tant que 1 niveau (z)
44
+                directions_list = [direction for direction in directions_list if direction > 9 and direction < 19]
43
                 direction_name = choice(directions_list)
45
                 direction_name = choice(directions_list)
44
             except KeyError:
46
             except KeyError:
45
                 pass
47
                 pass
58
 
60
 
59
     def run(self, obj, collection, context):
61
     def run(self, obj, collection, context):
60
         if self._move_to_point is not None:
62
         if self._move_to_point is not None:
61
-            obj.add_trace(self._move_to_point)
63
+            obj.set_position(self._move_to_point)
62
             context.metas.value.set(PREVIOUS_DIRECTION, self._object_id, self._move_to_direction)
64
             context.metas.value.set(PREVIOUS_DIRECTION, self._object_id, self._move_to_direction)
63
             context.metas.value.set(BLOCKED_SINCE, self._object_id, 0)
65
             context.metas.value.set(BLOCKED_SINCE, self._object_id, 0)
64
         else:
66
         else: