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

мНет описания правки
мНет описания правки
Строка 53: Строка 53:


local function getSpriteStates(entry)
local function getSpriteStates(entry)
    local iconBlock = findFieldInsensitive(entry, "Icon")
    if iconBlock and iconBlock.state then
        return { { state = iconBlock.state, sprite = getSpritePath(entry) } }
    end
     local spriteBlock = findFieldInsensitive(entry, "Sprite")
     local spriteBlock = findFieldInsensitive(entry, "Sprite")
     if not spriteBlock or not spriteBlock.layers then
     if not spriteBlock or not spriteBlock.layers then
        local iconBlock = findFieldInsensitive(entry, "Icon")
        if iconBlock and iconBlock.state then
            return { { state = iconBlock.state, sprite = getSpritePath(entry) } }
        end
         if spriteBlock and spriteBlock.state then
         if spriteBlock and spriteBlock.state then
             return { { state = spriteBlock.state, sprite = getSpritePath(entry) } }
             return { { state = spriteBlock.state, sprite = getSpritePath(entry) } }
Строка 65: Строка 66:
     end
     end


     local firstStateLayer
     local firstStateLayer = nil
     for _, layer in ipairs(spriteBlock.layers) do
     for _, layer in ipairs(spriteBlock.layers) do
         if layer.state then
         if layer.state then
Строка 72: Строка 73:
         end
         end
     end
     end
     if not firstStateLayer then
     if not firstStateLayer then
         return nil
         return nil