Модуль:tableofchemicals
| Строка 14: | Строка 14: | ||
local reactantChemData = p.chem[reactantId] | local reactantChemData = p.chem[reactantId] | ||
local reactantText = string.format( | -- Создаем ссылку с цветным фоном для количества | ||
local reactantText = string.format( | |||
'<span style="background-color:%s; color:%s; padding:2px 5px; border-radius:3px; display:inline-block; margin:1px;">%s</span> [[#chem_%s|%s]]', | |||
reactantChemData.color or "#808080", | |||
reactantChemData.textColor or "#FFFFFF", | |||
reactantValue.amount, | |||
reactantChemData.id, | |||
reactantChemData.name | |||
) | |||
if reactantValue.catalyst then | if reactantValue.catalyst then | ||
reactantText = reactantText .. " (катализатор)" | reactantText = reactantText .. " (катализатор)" | ||
| Строка 29: | Строка 37: | ||
local productChemData = p.chem[productId] | local productChemData = p.chem[productId] | ||
local productText = string.format( | -- Создаем ссылку с цветным фоном для количества | ||
local productText = string.format( | |||
'<span style="background-color:%s; color:%s; padding:2px 5px; border-radius:3px; display:inline-block; margin:1px;">%s</span> [[#chem_%s|%s]]', | |||
productChemData.color or "#808080", | |||
productChemData.textColor or "#FFFFFF", | |||
productAmount, | |||
productChemData.id, | |||
productChemData.name | |||
) | |||
table.insert(products, productText) | table.insert(products, productText) | ||
end | end | ||
| Строка 134: | Строка 150: | ||
templateArgs.effects = getEffects(chemPrototype.id) | templateArgs.effects = getEffects(chemPrototype.id) | ||
templateArgs.recipes_count = tablelength(chemPrototype.recipes) | templateArgs.recipes_count = tablelength(chemPrototype.recipes) | ||
templateArgs.reactants = "" | templateArgs.reactants = "" | ||