Kaynağa Gözat

dev on egg smell

Bastien Sevajol 9 yıl önce
ebeveyn
işleme
96241d7f8f

+ 13 - 0
intelligine/display/Pygame.py Dosyayı Görüntüle

@@ -59,6 +59,19 @@ class Pygame(XyzPygame):
59 59
                 pass # No molecule here
60 60
 
61 61
             try:
62
+                molecule = point_flavour.get_molecule(category=MOLECULES_DIRECTION, type=SMELL_EGG)
63
+                self.draw_surface(point, smell_food_surface)
64
+
65
+                adapted_point = self._get_real_pixel_position_of_position(point)
66
+                adapted_point = (adapted_point[0]+10, adapted_point[1]+10)
67
+                myfont = pygame.font.SysFont("monospace", 15)
68
+                label = myfont.render(str(molecule.get_distance()), 1, (255,255,0))
69
+                self._screen.blit(label, adapted_point)
70
+
71
+            except NoMolecule:
72
+                pass # No molecule here
73
+
74
+            try:
62 75
                 point_flavour.get_molecule(category=MOLECULES_DIRECTION, type=SMELL_EGG)
63 76
                 self.draw_surface(point, smell_egg_surface)
64 77
             except NoMolecule:

+ 2 - 1
intelligine/simulation/object/brain/part/transport/AntPutBrainPart.py Dosyayı Görüntüle

@@ -16,7 +16,8 @@ class AntPutBrainPart(TransportBrainPart):
16 16
     })
17 17
 
18 18
     _types_matches = {
19
-        TYPE_RESOURCE_EXPLOITABLE: [TYPE_RESOURCE_EATABLE]
19
+        TYPE_RESOURCE_EXPLOITABLE: [TYPE_RESOURCE_EATABLE],
20
+        TYPE_NURSERY: [TYPE_NURSERY]
20 21
     }
21 22
 
22 23
     @classmethod

+ 7 - 2
intelligine/synergy/event/smell/SmellAction.py Dosyayı Görüntüle

@@ -1,3 +1,4 @@
1
+from intelligine.core.exceptions import BestMoleculeHere
1 2
 from intelligine.cst import POINT_SMELL, POINTS_SMELL, MOLECULES_INFOS, MOLECULES_DIRECTION, SMELL_FOOD, SMELL_EGG
2 3
 from intelligine.simulation.molecule.DirectionMolecule import DirectionMolecule
3 4
 from intelligine.simulation.molecule.Molecule import Molecule
@@ -23,14 +24,18 @@ class SmellAction(Action):
23 24
         context.metas.list.unset(POINTS_SMELL, POINTS_SMELL, allow_empty=True)
24 25
 
25 26
     def run(self, obj, context, synergy_manager):
26
-        # TODO: Utiliser molecule
27
+
27 28
         points_distances = self._parameters['points_distances']
28 29
         smell_type = obj.get_smell()
29 30
 
30 31
         for smell_point in points_distances:
31 32
             distance = points_distances[smell_point]
32 33
             molecule = Molecule(MOLECULES_DIRECTION, smell_type, distance)
33
-            DirectionMolecule.appose(context, smell_point, molecule)
34
+
35
+            try:
36
+                DirectionMolecule.appose(context, smell_point, molecule)
37
+            except BestMoleculeHere:
38
+                pass  #
34 39
 
35 40
             #
36 41
             # current_point_smell = points_distances[smell_point]

+ 2 - 1
intelligine/synergy/object/Egg.py Dosyayı Görüntüle

@@ -1,5 +1,5 @@
1 1
 from intelligine.synergy.object.BaseBug import BaseBug
2
-from intelligine.cst import TYPE_NURSERY, TYPE, SMELL_EGG
2
+from intelligine.cst import TYPE_NURSERY, TYPE, SMELL_EGG, COL_SMELL
3 3
 
4 4
 
5 5
 class Egg(BaseBug):
@@ -8,4 +8,5 @@ class Egg(BaseBug):
8 8
         super().__init__(collection, context)
9 9
         context.metas.list.add(TYPE, self.get_id(), TYPE_NURSERY)
10 10
         self._life_points = 1
11
+        self._add_col(COL_SMELL)
11 12
         self._set_smell(SMELL_EGG)