Infinite Resources - Normal Yields (with optional depletion)


An infinite resource mod that allows miners to continue mining ore resources at the normal vanilla rates (no insane yields!), and then can optionally start decreasing to lower yields after the initial spawned resource amounts are mined, with only a single code execution per resource tile. Includes settings for minimum depletion level and rate of depletion. This mod is for those that want the benefit of infinite resources (never running out), while preserving the vanilla rate and feel.

Tweaks
1 year, 2 months ago
1.1
17.4K
Mining

i [will not implement] Logarithm Depletion rate

2 years ago

The depletion rate is a constant (AFAIK) I wonder if a logarithm rate could be added, purpose would be to have a depletion rate more smooth that the actual behavior.

2 years ago

I'm simply using vanilla methods and values and tweaking them. I can't change the formula from linear to anything else without completely doing away with the current method and using custom code and methods, which will add (in my opinion) unnecessary UPS overhead.

1 year, 7 months ago
(updated 1 year, 7 months ago)

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.

1 year, 7 months ago
(updated 1 year, 7 months ago)

This allow to have a slow reduction of output rate instead of going for 100% to 20% instantly you would go more slowly.

This is already accomplishable with the settings I provide. Specifically, use the Depletion Rate startup setting and set it to a higher value. The higher you set it, the longer it takes to deplete from 100% to 20% (if 20% is your set minimum). There's no need to go and override that value you cite seems the game is going to calculate it based on the depletion rate you provide.

If you feel the max allowed value of 1000 (meaning it will deplete at a rate of 1% every 10 successful mining cycles, which I believe would be the equivalent of setting that infinite_depletion_amount value to 0.1) is not high enough, then you can simply ask me to consider raising it.

1 year, 7 months ago
(updated 1 year, 7 months ago)

If you feel the max allowed value of 1000 (meaning it will deplete at a rate of 1% every 10 successful mining cycles, which I believe would be the equivalent of setting that infinite_depletion_amount value to 0.1) is not high enough, then you can simply ask me to consider raising it.

Yes and no, my point was it's FAR from obvious that we can do that with this setting (thus the description actually explain it I missed it for 1 year), it's totally unexpected, when I looked at the code I have been very surprise to see minimum calculation. If I set min to 20% and max to 1000%, as user I expect the field generate would be at 1000% with your code it's not at all what is happening I would get a field a 100% (thus I didn't tested ^^), hence that VERY unexpected (I was even surprise that max was allowed to be set to more than 100 !). With a cycle param (so not a %) it's way more clear for an user to understand the mechanic. Thus, the implementation is not important my code snipped was just a suggestion.

1 year, 7 months ago
(updated 1 year, 7 months ago)

I thought I made it clear in the setting’s tooltip that depletion rate is not the same as the tile’s max %, but I’ll take another pass at it after the weekend.

Edit: As I just had to start my computer anyway for something else, this is what is currently in the mod's tooltip for that setting:

The "normal" value for infinite resources. For the purposes of this mod, this is used to determine how quickly the infinite resource will deplete from 100% to the set minimum value at a rate of 100/value in percentage points.

A value of 100 will cause it to deplete at a rate of 1% per mining cycle.
Values under 100 will cause it to deplete faster. 25 means 4% per mining cycle, 50 is 2% per cycle, etc.
Valuse over 100 will cause it to deplete slower. 200 means 1% per 2 mining cycles, while 400 is 1% per 4 cycle, etc.

(This also points out to me I made a spelling mistake, apparently.)

New response