Модуль:Entity Sprite/all: различия между версиями
Pok (обсуждение | вклад) Нет описания правки |
Pok (обсуждение | вклад) мНет описания правки |
||
| Строка 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 | ||
local stateStr = "" | |||
if state then | |||
return mw.getCurrentFrame():preprocess("{{Entity Sprite/ | stateStr = "(" .. state .. ")" | ||
end | |||
return mw.getCurrentFrame():preprocess("{{Entity Sprite/Image|" .. entry.id .. "|" .. spritePath .. stateStr .. "}}") | |||
end | end | ||