In particular, it assigns ANY* unittype an invisible metal extractor.

luaRule + PressureLine's bmobmex(updated)
video
The script has a config file, so you can edit it easily to your needs.
So you can switch between 2 modes: always extract and a button handled extraction (the unit can't move then while extracting). Also it calls the COB events "MexDeploy"+"MexPackUp", so you can react on walk<->extraction changes.
If you want to use the new COB->lua interface, you need a working luaCOB folder and then you can call in your cob-script "lua_ChangeMexState(TRUE|FALSE)" and don't forget the fake luaCob function. For examples see PressureLine's bmobmex, which is included.
Of course, you can edit the extraction power and range.
(and yes the unit which the mexe is assigned to shows the metal extraction)
Note: To use the script you need a working luaRules folder (if you don't have one you should extract complete annihilation). Only if you want to use the COB->lua interface you need a working luaCob folder, too. And don't forget to change the default (hidden) metal extractor in the config file, if your mod don't have the armmex.
*except metal extractors itself! ->the choosen unittype which should be able to move must NOT extract metal itself. The metal extracts another hidden unit (normally an armmex) and copy the metal stats to the visible unit. btw you can change the extraction stats of the hidden mexe in the config file, so the hidden unit can be an armmex but have got the extraction strength of a moho mine.
changelog v2->v3:
*the hidden mexes are now gaiaTeam units. that fix the unitlimit problem and destroyed mobile mexes don't count as 2 units in the statistics anymore, also it cleans up your ressource bar alot (no +(double income) -(income) anymore

changelog v1->v2:
*Because renames, it is recommend to delete the old gadget+config before you install the new version!
*fixed a problem with uppercases in unitnames
*add PressureLine's shiny bmobmex
*fixed wrong shown metal income
*renamed the cob interfaces
*add a cob->lua interface
Special tanks to: PressureLine for the idea + the pretty bmobmex <3