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

Нет описания правки
createtooltip => createtexttooltip, createimagetooltip => createimagetooltip
Строка 4: Строка 4:
p.entities = prototypes.entities
p.entities = prototypes.entities


-- p.createtooltip{args={"Верхний текст", "FreedomImplant", "Файл:Honks.gif"}}
 
function p.createtooltip(frame) -- {{#invoke:Entity Lookup|createtooltip|Текст|ProtoID|Картинка=картиночка|Статы=статы}}
-- p.createtexttooltip{args={"Верхний текст", "FreedomImplant", "Файл:Honks.gif"}}
function p.createtexttooltip(frame) -- {{#invoke:Entity Lookup|createtexttooltip|Текст|ProtoID|Картинка=картиночка|Статы=статы}}
     local out = " "
     local out = " "
     local entity = p.entities[frame.args[2]]
     local entity = p.entities[frame.args[2]]
Строка 15: Строка 16:
     end else
     end else
     out = frame:expandTemplate{ title = "Tooltip", args = { frame.args[1],  entity.name, entity.desc, frame.args["Статы"] }}
     out = frame:expandTemplate{ title = "Tooltip", args = { frame.args[1],  entity.name, entity.desc, frame.args["Статы"] }}
    end
    -- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}}
    end else
      out = frame:expandTemplate{ title = "Tooltip", args = { frame.args[1],  "[[Файл:Mousegif.gif|64x64px|left|middle|link=]] Не найден", "Предмет не найден"}}
    end
    return out
end
-- p.createimagetooltip{args={"Файл:Honks.gif", "FreedomImplant", Статы="Имеет 3 заряда"}}
function p.createimagetooltip(frame) -- {{#invoke:Entity Lookup|createimagetooltip|Картинка|ProtoID|Мета=мета|Статы=статы}}
    local out = " "
    local entity = p.entities[frame.args[2]]
    local pic = frame.args[1]
    local meta = frame.args["Мета"]
    if meta == nil then
        meta = "64x64px|link="
    end
    if entity ~= nil then do
    if frame.args[1] ~= nil then do
    pic = "[[" .. frame.args[1] .. "|" .. meta .. "]]"
    out =  frame:expandTemplate{ title = "Tooltip", args = { pic, entity.name, entity.desc, frame.args["Статы"] }}
    end else
    out = frame:expandTemplate{ title = "Tooltip", args = { "[[Файл:Mousegif.gif|64x64px|left|middle|link=]]",  entity.name, entity.desc, frame.args["Статы"] }}
     end
     end
     -- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}}
     -- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}}