Browse Source

StockedFood & rename const

Bastien Sevajol 9 years ago
parent
commit
3bb8c4e3d9

+ 2 - 1
intelligine/cst.py View File

@@ -22,7 +22,7 @@ MOVE_MODE_GOHOME = IncrementedNamedInt.get('intelligine.basebug.move.mode.gohome
22 22
 MOVE_MODE_NURSE = IncrementedNamedInt.get('intelligine.basebug.move.mode.nurse')
23 23
 
24 24
 TYPE = IncrementedNamedInt.get('intelligine.object.type')
25
-TYPE_RESOURCE_TRANSFORMABLE = IncrementedNamedInt.get('intelligine.object.type.resource.transformable')
25
+TYPE_RESOURCE_EXPLOITABLE = IncrementedNamedInt.get('intelligine.object.type.resource.transformable')
26 26
 TYPE_NURSERY = IncrementedNamedInt.get('intelligine.object.type.nursery')
27 27
 TYPE_ANT = IncrementedNamedInt.get('intelligine.object.type.ant')
28 28
 
@@ -39,6 +39,7 @@ COL_FIGHTER = IncrementedNamedInt.get('intelligine.col.walker')
39 39
 COL_TRANSPORTER = IncrementedNamedInt.get('intelligine.col.transporter')
40 40
 COL_TRANSPORTER_CARRYING = IncrementedNamedInt.get('intelligine.col.transporter_carrying')
41 41
 COL_TRANSPORTER_NOT_CARRYING = IncrementedNamedInt.get('intelligine.col.transporter_not_carrying')
42
+COL_EATABLE = IncrementedNamedInt.get('intelligine.col.eatable')
42 43
 
43 44
 BRAIN_SCHEMA = IncrementedNamedInt.get('intelligine.brain_schema')
44 45
 BRAIN_PART_MOVE = IncrementedNamedInt.get('intelligine.brain.part.move')

+ 3 - 1
intelligine/display/pygame/visualisation.py View File

@@ -1,6 +1,7 @@
1 1
 import pygame
2 2
 from intelligine.synergy.Colony import Colony
3 3
 from intelligine.synergy.Rocks import Rocks
4
+from intelligine.synergy.object.StockedFood import StockedFood
4 5
 from synergine.synergy.Simulation import Simulation
5 6
 from synergine_xyz.display.PygameImageRotate import PygameImageRotate
6 7
 from synergine_xyz.display.PygameVisualisation import PygameVisualisation
@@ -164,7 +165,8 @@ map_config = {
164 165
         'ant': Ant,
165 166
         'egg': Egg,
166 167
         'rock': Rock,
167
-        'food': Food
168
+        'food': Food,
169
+        'stocked_food': StockedFood
168 170
     }
169 171
 }
170 172
 image_rotate = PygameImageRotate()

+ 2 - 2
intelligine/simulation/object/brain/part/transport/AntPutBrainPart.py View File

@@ -1,5 +1,5 @@
1 1
 from intelligine.core.exceptions import CantFindWhereToPut
2
-from intelligine.cst import MOVE_MODE_EXPLO, TYPE_RESOURCE_TRANSFORMABLE, CARRIED
2
+from intelligine.cst import MOVE_MODE_EXPLO, TYPE_RESOURCE_EXPLOITABLE, CARRIED
3 3
 from intelligine.simulation.object.brain.part.transport.TransportBrainPart import TransportBrainPart
4 4
 from intelligine.synergy.object.Food import Food
5 5
 from synergine_xyz.cst import POSITION, POSITIONS
@@ -9,7 +9,7 @@ class AntPutBrainPart(TransportBrainPart):
9 9
 
10 10
     # TODO: methode __nit_ pour la classe ?
11 11
     _mode_matches = {
12
-        MOVE_MODE_EXPLO: [TYPE_RESOURCE_TRANSFORMABLE],
12
+        MOVE_MODE_EXPLO: [TYPE_RESOURCE_EXPLOITABLE],
13 13
     }
14 14
 
15 15
     @classmethod

+ 3 - 3
intelligine/simulation/object/brain/part/transport/AntTakeBrainPart.py View File

@@ -1,14 +1,14 @@
1 1
 from intelligine.simulation.object.brain.part.transport.TakeBrainPart import TakeBrainPart
2 2
 from intelligine.synergy.object.ressource.Ressource import Resource
3
-from intelligine.cst import MOVE_MODE_EXPLO, MOVE_MODE, TYPE_RESOURCE_TRANSFORMABLE, \
4
-    TYPE, MOVE_MODE_GOHOME, PHEROMON_DIR_EXPLO, MOVE_MODE_NURSE, TYPE_NURSERY
3
+from intelligine.cst import MOVE_MODE_EXPLO, TYPE_RESOURCE_EXPLOITABLE, \
4
+    MOVE_MODE_GOHOME, MOVE_MODE_NURSE, TYPE_NURSERY
5 5
 
6 6
 
7 7
 class AntTakeBrainPart(TakeBrainPart):
8 8
 
9 9
     # TODO: methode __init_ pour la classe ? Pour surcharger ici.
10 10
     _mode_matches = {
11
-        MOVE_MODE_EXPLO: [TYPE_RESOURCE_TRANSFORMABLE],
11
+        MOVE_MODE_EXPLO: [TYPE_RESOURCE_EXPLOITABLE],
12 12
         MOVE_MODE_NURSE: [TYPE_NURSERY],
13 13
         MOVE_MODE_GOHOME: []
14 14
     }

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

@@ -1,12 +1,12 @@
1 1
 from intelligine.synergy.object.ressource.Ressource import Resource
2
-from intelligine.cst import TRANSPORTABLE, TYPE, TYPE_RESOURCE_TRANSFORMABLE
2
+from intelligine.cst import TYPE, TYPE_RESOURCE_EXPLOITABLE
3 3
 
4 4
 
5 5
 class Food(Resource):
6 6
 
7 7
     def __init__(self, collection, context):
8 8
         super().__init__(collection, context)
9
-        context.metas.list.add(TYPE, self.get_id(), TYPE_RESOURCE_TRANSFORMABLE)
9
+        context.metas.list.add(TYPE, self.get_id(), TYPE_RESOURCE_EXPLOITABLE)
10 10
 
11 11
     def get_what_carry(self):
12 12
         clone = self.__class__(self._collection, self._context)

+ 10 - 0
intelligine/synergy/object/StockedFood.py View File

@@ -0,0 +1,10 @@
1
+from intelligine.cst import TYPE, TYPE_RESOURCE_EXPLOITABLE, COL_EATABLE
2
+from intelligine.synergy.object.Food import Food
3
+
4
+
5
+class StockedFood(Food):
6
+
7
+    def __init__(self, collection, context):
8
+        super().__init__(collection, context)
9
+        context.metas.list.remove(TYPE, self.get_id(), TYPE_RESOURCE_EXPLOITABLE)
10
+        self._add_col(COL_EATABLE)