Модуль:tableofchemicals

Вернуться

Строка 14: Строка 14:
local reactantChemData = p.chem[reactantId]
local reactantChemData = p.chem[reactantId]
local reactantText = string.format(reactantTemplate, reactantValue.amount, reactantChemData.id, reactantChemData.name)
-- Создаем ссылку с цветным фоном для количества
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(productTemplate, productAmount, productChemData.id, productChemData.name)
-- Создаем ссылку с цветным фоном для количества
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.displayColor = chemPrototype.color or "#808080"
templateArgs.displayTextColor = chemPrototype.textColor or "#FFFFFF"
templateArgs.displayHex = chemPrototype.color or "прозрачный"
templateArgs.reactants = ""
templateArgs.reactants = ""