Other great resources: Official JS API docs, Scripting Forum
Working with Repairs & Rearming
<incomplete stub article>
eventDroidIdle() is triggered once the repairs/rearming is complete.
You can keep track of every stage of the repair process by looking at the properties of the Droid object.
If the .order property is DORDER_RTR, DORDER_RTR_SPECIFIED or DORDER_REARM, the droid hasn't yet been repaired/rearmed.
You can determine what stage of the repair/rearm process the droid is at by looking at it's .action property:
DACTION_MOVETOREPAIR or DACTION_MOVETOREARM – the droid is still travelling to the repair facility or rearming pad
DACTION_WAITFORREPAIR or DACTION_WAITFORREARM – the droid has arrived at facility/pad, but it's had to join a queue of other droids waiting for repairs/rearming
DACTION_MOVETOREPAIRPOINT or DACTION_MOVETOREARMPOINT – the droid is now moving to the facility or landing on the pad
DACTION_WAITDURINGREPAIR or DACTION_WAITDURINGREARM – repairs/rearming is in progress
As repairs are being performed, the droid's .health property will increase towards 100, and if it's a VTOL it's .armed property will also increase towards 100.
Once repairs/rearming is complete, the following will happen:
Land units will move to the repair facility rally point
VTOLs will either continue their last mission or if the previous mission was completed they'll remain on the rearming pad.
Note that VTOLs are sometimes told to move away from a rearming pad (eg. if they are repaired and another VTOL needs the pad, or if a land unit is trying to move across the pad). In this scenario the droid action will be DACTION_CLEARREARMPAD.