![]() |
VOOZH | about |
p.properties implements {{Materials row}}.
p.blocks implements {{Material blocks row}}.
See those pages for documentation.
localp={} functionp.properties(frame) localargs=frame ifframe==mw.getCurrentFrame()then args=frame:getParent().args else frame=mw.getCurrentFrame() end localoutput={} ifargs.anchorandargs.anchor~=""then table.insert(output,'|- id="'..args.anchor..'"') else table.insert(output,'|-') end ifargs.thandargs.th~=""then table.insert(output,'! scope=row | '..args.name) else table.insert(output,'| '..args.name) end ifargs.rgbthen table.insert(output,'| style="background-color: rgb('..args.rgb..');" | ') table.insert(output,'| '..args.rgb) else table.insert(output,'| ') table.insert(output,'| None') end localbools={ liquid='0', solid='1', blockmove='1', burn='0', replace='0', solidBlocking='1' } -- Material subclasses ifargs.subclass=='liquid'then bools.liquid='1' bools.blockmove='0' bools.solid='0' bools.replace='1' args.piston=args.pistonor'replace' elseifargs.subclass=='nonsolid'then bools.solid='0' bools.blockmove='0' elseifargs.subclass=='transparent'then bools.solid='0' bools.blockmove='0' bools.replace='1' args.piston=args.pistonor'replace' end -- Apply args for_,boolinpairs{'liquid','solid','blockmove','burn','replace','solidBlocking'}do ifargs[bool]then bools[bool]=args[bool] end end -- Output! localyes=frame:expandTemplate{title='tc',args={'yes'}} localno=frame:expandTemplate{title='tc',args={'no'}} for_,boolinpairs{'liquid','solid','solidBlocking','blockmove','burn','replace'}do ifbools[bool]=='0'then table.insert(output,'| '..no) else table.insert(output,'| '..yes) end end args.piston=args.pistonor'pushed' ifargs.piston=='pushed'then table.insert(output,'| '..frame:expandTemplate{title='tc',args={'yes','Pushed'}}) elseifargs.piston=='replace'then table.insert(output,'| '..frame:expandTemplate{title='tc',args={'neutral','Replace'}}) elseifargs.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 returntable.concat(output,'\n') end functionp.blocks(frame) localargs=frame ifframe==mw.getCurrentFrame()then args=frame:getParent().args else frame=mw.getCurrentFrame() end localslot=require('Module:Inventory slot').slot localoutput={} ifargs.anchorandargs.anchor~=""then table.insert(output,'|- id="'..args.anchor..'"') else table.insert(output,'|-') end ifargs.thandargs.th~=""then table.insert(output,'! scope=row | '..args.name) else table.insert(output,'| '..args.name) end ifargs.blocksor''~=''then localimages={} forblockinmw.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 returntable.concat(output,'\n') end returnp