Infinite resources: how to calculate minimum yield in 0.15+? How about current yield?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 278
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Infinite resources: how to calculate minimum yield in 0.15+? How about current yield?

Post by Narc »

I've noticed that, given an infinite resource entity in the world, I can query entity.initial_amount. I can also get entity.prototype.minimum_resource_amount. According to the changelog, this should be enough data to calculate the minimum yield:
0.15.0 changelog wrote:Infinite resource minimal yield is calculated using the initial resource amount and the prototype minimum yield.
...but what's the formula? I'd rather not take a guess and get it wrong, if I can help it. I know in the base game only oil is infinite, but I'd also rather not hard-code that assumption -- there are many mods.

On the same note, having both of the above and also entity.amount, can I calculate the current yield of that same resource? And how?

Post Reply

Return to “Modding help”