Module:Inventory slot: Difference between revisions
Really unbreak mods... |
No edit summary |
||
| Line 27: | Line 27: | ||
end | end | ||
local randomise | |||
if args.class == 'invslot-large' then | |||
randomise = false | |||
end | |||
if aliases or modAliases then | if aliases or modAliases then | ||
local frames = {} | local frames = {} | ||
| Line 48: | Line 52: | ||
else | else | ||
table.insert( frames, frame ) | table.insert( frames, frame ) | ||
end | |||
-- Randomise starting frame for "Any *" aliases, as long as the alias is the only frame | |||
-- and this isn't an output slot | |||
if randomise ~= false and frameParts.name:match( '^Any ' ) then | |||
randomise = true | |||
else | |||
randomise = false | |||
end | end | ||
end | end | ||
| Line 76: | Line 87: | ||
end | end | ||
local | local frames = mw.text.split( args[1], '%s*;%s*' ) | ||
local activeFrame = randomise and math.random( #frames ) or 1 | |||
for i, frame in ipairs( frames ) do | |||
local item | local item | ||
if frame ~= '' or frame == '' and animated then | if frame ~= '' or frame == '' and animated then | ||
| Line 212: | Line 224: | ||
end | end | ||
if | if i == activeFrame and animated and item then | ||
item:addClass( 'active' ) | |||
end | end | ||
end | end | ||