Модуль:Prototypes/Машина/Станок: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 63: | Строка 63: | ||
function p.main(frame) | function p.main(frame) | ||
-- Подключение CSS | |||
local cssLink = frame:extensionTag('templatestyles', '', { | |||
src = 'Шаблон:Research/styles.css' | |||
}) | |||
local latheId = frame.args[1] or "" | local latheId = frame.args[1] or "" | ||
if latheId == "" then | if latheId == "" then | ||
| Строка 90: | Строка 95: | ||
end | end | ||
local | local out = cssLink | ||
local recipes = {} | local recipes = {} | ||
| Строка 132: | Строка 137: | ||
}) | }) | ||
else | else | ||
out = out .. '<div style="color:red;">Ошибка: Рецепт с ID "' .. recipeId .. '" не найден или поле result отсутствует.</div>' | |||
end | end | ||
end | end | ||
| Строка 222: | Строка 227: | ||
for _, recipe in ipairs(recipes) do | for _, recipe in ipairs(recipes) do | ||
out = out .. '{{Шаблон:Prototypes/Машина/Станок|product=' .. recipe.result | |||
out = out .. '|complete-time=' .. format_seconds_to_short_string(recipe.completetime) | |||
out = out .. '|materials=' | |||
if next(recipe.materials) then | if next(recipe.materials) then | ||
| Строка 230: | Строка 235: | ||
local stackEntity = materialMapping[material] or material | local stackEntity = materialMapping[material] or material | ||
local scaledAmount = amount / 100 | local scaledAmount = amount / 100 | ||
out = out .. '<b>[[File:' .. stackEntity .. '.png|32x32px|link=]] ' .. scaledAmount .. ' {{#invoke:Entity Lookup|getname|' .. stackEntity .. '}}</b>' | |||
end | end | ||
else | else | ||
out = out .. 'Нет данных о материалах' | |||
end | end | ||
| Строка 240: | Строка 245: | ||
local tierColor = tierColors[recipe.tier] or "#FFFFFF" | local tierColor = tierColors[recipe.tier] or "#FFFFFF" | ||
out = out .. '|info=<div>[[File:' .. recipe.discipline .. '.png|16x16px|link=]] [[Руководство по исследованию и разработке|{{#invoke:Ftl|main|translation|' .. recipe.researchName | |||
out = out .. '}}]], уровень: <span style="color: ' .. tierColor .. '">' .. recipe.tier .. '</span> </div>' | |||
end | end | ||
-- При взломе EMAG | -- При взломе EMAG | ||
if recipe.isEmag then | if recipe.isEmag then | ||
out = out .. '|mode-emag=1' | |||
end | end | ||
| Строка 259: | Строка 264: | ||
end | end | ||
out = out .. '|icons=' .. icon | |||
out = out .. '}}' | |||
end | end | ||
return mw.getCurrentFrame():preprocess( | return mw.getCurrentFrame():preprocess(out) | ||
end | end | ||
return p | return p | ||