It sounds reasonable. However, as you say it's not that easy. The main issues are:
- The AI doesn't really have a central command and control, so there is no concept of 'sending a unit to do XXX' (well, I've started to add one with the contract brokering system, but it's not yet widely used, and the base BTS AI has no such concept). Thus there is nothing to 'decide to send a combat worker...' - workers decide what to do on their own by looking for work that needs doing.
- Calling for reinforcements in a dangerous situation should probably not stop it ALSO seeking (local) safety (else it'll likely die before the reinforcements arrive)
- Deciding when to build them might be tricky. Currently it is city AIs that decide what needs building, and in vanilla BTS they do so themselves. In C2C they no longer go ahead and build them - instead they place an order for them, which might be picked up by the originating city, or might be picked up by some other city that is better placed to do it. This new system allows any piece of code (not just the city AI) to place such an order, so one possibility would be to have a normal worker do so when it decides there is too much danger for it to do the work itself.
It's certainly not the easiest ask you could pick as a starterHowever, I don't see it rating as high on my priooprity list for a while either.
Yeah, I'll put this on the back burner for now. Please check out the new AI thread I created for continuation of AI discussions, as this is only very tenuously worker related.
