Module:Crafting: Difference between revisions

Consistency
(fix for inline spans)
(Consistency)
Line 5: Line 5:
end
end


-- Make a 3*3 crafting grid
function p.Grid( f )
function p.Grid( f )
local args = f.args
local args = f.args
Line 14: Line 15:
end
end


-- Make a 1*1 crafting grid
function p.Cell( f )
function p.Cell( f )
local args = f.args
local args = f.args
Line 23: Line 25:
end
end


-- make a 1*5 crafting grid
function p.Hopper( f )
function p.Hopper( f )
local args = f.args
local args = f.args
Line 32: Line 35:
end
end


-- Make a catalyst
function p.Catalyst( f )
function p.Catalyst( f )
local args = f.args
local args = f.args
Line 37: Line 41:
args = f:getParent().args or {""}
args = f:getParent().args or {""}
end
end
return require([[Module:Sprite]])
return require([[Module:InventorySlot]]).Decode(args[1])
:new("inventory")
:setItem(mw.text.trim(args[1]))
:SetSize(16)
:SetSize(16)
:GenerateHTML()
:GenerateHTML()
Line 45: Line 47:
end
end


-- Make an item
function p.Item( f )
function p.Item( f )
local args = f.args
local args = f.args
Line 51: Line 54:
end
end


local Sprite = require([[Module:Sprite]])
local sprite
local sprite
local image = args['image'] or args['Image']


if image then
if image then
local Sprite = require([[Module:Sprite]])
local image = args['image'] or args['Image']
sprite = Sprite.Custom:new(args[1], image)
sprite = Sprite.Custom:new(args[1], image)
else
else
local spriteSheet = args['spriteSheet'] or
local spriteSheet = args['spriteSheet'] or
args['SpriteSheet'] or
args['SpriteSheet']
"inventory"
if spriteSheet then
sprite = Sprite
sprite = Sprite
:new(spriteSheet)
:new(spriteSheet)
:setItem(mw.text.trim(args[1] or ""))
:setItem(mw.text.trim(args[1] or ""))
else
sprite = require([[Module:InventorySlot]]).Decode(args[1])
end
 
end
end


Bureaucrats, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, translator, Widget editors
154

edits