I'm starting to dig a little factorio api. I notice it's possible to use infinite_depletion_amount the default is 1 while it's not exactly what I asked this is builtin for example you could have a setting that config the number of cycle before the field reach it's minimal value.
// date-updates.lua
local normal = settings.startup["InfiniteResourcesNormalYieldDepletion_normal"].value
* settings.startup["InfiniteResourcesNormalYieldDepletion_cycle"].value
infiniteresource.minimum = settings.startup["InfiniteResourcesNormalYieldDepletion_minimum"].value * (normal / 100)
infiniteresource.normal = normal
infiniteresource.infinite_depletion_amount =
settings.startup["InfiniteResourcesNormalYieldDepletion_normal"].value
- settings.startup["InfiniteResourcesNormalYieldDepletion_minimum"].value
// control.lua
resource.surface.create_entity({name = resource.name .. "-infinite", amount = settings.startup["InfiniteResourcesNormalYieldDepletion_normal"].value * settings.startup["InfiniteResourcesNormalYieldDepletion_cycle"].value, position = resource.position, force = game.forces.neutral, raise_built = true})
so for min 20 max 100 cycle 1000 that give 20_000 100_000 and 1000 cycle that remove 80 by cycle. That could be currently achieve by setting min to 20 and max to 1000 but we go back to problem this mod try to avoid and it's very limited (I would advice to even change the max max... to 100). But with my idea user can go much higher very simply. Want 100 000 cycle ? easy, currently it's impossible to go very high and it's complicated.
This allow to have a slow reduction of output rate instead of going for 100% to 20% instantly you would go more slowly.