CycleAction.py 751B

12345678910111213141516171819
  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. class CycleAction(Action):
  5. _listen = CycleEvent
  6. def run(self, obj, context, synergy_manager):
  7. # TODO: refact ...
  8. cant_carry_still = context.metas.value.get(CANT_CARRY_STILL, obj.get_id(), allow_empty=True, empty_value=0)
  9. if cant_carry_still > 0:
  10. context.metas.value.set(CANT_CARRY_STILL, obj.get_id(), cant_carry_still-1)
  11. cant_put_still = context.metas.value.get(CANT_PUT_STILL, obj.get_id(), allow_empty=True, empty_value=0)
  12. if cant_put_still > 0:
  13. context.metas.value.set(CANT_PUT_STILL, obj.get_id(), cant_put_still-1)