Модуль:Prototypes/Механика/Растение: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| (не показано 11 промежуточных версий этого же участника) | |||
| Строка 20: | Строка 20: | ||
local function formatCharacteristics(seed) | local function formatCharacteristics(seed) | ||
local parts = { | local parts = { | ||
("[[Гидропоника#Потенция|Потенция]]: %s"):format(seed.potency or | ("[[Гидропоника#Потенция|Потенция]]: %s"):format(seed.potency or 1), | ||
("[[Гидропоника#Урожайность|Урожайность]]: %s"):format(seed.yield | ("[[Гидропоника#Урожайность|Урожайность]]: %s"):format(seed.yield), | ||
("[[Гидропоника# | ("[[Гидропоника#Срок жизни|Срок жизни]]: %s"):format(seed.lifespan), | ||
("[[Гидропоника# | ("[[Гидропоника#Созревание|Созревание]]: %s"):format(seed.maturation), | ||
("[[Гидропоника# | ("[[Гидропоника#Производство|Производство]]: %s"):format(seed.production), | ||
("[[Гидропоника#Стадии роста|Стадии роста]]: %s"):format(seed.growthStages or | ("[[Гидропоника#Стадии роста|Стадии роста]]: %s"):format(seed.growthStages or 6), | ||
} | } | ||
return table.concat(parts, '<br>') | return table.concat(parts, '<br>') | ||
| Строка 31: | Строка 31: | ||
local function formatConditions(seed) | local function formatConditions(seed) | ||
local parts = { | local parts = { | ||
("[[Гидропоника#|Вода]]: %s"):format(seed.waterConsumption or | ("[[Гидропоника#Потребление воды|Вода]]: %s"):format(seed.waterConsumption or 0.5), | ||
("[[Гидропоника#| | ("[[Гидропоника#Потребление нутриентов|Удобрение]]: %s"):format(seed.nutrientConsumption or 0.75), | ||
("[[Гидропоника#| | ("[[Гидропоника#Оптимальная температура|Темп.]]: %.2f°C"):format(kelvinToCelsius(seed.idealHeat or 293)), | ||
} | } | ||
return table.concat(parts, '<br>') | return table.concat(parts, '<br>') | ||
| Строка 42: | Строка 40: | ||
local function formatHarvestType(seed) | local function formatHarvestType(seed) | ||
return seed.harvestRepeat and "[[Гидропоника# | return seed.harvestRepeat and "[[Гидропоника#Тип урожая|" .. tostring(seed.harvestRepeat) .. "]]" or "-" | ||
end | end | ||
local function formatHarvestType(seed) | local function formatHarvestType(seed) | ||
local harvestRepeat = seed.harvestRepeat | local harvestRepeat = seed.harvestRepeat | ||
if harvestRepeat == "Repeat" then | if harvestRepeat == "Repeat" then | ||
return "[[Гидропоника# | return "[[Гидропоника#Тип урожая|Многолетнее]]" | ||
elseif harvestRepeat == "SelfHarvest" then | elseif harvestRepeat == "SelfHarvest" then | ||
return "[[Гидропоника# | return "[[Гидропоника#Тип урожая|Самосбор]]" | ||
else | else | ||
return "[[Гидропоника# | return "[[Гидропоника#Тип урожая|Однолетнее]]" | ||
end | end | ||
end | end | ||
| Строка 62: | Строка 60: | ||
local chemName = entry and entry.name or chemId | local chemName = entry and entry.name or chemId | ||
table.insert(list, string.format( | table.insert(list, string.format( | ||
"<li>[[Химия#chem_%s|%s]] (мин: %s, макс: %s, | "<li>[[Химия#chem_%s|%s]] (мин: %s, макс: %s, дел: %s)</li>", | ||
chemId, chemName, vals.Min or 0, vals.Max or 0, vals.PotencyDivisor or 1 | chemId, chemName, vals.Min or 0, vals.Max or 0, vals.PotencyDivisor or 1 | ||
)) | )) | ||
end | end | ||
return table.concat(list) | return "<ul>" .. table.concat(list) .. "</ul>" | ||
end | end | ||
| Строка 80: | Строка 78: | ||
end | end | ||
end | end | ||
return table.concat(list) | return "<ul>" .. table.concat(list) .. "</ul>" | ||
end | end | ||
local function generateHeader() | local function generateHeader() | ||
return [[ | return [[ | ||
{| id="" class="wikitable sortable mw-collapsible" style="width:100% | {| id="BOTANY" class="wikitable sortable mw-collapsible" style="width:100%;" | ||
! rowspan="2" style="width:10%;" | Плод | ! rowspan="2" style="width:10%;" | Плод | ||
! rowspan="2" class="unsortable" style="width:5%;" | Семена | ! rowspan="2" class="unsortable" style="width:5%;" | Семена | ||
! rowspan="2" class="unsortable" style="width:5%;" | Растение | ! rowspan="2" class="unsortable" style="width:5%;" | Растение | ||
! colspan="3" class="unsortable" style="width: | ! colspan="3" class="unsortable" style="width:30%;" id="no-highlight" | Характеристики | ||
! rowspan="2" class="unsortable" style="width: | ! rowspan="2" class="unsortable" style="width:30%;" | Содержит вещества | ||
! rowspan="2" style="width:20%;" | Мутации | ! rowspan="2" style="width:20%;" | Мутации | ||
|- | |- | ||
! style="width:10%;" class="unsortable" | Рост | ! style="width:10%;" class="unsortable" | Рост | ||
! style="width:10%;" class="unsortable" | Условия | ! style="width:10%;" class="unsortable" | Условия | ||
! style="width: | ! style="width:5%;" class="unsortable" | Тип сбора | ||
]] | ]] | ||
end | end | ||
| Строка 109: | Строка 107: | ||
for _, seed in ipairs(data) do | for _, seed in ipairs(data) do | ||
local prodId = seed.productPrototypes[1] | local prodId = seed.productPrototypes[1] | ||
local | local seedId = seed.packetPrototype | ||
local seedName = string.format('{{#invoke:Entity Lookup|getname|%s}}', seedId) | |||
local anchor = string.format('{{anchor|%s}}', | local anchor = string.format('{{anchor|%s}}', seedName) | ||
local fruitImg = string.format( | local fruitImg = string.format( | ||
'{{Предмет|%s|size=64px|vertical=1|imageTooltip=1|link=%s}}', | '{{Предмет|%s|size=64px|vertical=1|imageTooltip=1|link=%s}}', | ||
prodId, | prodId, seedName | ||
) | ) | ||
local seedImg = string.format( | local seedImg = string.format( | ||
'{{Предмет|%s|size=64px|vertical=1|imageTooltip=1|l=|link=%s}}', | '{{Предмет|%s|size=64px|vertical=1|imageTooltip=1|l=|link=%s}}', | ||
seedName | seedId, seedName | ||
) | ) | ||
local plantImg = string.format( | local plantImg = string.format( | ||
'{{Предмет|%s-harvest|size=64px|l=|link=%s}}', | '{{Предмет|%s-harvest|size=64px|l=|link=%s}}', | ||
seedName | seedId, seedName | ||
) | ) | ||