Модуль:Prototypes/Механика/Растение: различия между версиями

мНет описания правки
Нет описания правки
 
(не показано 8 промежуточных версий этого же участника)
Строка 22: Строка 22:
         ("[[Гидропоника#Потенция|Потенция]]: %s"):format(seed.potency or 1),
         ("[[Гидропоника#Потенция|Потенция]]: %s"):format(seed.potency or 1),
         ("[[Гидропоника#Урожайность|Урожайность]]: %s"):format(seed.yield),
         ("[[Гидропоника#Урожайность|Урожайность]]: %s"):format(seed.yield),
         ("[[Гидропоника#Продолжительность жизни|Время жизни]]: %s"):format(seed.lifespan),
         ("[[Гидропоника#Срок жизни|Срок жизни]]: %s"):format(seed.lifespan),
         ("[[Гидропоника#Скорость созревани|Созревания]]: %s"):format(seed.maturation),
         ("[[Гидропоника#Созревание|Созревание]]: %s"):format(seed.maturation),
         ("[[Гидропоника#Продуктивность|Продуктивность]]: %s"):format(seed.production),
         ("[[Гидропоника#Производство|Производство]]: %s"):format(seed.production),
         ("[[Гидропоника#Стадии роста|Стадии роста]]: %s"):format(seed.growthStages or 6),
         ("[[Гидропоника#Стадии роста|Стадии роста]]: %s"):format(seed.growthStages or 6),
     }
     }
Строка 33: Строка 33:
     local parts = {
     local parts = {
         ("[[Гидропоника#Потребление воды|Вода]]: %s"):format(seed.waterConsumption or 0.5),
         ("[[Гидропоника#Потребление воды|Вода]]: %s"):format(seed.waterConsumption or 0.5),
         ("[[Гидропоника#Потребление питательных веществ|Удобрения]]: %s"):format(seed.nutrientConsumption or 0.75),
         ("[[Гидропоника#Потребление нутриентов|Удобрение]]: %s"):format(seed.nutrientConsumption or 0.75),
         ("[[Гидропоника#Идеальная тепература|Темп.]]: %.2f°C"):format(kelvinToCelsius(seed.idealHeat or 293)),
         ("[[Гидропоника#Оптимальная температура|Темп.]]: %.2f°C"):format(kelvinToCelsius(seed.idealHeat or 293)),
        ("[[Гидропоника#Легкая терпимость|Терп.]]: %s"):format(seed.lightTolerance or 10),
        ("[[Гидропоника#Идеальное освещение|Освещения]]: %s"):format(seed.idealLight or 7),
     }
     }
     return table.concat(parts, '<br>')
     return table.concat(parts, '<br>')
Строка 42: Строка 40:


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
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
Строка 66: Строка 64:
         ))
         ))
     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


Строка 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 prodName = string.format('{{#invoke:Entity Lookup|getname|%s}}', prodId)
         local seedId = seed.packetPrototype
        local seedName = seed.packetPrototype
        local seedName = string.format('{{#invoke:Entity Lookup|getname|%s}}', seedId)


         local anchor  = string.format('{{anchor|%s}}', prodName)
         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, prodName
             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, prodName
             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, prodName
             seedId, seedName
         )
         )