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

Нет описания правки
Нет описания правки
Метка: ручная отмена
 
(не показано 12 промежуточных версий этого же участника)
Строка 2: Строка 2:
local JsonPaths = require('Module:JsonPaths')
local JsonPaths = require('Module:JsonPaths')
local prefix = JsonPaths.prefixFile()
local prefix = JsonPaths.prefixFile()
local function filterByEntityIds(spriteData, entityIds)
if not entityIds then
return spriteData
end
local result = {}
for id, entry in pairs(spriteData) do
if entityIds[id] ~= nil then
result[id] = entry
end
end
return result
end


local function normalizeSpritePath(path)
local function normalizeSpritePath(path)
Строка 199: Строка 183:
end
end


local function filterSpriteData(spriteData, prototypeData, whitelistSet, blacklistSet)
local function filterSpriteData(spriteData, prototypeData, whitelistSet, blacklistSet, project)
local result = {}
local result = {}


Строка 206: Строка 190:


if shouldIncludeEntry(protoEntry, whitelistSet, blacklistSet) then
if shouldIncludeEntry(protoEntry, whitelistSet, blacklistSet) then
result[id] = entry
if project == "" or JsonPaths.has(id, project) then
result[id] = entry
end
end
end
end
end
Строка 344: Строка 330:
local whitelistSet = buildSet(frame.args.whitelistParent)
local whitelistSet = buildSet(frame.args.whitelistParent)
local blacklistSet = buildSet(frame.args.blacklistParent)
local blacklistSet = buildSet(frame.args.blacklistParent)
local filteredData = filterSpriteData(spriteData, prototypeData, whitelistSet, blacklistSet, project)
local filteredData = filterSpriteData(spriteData, prototypeData, whitelistSet, blacklistSet)
local entityIds = JsonPaths.loadEntityIds(project)
filteredData = filterByEntityIds(filteredData, entityIds)


if action == "repeat" then
if action == "repeat" then