FANDOM


local p = {} local text = require( Modul:Text ) local sprite = require( Modul:Sprite ).link

function p.grid( f )

local args = f

if f == mw.getCurrentFrame() then args = f:getParent().args end

local rows = {} local scale = args.scale local size = 16 * ( scale or 1 ) local categories = {} local keys = args.keys or args

for k, v in ipairs( args ) do

local row = {}

for v2 in text.gsplit( v:gsub( '^%s-\n+', ):gsub( '\n+%s-$', ), ) do

local spriteName = keys[v2]

if text.trim( v2 ) == or spriteName == 'air' then

row[#row + 1] = ' style="width:' .. size .. 'px;height:' .. size .. 'px" | '

else

local sheet = 'BlockSprite' local css

if spriteName then local spritePart = text.split( spriteName, '-rot' ) spriteName = spritePart[1] if spritePart[2] then css = 'transform:rotate(' .. spritePart[2] .. 'deg)' end if (#spriteName >= 12 and spriteName:sub( 1, 11 ):lower() == 'gegenstand:') or (#spriteName >= 6 and spriteName:sub( 1, 5 ):lower() == 'item:') then sheet = 'GegenstandSprite' spriteName = spriteName:sub( 6 ) else if #spriteName >= 8 and (spriteName:sub( 1, 7 ):lower() == 'objekt:' or spriteName:sub( 1, 7 ):lower() == 'entity:') then sheet = 'ObjektSprite' spriteName = spriteName:sub( 8 ) end end end

local image, spriteCat = sprite{ data = sheet, spriteName, scale = scale, link = 'none', notext = 1, nocat = args.nocat, css = css } row[#row + 1] = image categories[#categories + 1] = spriteCat end end

rows[k] = table.concat( row, ' || ' ) end

local spacing = tonumber( args.spacing or ) or 0

return '{| cellspacing="' .. spacing .. '" cellpadding="0" style="margin:0; line-height:0"\n| ' .. table.concat( rows, '\n|-\n| ' ) .. '\n|}' .. table.concat( categories )

end

function p.grid2( f ) local args = f:getParent().args local rows = {} local cell = require( 'Modul:Grid' ).cell local cellArgs = {,title='none',link='none'}

for k, v in ipairs( args ) do local row = {} for v2 in mw.text.gsplit( v:gsub( '^%s-\n+', ):gsub( '\n+%s-$', ), ) do if args[v2] == 'Luft' then cellArgs[1] = else cellArgs[1] = args[v2] end table.insert( row, cell( cellArgs ) ) end

table.insert( rows, table.concat( row, ' || ' ) ) end

return '{| cellspacing="0" cellpadding="0" style="line-height:0"\n| ' .. table.concat( rows, '\n|-\n| ' ) .. '\n|}' end

return p

Community content is available under CC-BY-SA unless otherwise noted.