Модуль:ArmorStats: различия между версиями

Материал из Space Station 14 Вики
(Откат)
Метка: ручная отмена
Нет описания правки
Строка 2: Строка 2:


function p.templateCells(frame)
function p.templateCells(frame)
     local color = frame.args.color or ""  -- Цвет фона
     local color = frame:preprocess(frame.args.color or "") -- Цвет фона
     local anchorName = frame.args.anchorName or ""  -- Название якоря
     local anchorName = frame:preprocess(frame.args.anchorName or "") -- Название якоря
     local image = frame.args.image or ""  -- Путь к изображению предмета
     local image = frame:preprocess(frame.args.image or "") -- Путь к изображению предмета
     local itemId = frame.args.itemId or ""  -- ID предмета
     local itemId = frame:preprocess(frame.args.itemId or "") -- ID предмета
      
      
     local protection1 = frame.args.protection1 or "-" -- Ударный
     local protection1 = frame:preprocess(frame.args.protection1 or "-") -- Ударный
     local protection2 = frame.args.protection2 or "-" -- Режущий
     local protection2 = frame:preprocess(frame.args.protection2 or "-") -- Режущий
     local protection3 = frame.args.protection3 or "-" -- Колющий
     local protection3 = frame:preprocess(frame.args.protection3 or "-") -- Колющий
     local protection4 = frame.args.protection4 or "-" -- Высокотемпературный
     local protection4 = frame:preprocess(frame.args.protection4 or "-") -- Высокотемпературный
     local protection5 = frame.args.protection5 or "-" -- Кислотный
     local protection5 = frame:preprocess(frame.args.protection5 or "-") -- Кислотный
     local protection6 = frame.args.protection6 or "-" -- Радиационный
     local protection6 = frame:preprocess(frame.args.protection6 or "-") -- Радиационный
     local protection7 = frame.args.protection7 or "-" -- Взрывной
     local protection7 = frame:preprocess(frame.args.protection7 or "-") -- Взрывной
      
      
     local description = frame.args.description or "" -- Описание
     local description = frame:preprocess(frame.args.description or "") -- Описание
     local location = frame.args.location or "" -- Местонахождения  
     local location = frame:preprocess(frame.args.location or "") -- Местонахождения  


     local out = ""
     local out = ""

Версия от 12:27, 6 июля 2024

Для документации этого модуля может быть создана страница Модуль:ArmorStats/doc

local p = {}

function p.templateCells(frame)
    local color = frame:preprocess(frame.args.color or "")  -- Цвет фона
    local anchorName = frame:preprocess(frame.args.anchorName or "")  -- Название якоря
    local image = frame:preprocess(frame.args.image or "")  -- Путь к изображению предмета
    local itemId = frame:preprocess(frame.args.itemId or "")  -- ID предмета
    
    local protection1 = frame:preprocess(frame.args.protection1 or "-") -- Ударный
    local protection2 = frame:preprocess(frame.args.protection2 or "-") -- Режущий
    local protection3 = frame:preprocess(frame.args.protection3 or "-") -- Колющий
    local protection4 = frame:preprocess(frame.args.protection4 or "-") -- Высокотемпературный
    local protection5 = frame:preprocess(frame.args.protection5 or "-") -- Кислотный
    local protection6 = frame:preprocess(frame.args.protection6 or "-") -- Радиационный
    local protection7 = frame:preprocess(frame.args.protection7 or "-") -- Взрывной
    
    local description = frame:preprocess(frame.args.description or "") -- Описание
    local location = frame:preprocess(frame.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