How does GASMASK iuse function work?

Basically in title. How is it implemented? Does used/empty cartridge drop from mask when used up or does it disappear with no scavenge part? Flag did not exist when I started my mod, now it is here. Maybe it make my mod easier to do, but need to know how its working, can’t find description in game file.

GASMASK is implemented as iuse::gasmask.cpp in src/iuse.cpp.

Every turn you’re in a gas field while wearing an activated gas mask, a gas_absorbed item variable is incremented by 12 for smoke or 15 for other fields. When gas_absorbed goes over 100, a charge is consumed and gas_absorbed is set to 0. If charges go to 0, the gas mask is deactivated.

Is there way to make that spent filter cartridge is recovered? Similar to magazine flag MAG_EJECT, only for used canister. Can it be modified in JSON on mask or canister entry without compiling? As is now, filter canister is used up and unrecoverable, is main problem for using GASMASK function on gasmask mod. I have using MAG_EJECT and item transforms, but is simpler if using GASMASK function, except for no dropped canister, which is needed.

The gasmask function doesn’t handle the spent cartridges. It just deactivates the gas mask when there are no charges left.

It would be handy to be able to recycle the plastic components from the filter cartridges.

Works as expected, only new problem. Gas mask does not activation when use key pressed, even with filter displays message “no filter”. Testing shows problems with using magazine containing filter charge. Meaning charges must be in mask itself, not magazine item attached, containing charges. Even if magazine item contains base game “filter cartridge” does not work, so issue of custom charge is not problem. Thinking mask is treating magazine item as the charges, not as containing charges.
Would like to use gasmask action, as cuts item entry by 50%, makes extreme fluid motion for changing filter, only magazine containing charges is not possible, it cannot be used.