Add size information to slab description (by est31).

This commit is contained in:
Calinou 2015-03-03 21:32:51 +01:00
parent d3c775ba3a
commit a360b8e83f
1 changed files with 16 additions and 45 deletions

View File

@ -22,51 +22,22 @@ end
function stairsplus:register_slab(modname, subname, recipeitem, fields) function stairsplus:register_slab(modname, subname, recipeitem, fields)
local defs = { local defs = {
[""] = { [""] = 8,
node_box = { ["_quarter"] = 4,
type = "fixed", ["_three_quarter"] = 12,
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, ["_1"] = 1,
}, ["_2"] = 2,
}, ["_14"] = 14,
["_quarter"] = { ["_15"] = 15,
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
},
},
["_three_quarter"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5},
},
},
["_1"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5},
},
},
["_2"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
},
},
["_14"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.375, 0.5},
},
},
["_15"] = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
},
},
} }
local desc = S("%s Slab"):format(fields.description) local desc_base = S("%s Slab"):format(fields.description)
for alternate, def in pairs(defs) do for alternate, num in pairs(defs) do
local def = {
node_box = {
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, (num/16)-0.5, 0.5},
}
}
def.drawtype = "nodebox" def.drawtype = "nodebox"
def.paramtype = "light" def.paramtype = "light"
def.paramtype2 = "facedir" def.paramtype2 = "facedir"
@ -74,7 +45,7 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
for k, v in pairs(fields) do for k, v in pairs(fields) do
def[k] = v def[k] = v
end end
def.description = desc def.description = ("%s (%d/16)"):format(desc_base, num)
if fields.drop then if fields.drop then
def.drop = modname.. ":slab_" .. fields.drop .. alternate def.drop = modname.. ":slab_" .. fields.drop .. alternate
end end