Модуль:ArmorStats: различия между версиями
Материал из Space Station 14 Вики
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
Строка 2: | Строка 2: | ||
function p.templateCells(frame) | function p.templateCells(frame) | ||
local | -- Получаем аргументы шаблона с использованием frame:preprocess | ||
local anchorName = | local args = frame:preprocess(frame.args) | ||
local image = | |||
local itemId = | local color = args.color or "" -- Цвет фона | ||
local anchorName = args.anchorName or "" -- Название якоря | |||
local image = args.image or "" -- Путь к изображению предмета | |||
local itemId = args.itemId or "" -- ID предмета | |||
local protection1 = | local protection1 = args.protection1 or "-" -- Ударный | ||
local protection2 = | local protection2 = args.protection2 or "-" -- Режущий | ||
local protection3 = | local protection3 = args.protection3 or "-" -- Колющий | ||
local protection4 = | local protection4 = args.protection4 or "-" -- Высокотемпературный | ||
local protection5 = | local protection5 = args.protection5 or "-" -- Кислотный | ||
local protection6 = | local protection6 = args.protection6 or "-" -- Радиационный | ||
local protection7 = | local protection7 = args.protection7 or "-" -- Взрывной | ||
local description = | local description = args.description or "" -- Описание | ||
local location = | local location = args.location or "" -- Местонахождения | ||
local out = "" | local out = "" |
Версия от 12:31, 6 июля 2024
Для документации этого модуля может быть создана страница Модуль:ArmorStats/doc
local p = {}
function p.templateCells(frame)
-- Получаем аргументы шаблона с использованием frame:preprocess
local args = frame:preprocess(frame.args)
local color = args.color or "" -- Цвет фона
local anchorName = args.anchorName or "" -- Название якоря
local image = args.image or "" -- Путь к изображению предмета
local itemId = args.itemId or "" -- ID предмета
local protection1 = args.protection1 or "-" -- Ударный
local protection2 = args.protection2 or "-" -- Режущий
local protection3 = args.protection3 or "-" -- Колющий
local protection4 = args.protection4 or "-" -- Высокотемпературный
local protection5 = args.protection5 or "-" -- Кислотный
local protection6 = args.protection6 or "-" -- Радиационный
local protection7 = args.protection7 or "-" -- Взрывной
local description = args.description or "" -- Описание
local location = args.location or "" -- Местонахождения
local out = ""
-- Формирование строк для ячеек таблицы
out = out .. '!style="background-color: ' .. color .. ';"|{{Anchor|' .. anchorName .. '}}{{#invoke:Entity Lookup|createimagetooltip|File:' .. image .. '|' .. itemId .. '|Мета=64x64px}}<br>{{#invoke:Entity Lookup|getname|' .. itemId .. '}} \n'
out = out .. '|style="font-weight:500;color: crimson"|' .. protection1 .. ' \n'
out = out .. '|style="font-weight:500;color: indianred"|' .. protection2 .. ' \n'
out = out .. '|style="font-weight:500;color: darksalmon"|' .. protection3 .. ' \n'
out = out .. '|style="font-weight:500;color: orange"|' .. protection4 .. ' \n'
out = out .. '|style="font-weight:500;color: plum"|' .. protection5 .. ' \n'
out = out .. '|style="font-weight:500;color: limegreen"|' .. protection6 .. ' \n'
out = out .. '|style="font-weight:500;color: tan"|' .. protection7 .. ' \n'
out = out .. '|\n' .. description .. '\n\n|\n' .. location .. '\n|-\n'
return out
end
return p