Problem:Called when a resource entity reaches 0 or its minimum yield for infinite resources.
While working on my mod I noticed yield of some oil field stop to decrease at different yield it's not uniform and so they get deleted too soon. Some reach 20% some not. I also notice that on_resource_depleted is not called if the field was already depleted not sure how I will solve that (probably scan all resources at start) but anyway. After some more digging the wiki have a explanation:
While It's a little hard to understand, I conclude that if oil field was greater than 100% at the start you would not reach this minimum. That actually explain a lot I always wonder why when playing some field didn't yield the 2/s minimum, I always thought that it was just very... very slowWhile cycles left is greater than 6000 (20% yield) and greater than 20% of the initially available cycles, each pumpjack cycle reduces the number of cycles left by one. source
I may have not see all side effect of this but it's look that on_resource_depleted get called when either 20% yield is reach or 20% of the initially available cycles is reach. However, that a little annoying cause that mean I would destroy oil field that could still yell significant resource for oil field that start with high yield.
With more testing it's look this rule doesn't apply to all infinite resource, Infinite Resources - Normal Yields code doesn't look like it's use anything special but yield of "basic-solid" look to not have this rule, yield go from 100% to 5%. Is only "basic-fluid" categories of infinite resource have this 20% of initial cycle behavior ?
My point is that "greater than 20% of the initially available cycles" is kind of hidden property that doesn't really fit the minimum property of resource prototype. It was very unexpected so I create a bug report but Loewchen tell me it should go to API request (hope it's here), again sorry if this is the wrong section, I also may have missed documentation or didn't understand how infinite resource work.
Possible Solutions:
- Remove this "and greater than 20% of the initially available cycles".
- Make it somehow configurable so I can override this behavior.
- Anything you think would solve my problems