Here’s some code that does the following: it adds a ‘Search’ button to the specified units (currently RUSCommander and RUSCommissar), which calls the LookForMines() COB function. Also included is a BOS .h file that implements such a function, and some lua code that does the actual work.
To be considered for clearing, mines should have a ismine=1; customParams entry. Clearing is controlled via #defines in the unit script. Those can be defined either in the .h file (affect all the mine clearing units globally) or in the unit BOS file (override globals for that specific unit). All the nearby mines are removed, not just hostile ones (all mines should be hostile to everyone imo).
To add mine clear function to more units:
- add those units into LuaRules/Configs/cob_buttons.lua (unit names should be in lowercase only);
- #include “engineerMineClear.h” into unit’s BOS, recompile it;
- (optionally) mark some more stuff as mines for clearing by adding isMine=1; into customParams.
This uses quantum’s CobButton gadget (included in the archive) for the lua command button, I found that one easy and quick to use.