Модуль:Entity Sprite/all: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 39: | Строка 39: | ||
end | end | ||
local function | local function findFieldInsensitive(tbl, fieldName) | ||
for key, value in pairs(tbl) do | for key, value in pairs(tbl) do | ||
if type(key) == "string" and mw.ustring.lower(key) == mw.ustring.lower(fieldName) then | if type(key) == "string" and mw.ustring.lower(key) == mw.ustring.lower(fieldName) then | ||
| Строка 49: | Строка 49: | ||
local function getSpritePath(entry) | local function getSpritePath(entry) | ||
local iconField = | local iconField = findFieldInsensitive(entry, "Icon") | ||
local spriteField = | local spriteField = findFieldInsensitive(entry, "Sprite") | ||
if iconField and iconField.sprite then | if iconField and iconField.sprite then | ||
| Строка 125: | Строка 125: | ||
local found = false | local found = false | ||
for _, group in pairs(spriteGroups) do | for _, group in pairs(spriteGroups) do | ||
if deepEqual( | if deepEqual(findFieldInsensitive(entry, "Sprite"), findFieldInsensitive(group[1], "Sprite")) and | ||
deepEqual(entry.EntityStorageVisuals, group[1].EntityStorageVisuals) and | deepEqual(entry.EntityStorageVisuals, group[1].EntityStorageVisuals) and | ||
deepEqual( | deepEqual(findFieldInsensitive(entry, "Icon"), findFieldInsensitive(group[1], "Icon")) then | ||
table.insert(group, entry) | table.insert(group, entry) | ||
found = true | found = true | ||