VOOZH about

URL: https://minecraft.wiki/w/Module:Layered_blueprint

⇱ Module:Layered blueprint – Minecraft Wiki


Module:Layered blueprint

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[view] [edit] [history] [purge]Jump to code ↴

This module implements {{layered blueprint}}.

Dependencies

[edit source]
[view] [edit] [history] [purge]The above documentation is transcluded from Module:Layered blueprint/doc.
localp={}
localgetLayerSize=function(data)
localwidth=0
localheight=#data
for_,vinipairs(data)do
width=math.max(#v,width)
end
returnwidth,height
end
p.main=function(f)
localargs=f
iff==mw.getCurrentFrame()then
args=f:getParent().args
else
f=mw.getCurrentFrame()
end
localtext=require([[Module:Text]])
localblockGrid=require([[Module:Sprite grid]]).grid
localkeys={}
fork,vinpairs(args)do
iftype(k)=='string'and#k==1then
keys[k]=v
end
end
locallayerNames={}
locallayers={}
localwidth=0
localheight=0
localscale=args.scaleor1
for_,vinipairs(args)do
ifv:match('%-%-%-%-')then
table.insert(layerNames,text.trim(string.sub(v,5)))
else
localdata=text.split(text.trim(v,'\n'),'\n')
locallayerWidth,layerHeight=getLayerSize(data)
width=math.max(layerWidth,width)
height=math.max(layerHeight,height)
data.keys=keys
data.scale=scale
data.sheet=args.sheet
table.insert(layers,blockGrid(data))
end
end
localname=args.name:gsub(' ','_')
localdefaultLayer=args.default
localbody=mw.html.create('div'):addClass('layered-blueprint'):css({
width=width*16*scale..'px',
['min-height']=height*16*scale..'px'
})
fori,vinipairs(layerNames)do
localtab_div=mw.html.create('div')
ifv==defaultLayerornotdefaultLayerandi==1then
tab_div
:attr('data-checked',tostring(v==defaultLayer))
end
tab_div
:attr('id',name..'-layer'..i)
:attr('class','layered-blueprint-tab')
:attr('data-name',name)
:wikitext(v)
body:wikitext(tostring(tab_div))
body:tag('div'):addClass('layered-blueprint-layer'):newline():wikitext(layers[i])
end
returnbody
end
returnp
Retrieved from "https://minecraft.wiki/w/Module:Layered_blueprint?oldid=2681208"

Navigation menu