Модуль:Meals Lookup: различия между версиями
Tfmb (обсуждение | вклад) мНет описания правки |
Mhamster (обсуждение | вклад) ахахахаххаа |
||
| Строка 64: | Строка 64: | ||
for item, amount in pairs(array) do | for item, amount in pairs(array) do | ||
out = out .. frame:preprocess("{{Chem Recipe Component|reagent=" .. item .. "|amount=" .. amount .. "}}") | out = out .. frame:preprocess("{{Chem Recipe Component|reagent=" .. item .. "|amount=" .. amount .. "}}") | ||
end | |||
return out | |||
end | |||
function getrecipesbyname(frame, str) -- should not be inviked | |||
local out = {} | |||
for type, recipes in pairs(p.meals) do | |||
for recipeId, recipe in pairs(recipes) do | |||
if string.match(recipeId, str) then | |||
table.insert(out, recipe) | |||
end | |||
end | |||
end | end | ||
return out | return out | ||
| Строка 143: | Строка 155: | ||
"|transformer={{Recipe Transformers|microwaveRecipes|" .. recipe["time"] .. "}}" .. | "|transformer={{Recipe Transformers|microwaveRecipes|" .. recipe["time"] .. "}}" .. | ||
"|result=" .. | "|result=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | ||
"}}") | "}}") | ||
| Строка 172: | Строка 184: | ||
"|transformer={{Recipe Transformers|sliceableRecipes}}" .. | "|transformer={{Recipe Transformers|sliceableRecipes}}" .. | ||
"|result=" .. | "|result=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "|amount=" .. recipe["count"] .. "}}") .. | recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "|amount=" .. recipe["count"] .. "}}") .. | ||
"}}") | "}}") | ||
| Строка 198: | Строка 210: | ||
"|name={{#invoke:Entity Lookup|getname|" .. recipe["id"] .. "}}" .. | "|name={{#invoke:Entity Lookup|getname|" .. recipe["id"] .. "}}" .. | ||
"|component-1=" .. | "|component-1=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["input"] .. "}}|image=" .. getimage(frame, recipe["input"]) .. "}}") .. | recipe["input"] .. "}}|image=" .. getimage(frame, recipe["input"]) .. "}}") .. | ||
"|transformer={{Recipe Transformers|grindableRecipes}}" .. | "|transformer={{Recipe Transformers|grindableRecipes}}" .. | ||
| Строка 229: | Строка 241: | ||
"|transformer={{Recipe Transformers|heatableRecipes|" .. recipe["minTemp"] .. "}}" .. | "|transformer={{Recipe Transformers|heatableRecipes|" .. recipe["minTemp"] .. "}}" .. | ||
"|result=" .. | "|result=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | ||
"}}") | "}}") | ||
| Строка 259: | Строка 271: | ||
"|transformer={{Recipe Transformers|" .. transformer .. "}}" .. | "|transformer={{Recipe Transformers|" .. transformer .. "}}" .. | ||
"|result=" .. | "|result=" .. | ||
frame:preprocess("{{ | frame:preprocess("{{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | ||
recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | recipe["result"] .. "}}|image=" .. getimage(frame, recipe["result"]) .. "}}") .. | ||
"}}") | "}}") | ||
| Строка 296: | Строка 308: | ||
"|component-1=" .. input .. | "|component-1=" .. input .. | ||
"|transformer={{Recipe Transformers|mixableRecipes}}" .. | "|transformer={{Recipe Transformers|mixableRecipes}}" .. | ||
"|result={{ | "|result={{Recipe Component|item={{#invoke:Entity Lookup|getname|" .. | ||
output .. "}}|image=" .. getimage(frame, output) .. "|amount=" .. outamount .. "}}" .. | output .. "}}|image=" .. getimage(frame, output) .. "|amount=" .. outamount .. "}}" .. | ||
"}}") | "}}") | ||
| Строка 311: | Строка 323: | ||
--#endregion mixableRecipes | --#endregion mixableRecipes | ||
--#region dishes | |||
function p.soups(frame) | |||
local out = "" | |||
return out | |||
end | |||
--#endregion | |||
| Строка 316: | Строка 335: | ||
function p.tests(frame) | function p.tests(frame) | ||
local out = "" | local out = "" | ||
for r in getrecipesbyname(frame, "[Ss]oup") do | |||
out = out .. " " .. r["id"] | |||
end | |||
return out | return out | ||
end | end | ||
return p | return p | ||