It's not clean, but assist targets for factories are validated in commandmode.lua (around line 549, with the ValidateAssist
sim callback). You could hook that function, check for your conditions, then clear the commands. That would prevent the assist order from materializing but wouldn't prevent the order queue from being cancelled etc. etc.
Alternatively, you could hook HandleEvent
in controls/worldview.lua, check the click target, and eat the input command (return "true" from HandleEvent
).