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

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

2
 from intelligine.synergy.event.move.MoveEvent import MoveEvent
2
 from intelligine.synergy.event.move.MoveEvent import MoveEvent
3
 from random import randint, choice
3
 from random import randint, choice
4
 from xyzworld.cst import POSITION, POSITIONS
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
 from intelligine.synergy.event.move.direction import directions_same_level, directions_modifiers, directions_slighty
6
 from intelligine.synergy.event.move.direction import directions_same_level, directions_modifiers, directions_slighty
7
 
7
 
8
 
8
 
51
         return direction_name
51
         return direction_name
52
 
52
 
53
     def _direction_point_is_possible(self, context, direction_point):
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
     def run(self, obj, collection, context, synergy_manager):
56
     def run(self, obj, collection, context, synergy_manager):
61
         if self._move_to_point is not None:
57
         if self._move_to_point is not None:

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

43
     def _is_available_position(self, context, position):
43
     def _is_available_position(self, context, position):
44
         # TODO: Pour le moment on ne regarde pas si ce sont tous des oeufs
44
         # TODO: Pour le moment on ne regarde pas si ce sont tous des oeufs
45
         count_obj_here = len(context.metas.list.get(POSITIONS, position, allow_empty=True))
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
             return True
47
             return True
48
         return False
48
         return False