Browse Source

Direction molecules: Now we include reference point, consider it when test if molecules found

Bastien Sevajol 8 years ago
parent
commit
183d15a518
1 changed files with 4 additions and 2 deletions
  1. 4 2
      intelligine/simulation/molecule/DirectionMolecule.py

+ 4 - 2
intelligine/simulation/molecule/DirectionMolecule.py View File

@@ -24,7 +24,8 @@ class DirectionMolecule():
24 24
         around_molecules_points = cls._get_around_molecules(context, point, molecule_type,
25 25
                                                             molecule_filter=around_molecule_filter)
26 26
 
27
-        if not around_molecules_points:
27
+        if not around_molecules_points \
28
+           or (len(around_molecules_points) == 1 and around_molecules_points[0][0] == point):
28 29
             raise NoMolecule()
29 30
 
30 31
         shuffle(around_molecules_points)
@@ -74,7 +75,8 @@ class DirectionMolecule():
74 75
             except NoMolecule:
75 76
                 pass  # Ok, no molecule, continue to sniff around
76 77
 
77
-        if not around_molecules_points:
78
+        if not around_molecules_points \
79
+           or (len(around_molecules_points) == 1 and around_molecules_points[0][0] == reference_point):
78 80
             raise NoMolecule()
79 81
 
80 82
         shuffle(around_molecules_points)