| Line 331: |
Line 331: |
| | local recipe = U.format{ | | local recipe = U.format{ |
| | "${fuel}/${ammo}/${steel}/${bauxite}", | | "${fuel}/${ammo}/${steel}/${bauxite}", |
| − | fuel = fuel, | + | fuel = (resourceGroup == 1 and U.red or U.id)(fuel), |
| − | ammo = ammo, | + | ammo = (resourceGroup == 2 and U.red or U.id)(ammo), |
| − | steel = steel, | + | steel = (resourceGroup == 1 and U.red or U.id)(steel), |
| − | bauxite = bauxite, | + | bauxite = (resourceGroup == 3 and U.red or U.id)(bauxite), |
| | } | | } |
| | result[recipe] = result[recipe] or {} | | result[recipe] = result[recipe] or {} |
| Line 345: |
Line 345: |
| | 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})", |
| | recipe = recipe, | | recipe = recipe, |
| − | types = U.ijoin(types, "/"), | + | types = U.ijoin(U.imap(types, function(type) |
| − | rates = U.ijoin(U.imap(types, function(type) return tostring(result[recipe][type]) .. "%" end), "/"), | + | local rate = result[recipe][type] |
| | + | return (rate == maxRate and U.red or U.id)(type) |
| | + | end), "/"), |
| | + | rates = U.ijoin(U.imap(types, function(type) |
| | + | local rate = result[recipe][type] |
| | + | return (rate == maxRate and U.red or U.id)(tostring(result[recipe][type]) .. "%") |
| | + | end), "/"), |
| | } | | } |
| | end | | end |