Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 1: | Строка 1: | ||
local p = {} | local p = {} | ||
local JsonPaths = require('Module:JsonPaths') | local JsonPaths = require('Module:JsonPaths') | ||
local function getSpritePath(entry) | local function getSpritePath(entry) | ||
| Строка 44: | Строка 25: | ||
return "https://github.com/space-syndicate/space-station-14/blob/master/Resources/Textures/" | return "https://github.com/space-syndicate/space-station-14/blob/master/Resources/Textures/" | ||
end | |||
local function getPrefix(id, project) | |||
if project ~= "" and JsonPaths.has(id, project) then | |||
return project .. ":" | |||
end | |||
return "" | |||
end | end | ||
| Строка 55: | Строка 43: | ||
local g = group[1] | local g = group[1] | ||
if entry.sprite == g.sprite and entry.state == g.state then | if entry.sprite == g.entry.sprite and entry.state == g.entry.state then | ||
table.insert(group, { id = id, entry = entry }) | table.insert(group, { id = id, entry = entry }) | ||
found = true | found = true | ||
| Строка 77: | Строка 65: | ||
for _, obj in pairs(group) do | for _, obj in pairs(group) do | ||
local id = obj.id | local id = obj.id | ||
local prefix = | local prefix = getPrefix(id, project) | ||
table.insert(idLinks, "[[:Файл:" .. prefix .. id .. ".png]]") | table.insert(idLinks, "[[:Файл:" .. prefix .. id .. ".png]]") | ||
end | end | ||
| Строка 99: | Строка 88: | ||
end | end | ||
local prefix = | local prefix = getPrefix(id, project) | ||
local states = getSpriteStates(entry) | local states = getSpriteStates(entry) | ||