PutOutsideAction.run()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4285
cc 1
1
from intelligine.cst import CANT_CARRY_STILL, BRAIN_PART_PUT, COL_PUT_OUTSIDE, MODE_EXPLO
2
from intelligine.synergy.event.transport.PutOutsideEvent import PutOutsideEvent
3
from intelligine.synergy.event.transport.PutableAction import PutableAction
4
5
6
class PutOutsideAction(PutableAction):
7
    _listen = PutOutsideEvent
8
9
    def run(self, obj, context, synergy_manager):
10
        # TODO: Refact avec pare,t
11
        obj_transported = obj.get_carried()
12
        obj_transported.set_carried_by(None)
13
        obj.put_carry(obj_transported, self._parameters['position_to_put'])
14
        context.metas.value.set(CANT_CARRY_STILL, obj.get_id(), 5)
15
        obj.reinit_put_fail_count()
16
17
        #  obj.get_brain().get_part(BRAIN_PART_PUT).done(obj_transported)
18
        obj._remove_col(COL_PUT_OUTSIDE)
19
        obj.get_brain().switch_to_mode(MODE_EXPLO)  # TODO: dans le brain.done
20