There are two related, however distinct functions wrt overkill prevention:
1) Overkill prevention itself. Basically whenever your your unit is about to shoot the target, you can let it do, so or block this shot on target and then command to find a new one.
2) Targetting priority. After shot gets blocked (or when a unit has no target set), engine runs across all eligible targets and lets you to assign a numeric priority value.
When unit is declared doomed (from conventional always hit weapons) or disarmed (when shot by racketeer) special flags are set in OKP gadget in order to let targetting gadget know what unit is about to die or already disarmed.
That whole thing works ok in OKP department, but fails a bit with targetting priorities:
* Disarming artilery should indeed prefer units around ravager, maybe reaper scale and de-prioritize low health units. Unfortunately, the prioritization is uniform across all damage classes. Special condition clauses try to add specififics in order to reflect the nature of weapon's damage (emp, disarm, capture ray), however it's a hard task to tune priorities in that case. Good solution IMO would be a modular targetting priorities gadget, where every damage type and possibly some special weapons recieve they own specific handling and the priorities are assigned as relative numbers. I even started making such gadget, but then realized it will never get to ZK, so project kinda ran out of steam.
* The set of possible targets is not checked against how disarmed it currently is. So full health 99% disarmed dante and 0% disarmed dante will get around the same priority (the one which is closer will be selected as a target). This one could be fixable, however rigid structure of the priorities gadget (see above) may render this task time consuming.