Line 326: |
Line 326: |
| local steel = (eq:scrap().steel or 1) * 10 | | local steel = (eq:scrap().steel or 1) * 10 |
| local bauxite = (eq:scrap().bauxite or 1) * 10 | | local bauxite = (eq:scrap().bauxite or 1) * 10 |
| + | local maxRate |
| for typeGroup, resourceGroups in pairs(groups) do | | for typeGroup, resourceGroups in pairs(groups) do |
| for resourceGroup, n in pairs(resourceGroups) do | | for resourceGroup, n in pairs(resourceGroups) do |
Line 336: |
Line 337: |
| bauxite = (resourceGroup == 3 and U.red or U.id)(bauxite), | | bauxite = (resourceGroup == 3 and U.red or U.id)(bauxite), |
| } | | } |
| + | local rate = U.round(100 * n / 50) |
| result[recipe] = result[recipe] or {} | | result[recipe] = result[recipe] or {} |
− | result[recipe][Self.typeGroups[typeGroup]] = U.round(100 * n / 50) | + | result[recipe][Self.typeGroups[typeGroup]] = rate |
| + | if not maxRate or rate > maxRate then |
| + | maxRate = rate |
| + | end |
| end | | end |
| end | | end |
Line 345: |
Line 350: |
| function(recipe) | | function(recipe) |
| local types = U.isort(U.keys(result[recipe])) | | local types = U.isort(U.keys(result[recipe])) |
− | local maxRate = U.imax(U.imap(types, function(type) return result[recipe][type] end))
| |
| return U.format{ | | return U.format{ |
| rates and "${rates}" or "${recipe} (${types})", | | rates and "${rates}" or "${recipe} (${types})", |