CycleAction   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
dl 0
loc 12
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 8 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