Модуль:tableofchemicals

Вернуться

Строка 52: Строка 52:
local substanceName = ""
local substanceName = ""
local color = ""
local textColor = ""
if firstProductId and p.chem[firstProductId] then
if firstProductId and p.chem[firstProductId] then
substanceName = p.chem[firstProductId].name or firstProductId
substanceName = p.chem[firstProductId].name or firstProductId
color = p.chem[firstProductId].color or ""
textColor = p.chem[firstProductId].textColor or ""
end
end
templateArgs.substance = substanceName
templateArgs.substance = substanceName
templateArgs.color = color
templateArgs.textColor = textColor
local template = "Строка_реакции"
local template = "Строка_реакции"
Строка 211: Строка 217:
local actions = {}
local actions = {}
for _, mixingCategory in pairs(reactPrototype.mixingCategories) do
if reactPrototype.mixingCategories and type(reactPrototype.mixingCategories) == "table" then
local image = getMixingImage(mixingCategory.id)
for _, mixingCategory in pairs(reactPrototype.mixingCategories) do
if image ~= nil then
local image = getMixingImage(mixingCategory.id)
table.insert(actions, string.format("[[File:%s|32px|link=]]", image)) -- Картинка
if image ~= nil then
table.insert(actions, string.format("[[File:%s|32px|link=]]", image)) -- Картинка
end
table.insert(actions, mixingCategory.name or mixingCategory.id) -- Название
end
end
table.insert(actions, mixingCategory.name or mixingCategory.id) -- Название
end
end