Модуль:Meals Lookup: различия между версиями

grindableRecipes
Нет описания правки
Строка 6: Строка 6:


--#region universal
--#region universal
function getrecipetypes(type) -- should not be invoked
function getrecipesfromtype(frame, type) -- should not be invoked
     return p.meals[type]
     return p.meals[type]
end
end


function getrecipe(type, id) -- should not be invoked
function getrecipe(frame, type, id) -- should not be invoked
     return getrecipetypes(type)[id:gsub(' ', '')]
     return getrecipesfromtype(frame, type)[id:gsub(' ', '')]
end
end


function getrecipetypes(id) -- should not be invoked
function getrecipetypes(frame, id) -- should not be invoked
     local out = {}
     local out = {}
     for type, recipes in pairs(p.meals) do
     for type, recipes in pairs(p.meals) do
Строка 39: Строка 39:
     local out = ""
     local out = ""
     for item, amount in pairs(array) do
     for item, amount in pairs(array) do
        -- out = out .. frame:expandTemplate{ title = "Chem Recipe Component", reagent = item, amount = amount}
         out = out .. frame:preprocess( "{{Chem Recipe Component|reagent=".. item .."|amount={{{"..amount.."|1}}}}}" )
         out = out .. frame:preprocess( "{{Chem Recipe Component|reagent=".. item .."|amount={{{"..amount.."|1}}}}}" )
     end
     end
     return out
     return out
end
end
--#endregion
--#endregion


Строка 67: Строка 67:
     local out = ""
     local out = ""
     local id = frame.args[1]:gsub(' ', '')
     local id = frame.args[1]:gsub(' ', '')
     local recipe = getrecipe("microwaveRecipes", id)
     local recipe = getrecipe(frame, "microwaveRecipes", id)
     local solids = buildsolids(frame, getmicrowaverecipesolids(frame, recipe))
     local solids = buildsolids(frame, getmicrowaverecipesolids(frame, recipe))
     local reagents = buildreagents(frame, getmicrowaverecipereagents(frame, recipe))
     local reagents = buildreagents(frame, getmicrowaverecipereagents(frame, recipe))
Строка 85: Строка 85:
     local out = ""
     local out = ""
     local id = frame.args[1]:gsub(' ', '')
     local id = frame.args[1]:gsub(' ', '')
     local recipe = getrecipe("sliceableRecipes", id)
     local recipe = getrecipe(frame, "sliceableRecipes", id)
     out = frame:preprocess("{{Recipe Box"..
     out = frame:preprocess("{{Recipe Box"..
     "|name={{#invoke:Entity Lookup|getname|".. recipe["result"] .."}}"..
     "|name={{#invoke:Entity Lookup|getname|".. recipe["result"] .."}}"..
Строка 120: Строка 120:
     out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|".. frame.args[1] .. "}}")
     out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmicrowaverecipebox|".. frame.args[1] .. "}}")
     out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmslicerecipebox|".. frame.args[2] .. "}}")
     out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmslicerecipebox|".. frame.args[2] .. "}}")
    out = out .. "\n" .. frame:preprocess("{{#invoke:Meals Lookup|buildmgrindrecipebox|".. frame.args[3] .. "}}")
     -- out = out .. p.buildmicrowaverecipebox(frame, frame.args[1])
     -- out = out .. p.buildmicrowaverecipebox(frame, frame.args[1])
     return out
     return out