Module:Materials row

local p = {}

function p.properties( frame ) local args = frame if frame == mw.getCurrentFrame then args = frame:getParent.args else frame = mw.getCurrentFrame end local output = { '|-' }

table.insert( output, '| ' .. args.name )

if args.rgb then table.insert( output, '| style="background-color: rgb(' .. args.rgb .. ');" |  ' ) table.insert( output, '| ' .. args.rgb ) else table.insert( output, '|  ' ) table.insert( output, '| None' ) end

local bools = { liquid = '0', solid = '1', blockmove = '1', tool = '0', burn = '0', replace = '0', solidBlocking = '1' }

-- Material subclasses if args.subclass == 'liquid' then bools.liquid = '1' bools.blockmove = '0' bools.solid = '0' bools.replace = '1' args.piston = args.piston or 'replace' elseif args.subclass == 'nonsolid' then -- MCP "MaterialLogic" bools.solid = '0' bools.blockmove = '0' elseif args.subclass == 'portal' then bools.solid = '0' bools.blockmove = '0' elseif args.subclass == 'transparent' then bools.solid = '0' bools.blockmove = '0' bools.replace = '1' elseif args.subclass == 'cobweb' then bools.blockmove = '0' elseif args.subclass == 'structurevoid' then bools.replace = '1' bools.solid = '0' bools.blockmove = '0' end

-- Apply args for _, bool in pairs{ 'tool', 'burn', 'replace', 'solidBlocking' } do       if args[bool] then bools[bool] = args[bool] end end

-- Output! local yes = frame:expandTemplate{ title = 'tc', args = { 'yes' } } local no = frame:expandTemplate{ title = 'tc', args = { 'no' } } for _, bool in pairs{ 'liquid', 'solid', 'blockmove', 'tool', 'burn', 'replace' } do       if bools[bool] == '0' then table.insert( output, '| ' .. no ) else table.insert( output, '| ' .. yes ) end end

args.piston = args.piston or 'pushed' if args.piston == 'pushed' then table.insert( output, '| ' .. frame:expandTemplate{ title = 'tc', args = { 'yes', 'Pushed' } } ) elseif args.piston == 'replace' then table.insert( output, '| ' .. frame:expandTemplate{ title = 'tc', args = { 'neutral', 'Replace' } } ) elseif args.piston == 'blocked' then table.insert( output, '| ' .. frame:expandTemplate{ title = 'tc', args = { 'no', 'Blocked' } } ) else table.insert( output, '| ' .. frame:expandTemplate{ title = 'tc', args = { 'unknown', args.piston } } ) end

return table.concat( output, '\n' ) end

function p.blocks( frame ) local args = frame if frame == mw.getCurrentFrame then args = frame:getParent.args else frame = mw.getCurrentFrame end local slot = require( 'Module:Inventory slot' ).slot local output = { '|-' }

table.insert( output, '| ' .. args.name )

if args.blocks or  ~=  then local images = {} for block in mw.text.gsplit( args.blocks, '%s*,%s*' ) do			table.insert( images, slot{ block, class = 'invslot-plain' } ) end table.insert( output, '| style="text-align:center" | ' .. table.concat( images ) ) else table.insert( output, "| style=\"text-align:center\" | Not applied to any blocks." ) end

return table.concat( output, '\n' ) end

return p