trusted
167
edits
(Only display headers if both sections exist, split components/buildings only when making table, remove unused sort) |
(Add Proliferator data and comments, correct rtable -> output) |
||
Line 19: | Line 19: | ||
-- exported functions | -- exported functions | ||
-- recipesMaking | |||
-- print out table rows of all recipes making an item with full information | |||
-- the recipe, the building, technology to unlock it, etc. | |||
function funcs.recipesMaking(frame) | function funcs.recipesMaking(frame) | ||
Line 49: | Line 53: | ||
return table.concat(rtable, '\n') | return table.concat(rtable, '\n') | ||
end | end | ||
-- recipesUsing | |||
-- print out table rows of all recipes using an item with full information, like recipesMaking | |||
-- split output into components and buildings | |||
function funcs.recipesUsing(frame) | function funcs.recipesUsing(frame) | ||
Line 93: | Line 101: | ||
return table.concat(output, '\n') | return table.concat(output, '\n') | ||
end | end | ||
-- itemRecipes | |||
-- print out just recipe information on how to make an item | |||
-- intended for use in ItemInfo boxes | |||
function funcs.itemRecipes(frame) | function funcs.itemRecipes(frame) | ||
Line 115: | Line 127: | ||
end | end | ||
if isItemOcean(item.ID) then | if isItemOcean(item.ID) then | ||
table.insert( | table.insert(output, oceanRecipe(item, frame)) | ||
end | end | ||
return table.concat(output, '\n') | return table.concat(output, '\n') | ||
end | end | ||
-- itemField | |||
-- print a field from an item | |||
-- used to extract details about an item | |||
function funcs.itemField(frame) | function funcs.itemField(frame) | ||
Line 132: | Line 148: | ||
end | end | ||
-- make rows and recipe data for tables | -- make full rows and recipe data for tables | ||
function recipeRow(recipe, frame) | function recipeRow(recipe, frame) | ||
Line 153: | Line 169: | ||
else | else | ||
rdata.Technology = '' | rdata.Technology = '' | ||
end | |||
local productive = not recipe.NonProductive | |||
for i, itemid in ipairs(recipe.Items) do | |||
productive = productive and itemByID(itemid).Productive | |||
end | |||
if productive then | |||
rdata.Proliferator = 'Yes' | |||
else | |||
rdata.Proliferator = 'Speed' | |||
end | end | ||
return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=rdata} | return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=rdata} | ||
Line 197: | Line 222: | ||
Technology = titleCase(extractorTech.Name), | Technology = titleCase(extractorTech.Name), | ||
Recipe = oilRecipe(item, vein, frame), | Recipe = oilRecipe(item, vein, frame), | ||
Proliferator='No', | |||
} | } | ||
return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=oildata} | return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=oildata} | ||
Line 207: | Line 233: | ||
Technology = titleCase(minerTech.Name), | Technology = titleCase(minerTech.Name), | ||
Recipe = veinRecipe(item, vein, frame), | Recipe = veinRecipe(item, vein, frame), | ||
Proliferator='No', | |||
} | } | ||
return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=veindata} | return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=veindata} | ||
Line 242: | Line 269: | ||
Replicator = 'Mine', | Replicator = 'Mine', | ||
Technology = titleCase(collectorTech.Name), | Technology = titleCase(collectorTech.Name), | ||
Recipe = gasGiantRecipe(giant, frame) | Recipe = gasGiantRecipe(giant, frame), | ||
Proliferator='No', | |||
} | } | ||
return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=giantdata} | return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=giantdata} | ||
Line 268: | Line 296: | ||
Replicator = 'No', | Replicator = 'No', | ||
Technology = titleCase(pumpTech.Name), | Technology = titleCase(pumpTech.Name), | ||
Recipe = oceanRecipe(item, frame) | Recipe = oceanRecipe(item, frame), | ||
Proliferator='No', | |||
} | } | ||
return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=oceandata} | return '|-\n| ' .. frame:expandTemplate{title='ProductionChain', args=oceandata} |