Модуль:TableOfChemicals: различия между версиями
мНет описания правки |
Нет описания правки |
||
| Строка 54: | Строка 54: | ||
templateArgs.name = chemPrototype.name | templateArgs.name = chemPrototype.name | ||
templateArgs.description = chemPrototype.desc .. " На вид " .. chemPrototype.physicalDesc .. "." | templateArgs.description = chemPrototype.desc .. " На вид " .. chemPrototype.physicalDesc .. "." | ||
templateArgs.color = | templateArgs.color = chemPrototype.color | ||
templateArgs.textColor = | templateArgs.textColor = chemPrototype.textColor | ||
templateArgs.effects = getEffects(chemPrototype.id) | |||
templateArgs.recipes_count = tablelength(chemPrototype.recipes) | templateArgs.recipes_count = tablelength(chemPrototype.recipes) | ||
| Строка 93: | Строка 93: | ||
templateArgs.products = table.concat(products, "<br>") | templateArgs.products = table.concat(products, "<br>") | ||
templateArgs. | templateArgs.actions = p.getActions(reactPrototype) | ||
local template = "Строка_химического_вещества" | local template = "Строка_химического_вещества" | ||
| Строка 107: | Строка 107: | ||
end | end | ||
getActions = function(reactPrototype) | |||
local actions = {} | |||
-- Температура | |||
local minMaxTemplate = "выше %s и ниже %s" | |||
local minTemplate = "выше %s" | |||
local maxTemplate = "ниже %s" | |||
local hasMin = reactPrototype.minTemp ~= 0 | |||
local hasMax = reactPrototype.hasMax | |||
local tempString = "" | |||
if hasMax and hasMin then | |||
tempString = string.format(minMaxTemplate, reactPrototype.minTemp, reactPrototype.maxTemp) | |||
elseif hasMin then | |||
tempString = string.format(minTemplate, reactPrototype.minTemp) | |||
elseif hasMax then | |||
tempString = string.format(maxTemplate, reactPrototype.maxTemp) | |||
end | |||
for _, mixingCategory in pairs(reactPrototype.mixingCategories) do | |||
local image = getMixingImage(mixingCategory.id) | |||
if image ~= nil then | |||
table.insert(actions, string.format("[[File:%s|32px]]", image)) -- Картинка | |||
end | |||
table.insert(actions, mixingCategory.name .. " " .. tempString) -- Название | |||
end | |||
return table.concat(actions, "<br>") | |||
end | |||
getMixingImage = function(mixingId) | |||
local images = { | |||
["DummyMix"] = "Beaker" | |||
} | |||
return images[mixingId] | |||
end | end | ||
function getEffects(chemPrototypeId) | function getEffects(chemPrototypeId) | ||
local descriptions = {} | |||
local chemPrototype = p.chem[chemPrototypeId] | local chemPrototype = p.chem[chemPrototypeId] | ||
for _, metabolismGroup in pairs(chemPrototype.metabolisms) do | |||
for _, effect in pairs(metabolismGroup) do | |||
if effect.description ~= "" then | |||
table.insert(descriptions, effect.description) | |||
end | |||
end | |||
end | |||
return | return table.concat(descriptions, "<br>") | ||
end | end | ||
| Строка 149: | Строка 187: | ||
local out = "" | local out = "" | ||
for k, v in pairs(met) do | for k, v in pairs(met) do | ||
out = out .. "<b>" .. k .. "</b> (" .. v.rate .. " единиц в секунду)\n" .. p.geneffectlist(v.effects, frame, v.rate) | out = out .. ";<b>" .. k .. "</b> (" .. v.rate .. " единиц в секунду)\n" .. p.geneffectlist(v.effects, frame, v.rate) | ||
end | end | ||
return out | return out | ||
| Строка 159: | Строка 197: | ||
-- Popup Message is ignored on purpose | -- Popup Message is ignored on purpose | ||
if w.id == "HealthChange" then | if w.id == "HealthChange" then | ||
out = out .. ":" .. p.genhealthchange(w, rate, frame) .. "\n" | out = out .. ":1" .. p.genhealthchange(w, rate, frame) .. "\n" | ||
elseif w.id == "AdjustReagent" then | elseif w.id == "AdjustReagent" then | ||
out = out .. ":" .. p.genadjustreagent(w, rate, frame) .. "\n" | out = out .. ":2" .. p.genadjustreagent(w, rate, frame) .. "\n" | ||
elseif w.id == "FlammableReaction" then | elseif w.id == "FlammableReaction" then | ||
out = out .. ":" .. p.genflammablereaction(w, frame) .. "\n" | out = out .. ":3" .. p.genflammablereaction(w, frame) .. "\n" | ||
elseif w.id == "AdjustTemperature" then | elseif w.id == "AdjustTemperature" then | ||
out = out .. ":" .. p.genadjusttemperature(w, frame) .. "\n" | out = out .. ":4" .. p.genadjusttemperature(w, frame) .. "\n" | ||
elseif w.id == "GenericStatusEffect" then | elseif w.id == "GenericStatusEffect" then | ||
out = out .. ":" .. p.gengenericstatuseffect(w, frame) .. "\n" | out = out .. ":5" .. p.gengenericstatuseffect(w, frame) .. "\n" | ||
elseif w.id == "ExplosionReactionEffect" then | elseif w.id == "ExplosionReactionEffect" then | ||
out = out .. ":" .. p.genexplosionreactioneffect(w, frame) .. "\n" | out = out .. ":6" .. p.genexplosionreactioneffect(w, frame) .. "\n" | ||
elseif w.id == "FoamAreaReactionEffect" then | elseif w.id == "FoamAreaReactionEffect" then | ||
out = out .. ":" .. p.genfoamareareactioneffect(w, frame) .. "\n" | out = out .. ":7" .. p.genfoamareareactioneffect(w, frame) .. "\n" | ||
elseif w.id == "SmokeAreaReactionEffect" then | elseif w.id == "SmokeAreaReactionEffect" then | ||
out = out .. ":" .. p.gensmokeareareactioneffect(w, frame) .. "\n" | out = out .. ":8" .. p.gensmokeareareactioneffect(w, frame) .. "\n" | ||
elseif w.id == "ModifyBleedAmount" then | elseif w.id == "ModifyBleedAmount" then | ||
out = out .. ":" .. p.genmodifybleedamount(w, frame) .. "\n" | out = out .. ":9" .. p.genmodifybleedamount(w, frame) .. "\n" | ||
end | end | ||
end | end | ||