| Total Complexity | 3 | 
| Total Lines | 21 | 
| Duplicated Lines | 0 % | 
| Changes | 0 | ||
| 1 | from intelligine.synergy.event.move.MoveAction import MoveAction  | 
            ||
| 9 | class TakeableAction(Action):  | 
            ||
| 10 | |||
| 11 | _listen = TakeableEvent  | 
            ||
| 12 | _depend = [MoveAction]  | 
            ||
| 13 | |||
| 14 | def __init__(self, object_id, parameters):  | 
            ||
| 15 | super().__init__(object_id, parameters)  | 
            ||
| 16 | |||
| 17 | def run(self, obj, context, synergy_manager):  | 
            ||
| 18 | obj_id_transportable = self._parameters[TakeableEvent.PARAM_TAKE]  | 
            ||
| 19 | obj_transportable = synergy_manager.get_map().get_object(obj_id_transportable)  | 
            ||
| 20 | |||
| 21 | if not obj_transportable.is_takable():  | 
            ||
| 22 | raise ActionAborted()  | 
            ||
| 23 | |||
| 24 | obj_carried = obj_transportable.get_what_carry()  | 
            ||
| 25 | obj_carried.set_carried_by(obj)  | 
            ||
| 26 | obj.carry(obj_carried)  | 
            ||
| 27 |         cant_put_still = Core.get_configuration_manager().get('ant.take.cant_put_still') | 
            ||
| 28 | context.metas.value.set(CANT_PUT_STILL, obj.get_id(), cant_put_still)  | 
            ||
| 29 | obj.get_brain().get_part(BRAIN_PART_TAKE).done(obj_carried)  | 
            ||
| 30 |