Total Complexity | 4 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Changes | 4 | ||
Bugs | 0 | Features | 0 |
1 | from intelligine.core.exceptions import BestMoleculeHere |
||
12 | class SmellAction(Action): |
||
13 | |||
14 | _listen = SmellEvent |
||
15 | _depend = [MoveAction] |
||
16 | |||
17 | @classmethod |
||
18 | def cycle_pre_run(cls, context, synergy_manager): |
||
19 | evaporation = Evaporation(context, molecules_include_types=[SMELL_FOOD, SMELL_EGG]) |
||
20 | evaporation.remove() |
||
21 | |||
22 | def run(self, obj, context, synergy_manager): |
||
23 | |||
24 | points_distances = self._parameters['points_distances'] |
||
25 | smell_type = obj.get_smell() |
||
26 | |||
27 | for smell_point in points_distances: |
||
28 | distance = points_distances[smell_point] |
||
29 | molecule = Molecule(MOLECULES_DIRECTION, smell_type, distance) |
||
30 | |||
31 | try: |
||
32 | DirectionMolecule.appose(context, smell_point, molecule) |
||
33 | except BestMoleculeHere: |
||
34 | pass |
||
35 |