CycleAction.py 742B

123456789101112131415161718
  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. cant_carry_still = context.metas.value.get(CANT_CARRY_STILL, obj.get_id(), allow_empty=True, empty_value=0)
  8. if cant_carry_still > 0:
  9. context.metas.value.set(CANT_CARRY_STILL, obj.get_id(), cant_carry_still-1)
  10. cant_put_still = context.metas.value.get(CANT_PUT_STILL, obj.get_id(), allow_empty=True, empty_value=0)
  11. if cant_put_still > 0:
  12. context.metas.value.set(CANT_PUT_STILL, obj.get_id(), cant_put_still-1)