Модуль:Prototypes/Механика/Растение: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 16: | Строка 16: | ||
local function formatCharacteristics(seed) | local function formatCharacteristics(seed) | ||
local parts = { | local parts = { | ||
("Потенция: %s"):format(seed.potency or 0), | ("[[Гидропоника#Потенция|Потенция]]: %s"):format(seed.potency or 0), | ||
("Урожайность: %s"):format(seed.yield or 0), | ("[[Гидропоника#Урожайность|Урожайность]]: %s"):format(seed.yield or 0), | ||
("Время жизни: %s"):format(seed.lifespan or 0), | ("[[Гидропоника#Продолжительность жизни|Время жизни]]: %s"):format(seed.lifespan or 0), | ||
("Созревания: %s"):format(seed.maturation or 0), | ("[[Гидропоника#Скорость созревани|Созревания]]: %s"):format(seed.maturation or 0), | ||
("Продуктивность: %s"):format(seed.production or 0), | ("[[Гидропоника#Продуктивность|Продуктивность]]: %s"):format(seed.production or 0), | ||
("Стадии роста: %s"):format(seed.growthStages or 0), | ("[[Гидропоника#Стадии роста|Стадии роста]]: %s"):format(seed.growthStages or 0), | ||
} | } | ||
return table.concat(parts, " <br> ") | return table.concat(parts, " <br> ") | ||
| Строка 27: | Строка 27: | ||
local function formatConditions(seed) | local function formatConditions(seed) | ||
local tempC = kelvinToCelsius(seed. | local tempC = kelvinToCelsius(seed.idealHeat or 273.15) | ||
local parts = { | local parts = { | ||
("Вода: %s"):format(seed.waterConsumption or "-"), | ("[[Гидропоника#|Вода]]: %s"):format(seed.waterConsumption or "-"), | ||
("Удобрения: %s"):format(seed.nutrientConsumption or "-"), | ("[[Гидропоника#|Удобрения]]: %s"):format(seed.nutrientConsumption or "-"), | ||
("Температура: %.2f°C"):format(tempC), | ("[[Гидропоника#|Температура]]: %.2f°C"):format(tempC), | ||
("Освещения: %s"):format(seed.idealLight or "-"), | ("[[Гидропоника#|Освещения]]: %s"):format(seed.idealLight or "-"), | ||
} | } | ||
return table.concat(parts, " <br> ") | return table.concat(parts, " <br> ") | ||
| Строка 38: | Строка 38: | ||
local function formatHarvestType(seed) | local function formatHarvestType(seed) | ||
return seed.harvestRepeat and tostring(seed.harvestRepeat) or "-" | return seed.harvestRepeat and "[[Гидропоника#Сбор урожая|" .. tostring(seed.harvestRepeat) .. "]]" or "-" | ||
end | end | ||
| Строка 86: | Строка 86: | ||
end | end | ||
function p.table(frame) | |||
local data = mw.loadData("Модуль:IanComradeBot/prototypes/seeds.json/data") | local data = mw.loadData("Модуль:IanComradeBot/prototypes/seeds.json/data") | ||
local rows = {} | local rows = {} | ||
| Строка 132: | Строка 132: | ||
if not seed then return "" end | if not seed then return "" end | ||
if | if mode == "growth" then | ||
return formatCharacteristics(seed) | return formatCharacteristics(seed) | ||
elseif mode == "conditions" then | elseif mode == "conditions" then | ||