I think you should just make the factories have little bots that auto repair structures and units around them so long as they're not in combat....
Separate names with a comma.