Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 296: | Строка 296: | ||
end | end | ||
local out = "" | local out = '{| class="wikitable"\n! Станок ID\n! Рецепт\n' | ||
local foundAny = false | local foundAny = false | ||
for _, lathe in ipairs(latheData) do | for _, lathe in ipairs(latheData) do | ||
local recipes = getLatheRecipes(lathe) | local recipes = getLatheRecipes(lathe) | ||
local | local materialUseMultiplier = (lathe.Lathe and lathe.Lathe.materialUseMultiplier) or 1 | ||
local timeMultiplier = (lathe.Lathe and lathe.Lathe.timeMultiplier) or 1 | |||
for _, recipe in ipairs(recipes) do | for _, recipe in ipairs(recipes) do | ||
if recipe.result == itemId then | if recipe.result == itemId then | ||
foundAny = true | |||
out = out .. '|-\n' | |||
out = out .. '| ' .. lathe.id .. '\n' | |||
out = out .. '| ' .. formatRecipe(recipe, timeMultiplier, materialUseMultiplier) .. '\n' | |||
out = out .. formatRecipe(recipe, timeMultiplier, materialUseMultiplier) | |||
end | end | ||
end | end | ||
| Строка 321: | Строка 315: | ||
if not foundAny then | if not foundAny then | ||
return '<div style="color:red;">Рецепт для предмета с ID "' .. itemId .. '" не найден во всех станках.</div>' | |||
end | end | ||
out = out .. '|}' | |||
return mw.getCurrentFrame():preprocess(out) | return mw.getCurrentFrame():preprocess(out) | ||
end | end | ||
return p | return p | ||