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...
How is crude-oil resource yield calculated?
-
- Inserter
- Posts: 46
- Joined: Fri Aug 19, 2016 2:48 pm
- Contact:
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: How is crude-oil resource yield calculated?
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.')
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Inserter
- Posts: 46
- Joined: Fri Aug 19, 2016 2:48 pm
- Contact:
Re: How is crude-oil resource yield calculated?
Many thanks!eradicator wrote:Though for internal calculations you shouldn't math.floor() it, that's just to make the printout look nice.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.')