CycleAction.run()   A
last analyzed

Complexity

Conditions 3

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 3
1
from synergine.synergy.event.Action import Action
2
from intelligine.synergy.event.CycleEvent import CycleEvent
3
from intelligine.cst import CANT_CARRY_STILL, CANT_PUT_STILL
4
5
6
class CycleAction(Action):
7
8
    _listen = CycleEvent
9
10
    def run(self, obj, context, synergy_manager):
11
        cant_carry_still = context.metas.value.get(CANT_CARRY_STILL, obj.get_id(), allow_empty=True, empty_value=0)
12
        if cant_carry_still > 0:
13
            context.metas.value.set(CANT_CARRY_STILL, obj.get_id(), cant_carry_still-1)
14
15
        cant_put_still = context.metas.value.get(CANT_PUT_STILL, obj.get_id(), allow_empty=True, empty_value=0)
16
        if cant_put_still > 0:
17
            context.metas.value.set(CANT_PUT_STILL, obj.get_id(), cant_put_still-1)
18