def begin_production(self):
     super().begin_production()
     # get structure
     self.origin_structure = self.owner.entities_where(
         lambda e: isinstance(e, StructureSmithy) and e.is_idle)[0]
     # occupy structure
     self.origin_structure.fsm.change_state(states.StateLocked())
     # change to production state
     self.fsm.change_state(states.StateProduced())
 def begin_production(self):
     super().begin_production()
     # find free worker
     self.worker_unit = self.owner.entities_where(
         lambda e: isinstance(e, UnitWorker) and e.is_idle)[0]
     # pause worker for production time
     self.worker_unit.fsm.change_state(states.StateLocked())
     # change to production state
     self.fsm.change_state(states.StateProduced())