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

мНет описания правки
м Замена текста — «Mousegif.gif» на «MobMouse2.png»
 
(не показаны 4 промежуточные версии 2 участников)
Строка 12: Строка 12:
if not id then return "Не найдено" end
if not id then return "Не найдено" end


-- Сначала проверяем наличие в overrides
local override = p.name_overrides[id]
local override = p.name_overrides[id]
if override then
if override then
Строка 32: Строка 31:
if not name then return "Не найдено" end
if not name then return "Не найдено" end


-- Сначала ищем в overrides
for id, overrideName in pairs(p.name_overrides) do
for id, overrideName in pairs(p.name_overrides) do
if overrideName == name then
if overrideName == name then
Строка 39: Строка 37:
end
end


-- Затем ищем в prototypes
for id, entity in pairs(p.entities) do
for id, entity in pairs(p.entities) do
if entity.name == name then
if entity.name == name then
Строка 50: Строка 47:




-- p.createtexttooltip{args={"Верхний текст", "FreedomImplant", "Файл:Honks.gif"}}
-- p.getname{args={"FreedomImplant"}}
function p.getdesc(frame, entid) -- {{#invoke:Entity Lookup|getdesc|ProtoID}}
    local out = ""
    local id = ""
    if frame.args[1] ~= nil then id = frame.args[1]
    else id = entid end
    local entity = p.entities[id]
    if entity ~= nil then
        out = entity.desc
    else
        out = "Не найдено"
    end
return out
end
 
 
-- p.createtexttooltip{args={"Верхний текст", "FreedomImplant", "Файл:Horns.png"}}
function p.createtexttooltip(frame) -- {{#invoke:Entity Lookup|createtexttooltip|Текст|ProtoID|img=картиночка}}
function p.createtexttooltip(frame) -- {{#invoke:Entity Lookup|createtexttooltip|Текст|ProtoID|img=картиночка}}
local out = " "
local out = " "
Строка 63: Строка 76:
-- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}}
-- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}}
end else
end else
  out = frame:preprocess("{{Tooltip|".. frame.args[1] .."|Не найден|Предмет не найден|img=Mousegif.gif}}")
  out = frame:preprocess("{{Tooltip|".. frame.args[1] .."|Не найден|Предмет не найден|img=MobMouse2.png}}")
end
end
return out
return out
Строка 69: Строка 82:




-- p.createimagetooltip{args={"Файл:Honks.gif", "FreedomImplant", Статы="Имеет 3 заряда"}}
-- p.createimagetooltip{args={"Файл:Horns.png", "FreedomImplant", Статы="Имеет 3 заряда"}}
function p.createimagetooltip(frame) -- {{#invoke:Entity Lookup|createimagetooltip|Картинка|ProtoID|Мета=мета|Статы=статы}}
function p.createimagetooltip(frame) -- {{#invoke:Entity Lookup|createimagetooltip|Картинка|ProtoID|Мета=мета|Статы=статы}}
local out = " "
local out = " "
Строка 85: Строка 98:
out = frame:preprocess("{{Tooltip|".. pic .. "|" .. entity.name .. "|" .. entity.desc .. "|" .. stats .."|no-text-decoration=1}}")
out = frame:preprocess("{{Tooltip|".. pic .. "|" .. entity.name .. "|" .. entity.desc .. "|" .. stats .."|no-text-decoration=1}}")
end else
end else
out = frame:preprocess("{{Tooltip|[[Файл:Mousegif.gif|64x64px|left|middle|link=]]|" .. entity.name .. "|" .. entity.desc .. "|" .. stats .."|no-text-decoration=1}}")
out = frame:preprocess("{{Tooltip|[[Файл:MobMouse2.png|64x64px|left|middle|link=]]|" .. entity.name .. "|" .. entity.desc .. "|" .. stats .."|no-text-decoration=1}}")
end
end
-- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}}
-- {{Tooltip|Текст|[[картиночка|64x64px|left|middle|link=]] Название|Описание}}
end else
end else
  out = frame:preprocess("{{Tooltip|" .. pic .. "|Не найден|Предмет не найден|img=Mousegif.gif|no-text-decoration=1}}")
  out = frame:preprocess("{{Tooltip|" .. pic .. "|Не найден|Предмет не найден|img=MobMouse2.png|no-text-decoration=1}}")
end
end
return out
return out