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

Нет описания правки
мНет описания правки
Строка 103: Строка 103:
     if not entry.id or not spritePath then
     if not entry.id or not spritePath then
         return nil
         return nil
    end
    -- Определяем state
    local state = nil
    if entry.Sprite and entry.Sprite.state then
        state = entry.Sprite.state
    elseif entry.Sprite and entry.Sprite.layers then
        for _, layer in pairs(entry.Sprite.layers) do
            if layer.state then
                state = layer.state
                break
            end
        end
     end
     end


     if param == "image" then
     if param == "image" then
         return mw.getCurrentFrame():preprocess("{{Entity Sprite/Image|" .. entry.id .. "|" .. spritePath .. "}}")
         local stateStr = ""
    elseif param == "path" then
        if state then
         return mw.getCurrentFrame():preprocess("{{Entity Sprite/Path|" .. entry.id .. "|" .. spritePath .. "}}")
            stateStr = "(" .. state .. ")"
        end
         return mw.getCurrentFrame():preprocess("{{Entity Sprite/Image|" .. entry.id .. "|" .. spritePath .. stateStr .. "}}")
     end
     end