Модуль:tableofchemicals
| Строка 9: | Строка 9: | ||
for _, reactPrototype in pairs(p.react) do | for _, reactPrototype in pairs(p.react) do | ||
local reactants = {} | local reactants = {} | ||
local reactantTemplate = "%s [[#chem_%s|%s]]" | local reactantTemplate = "<span style='background-color:%s; color:%s; padding:2px 6px; border-radius:3px; display:inline-block;'>%s [[#chem_%s|%s]]</span>" | ||
for reactantId, reactantValue in pairs(reactPrototype.reactants) do | for reactantId, reactantValue in pairs(reactPrototype.reactants) do | ||
local reactantChemData = p.chem[reactantId] | local reactantChemData = p.chem[reactantId] | ||
local reactantText = string.format(reactantTemplate, reactantValue.amount, reactantChemData.id, | local reactantText = string.format( | ||
reactantTemplate, | |||
reactantChemData.color, | |||
reactantChemData.textColor, | |||
reactantValue.amount, | |||
reactantChemData.id, | |||
reactantChemData.name | |||
) | |||
if reactantValue.catalyst then | if reactantValue.catalyst then | ||
reactantText = reactantText .. " (катализатор)" | reactantText = reactantText .. " (катализатор)" | ||
| Строка 43: | Строка 50: | ||
templateArgs.actions = getActions(reactPrototype) | templateArgs.actions = getActions(reactPrototype) | ||
local template = "Строка_реакции" | local template = "Строка_реакции" | ||
| Строка 165: | Строка 155: | ||
local reactPrototype = p.react[reactId] | local reactPrototype = p.react[reactId] | ||
local reactants = {} | local reactants = {} | ||
local reactantTemplate = "%s [[#chem_%s|%s]]" | local reactantTemplate = "<span style='background-color:%s; color:%s; padding:2px 6px; border-radius:3px; display:inline-block;'>%s [[#chem_%s|%s]]</span>" | ||
for reactantId, reactantValue in pairs(reactPrototype.reactants) do | for reactantId, reactantValue in pairs(reactPrototype.reactants) do | ||
local reactantChemData = p.chem[reactantId] | local reactantChemData = p.chem[reactantId] | ||
local reactantText = string.format(reactantTemplate, reactantValue.amount, reactantChemData.id, | local reactantText = string.format( | ||
reactantTemplate, | |||
reactantChemData.color, | |||
reactantChemData.textColor, | |||
reactantValue.amount, | |||
reactantChemData.id, | |||
reactantChemData.name | |||
) | |||
if reactantValue.catalyst then | if reactantValue.catalyst then | ||
reactantText = reactantText .. " (катализатор)" | reactantText = reactantText .. " (катализатор)" | ||
| Строка 215: | Строка 212: | ||
local actions = {} | local actions = {} | ||
for _, mixingCategory in pairs(reactPrototype.mixingCategories) do | |||
local image = getMixingImage(mixingCategory.id) | |||
if image ~= nil then | |||
table.insert(actions, string.format("[[File:%s|32px|link=]]", image)) -- Картинка | |||
end | end | ||
table.insert(actions, mixingCategory.name or mixingCategory.id) -- Название | |||
end | end | ||