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.
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 that may fit in "mod request", I'm not used to this forum so pardon me. 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