Page 1 of 1

How is crude-oil resource yield calculated?

Posted: Tue Sep 04, 2018 10:51 pm
by Theanderblast
I've written a mod called Max Rate Calculator, which provides a selection tool you can use on a set of machines, and it calculates the net throughput rates, considering the beacons, modules, etc.

I've been asked to extend this to include mining-drills. For ores, it's relatively simple (though I haven't looked at uranium miners and the sulfuric acid inputs), but when the entity's mining_target is crude-oil, how can I calculate the units produced per second? The tooltip shows a 'yield' percentage, and I can see from the wiki how to get from that to production rate, but how is that percentage calculated?

Thanks in advance...

Re: How is crude-oil resource yield calculated?

Posted: Wed Sep 05, 2018 7:18 am
by eradicator

Code: Select all

/c
local that = game.player.selected
game.print('This oil field has '.. math.floor((that.amount/that.prototype.normal_resource_amount)*100) ..'% yield.')
Though for internal calculations you shouldn't math.floor() it, that's just to make the printout look nice.

Re: How is crude-oil resource yield calculated?

Posted: Wed Sep 05, 2018 11:40 am
by Theanderblast
eradicator wrote:

Code: Select all

/c
local that = game.player.selected
game.print('This oil field has '.. math.floor((that.amount/that.prototype.normal_resource_amount)*100) ..'% yield.')
Though for internal calculations you shouldn't math.floor() it, that's just to make the printout look nice.
Many thanks!