Модуль:Prototypes/Механика/Награда доставки: различия между версиями
Материал из Space Station 14 Вики
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 23: | Строка 23: | ||
if entry.whitelist and entry.whitelist.tags then | if entry.whitelist and entry.whitelist.tags then | ||
for _, tag in ipairs(entry.whitelist.tags) do | for _, tag in ipairs(entry.whitelist.tags) do | ||
tagItem = tagItem .. " | tagItem = tagItem .. "{{#invoke:Entity Tags|main|tag|" .. tag .. "}}" | ||
end | end | ||
else | else | ||
Версия от 18:16, 22 марта 2025
Для документации этого модуля может быть создана страница Модуль:Prototypes/Механика/Награда доставки/doc
local p = {}
-- Загрузка данных
local cargoData = mw.loadData("Модуль:IanComradeBot/prototypes/cargo/bounty.json/base")
function p.main(frame)
local output = {}
table.insert(output, '{| class="wikitable"')
table.insert(output, '|-')
table.insert(output, '! Название (количество)')
table.insert(output, '! Предмет(-ы)')
table.insert(output, '! Вознаграждение')
table.insert(output, '! Описание')
for _, item in pairs(cargoData) do
local reward = item.reward or ""
local description = item.description or ""
if item.entries then
for _, entry in ipairs(item.entries) do
local product = entry.name or ""
local amount = entry.amount or ""
local tagItem = ""
if entry.whitelist and entry.whitelist.tags then
for _, tag in ipairs(entry.whitelist.tags) do
tagItem = tagItem .. "{{#invoke:Entity Tags|main|tag|" .. tag .. "}}"
end
else
tagItem = string.format("[[{{#invoke:Ftl|main|translation|%s}}|{{#invoke:Ftl|main|translation|%s}}]]", product, product)
end
table.insert(output, '|-')
table.insert(output, string.format("| {{#invoke:Ftl|main|translation|%s}} x%s || %s || {{ColorPalette|Other|price|%s}}$ || {{#invoke:Ftl|main|translation|%s}}", product, amount, tagItem, reward, description))
end
end
end
table.insert(output, "|}")
return frame:preprocess(table.concat(output, "\n"))
end
return p