Browse Source

bug fix: Egg can't be put on impenetrable position

Bastien Sevajol 9 years ago
parent
commit
60f7d58916

+ 2 - 2
config.py View File

@@ -1,4 +1,4 @@
1
-from xyzworld.Context import Context as XyzContext
1
+from intelligine.core.Context import Context
2 2
 from intelligine.synergy.Simulation import Simulation
3 3
 from intelligine.display.Pygame import Pygame
4 4
 from intelligine.display.pygame.visualisation import visualisation as pygame_visualisation
@@ -18,7 +18,7 @@ config = {
18 18
     'app': {
19 19
         'name': 'StigEngine',
20 20
         'classes': {
21
-          'Context': XyzContext
21
+          'Context': Context
22 22
         }
23 23
     },
24 24
     'engine': {

+ 2 - 6
intelligine/synergy/event/move/MoveAction.py View File

@@ -2,7 +2,7 @@ from synergine.synergy.event.Action import Action
2 2
 from intelligine.synergy.event.move.MoveEvent import MoveEvent
3 3
 from random import randint, choice
4 4
 from xyzworld.cst import POSITION, POSITIONS
5
-from intelligine.cst import IMPENETRABLE, PREVIOUS_DIRECTION, BLOCKED_SINCE
5
+from intelligine.cst import PREVIOUS_DIRECTION, BLOCKED_SINCE
6 6
 from intelligine.synergy.event.move.direction import directions_same_level, directions_modifiers, directions_slighty
7 7
 
8 8
 
@@ -51,11 +51,7 @@ class MoveAction(Action):
51 51
         return direction_name
52 52
 
53 53
     def _direction_point_is_possible(self, context, direction_point):
54
-        objects_ids_on_this_point = context.metas.list.get(POSITIONS, direction_point, allow_empty=True)
55
-        for object_id_on_this_point in objects_ids_on_this_point:
56
-          if context.metas.states.have(object_id_on_this_point, IMPENETRABLE):
57
-            return False
58
-        return True
54
+        return context.position_is_penetrable(direction_point)
59 55
 
60 56
     def run(self, obj, collection, context, synergy_manager):
61 57
         if self._move_to_point is not None:

+ 1 - 1
intelligine/synergy/event/transport/PutableAction.py View File

@@ -43,6 +43,6 @@ class PutableAction(Action):
43 43
     def _is_available_position(self, context, position):
44 44
         # TODO: Pour le moment on ne regarde pas si ce sont tous des oeufs
45 45
         count_obj_here = len(context.metas.list.get(POSITIONS, position, allow_empty=True))
46
-        if count_obj_here <= 5:
46
+        if count_obj_here <= 5 and context.position_is_penetrable(position):
47 47
             return True
48 48
         return False