forked from MTSR/moreblocks
parent
ab2c63270f
commit
7f06db2200
@ -17,6 +17,21 @@ and minetest.setting_getbool("creative_mode") then
|
||||
stairsplus.expect_infinite_stacks = true
|
||||
end
|
||||
|
||||
function stairsplus.copytable(orig)
|
||||
local orig_type = type(orig)
|
||||
local copy
|
||||
if orig_type == 'table' then
|
||||
copy = {}
|
||||
for orig_key, orig_value in next, orig, nil do
|
||||
copy[stairsplus.copytable(orig_key)] = stairsplus.copytable(orig_value)
|
||||
end
|
||||
setmetatable(copy, stairsplus.copytable(getmetatable(orig)))
|
||||
else
|
||||
copy = orig
|
||||
end
|
||||
return copy
|
||||
end
|
||||
|
||||
function stairsplus:prepare_groups(groups)
|
||||
local result = {}
|
||||
if groups then
|
||||
@ -41,6 +56,21 @@ function stairsplus:register_all(modname, subname, recipeitem, fields)
|
||||
-- self:register_6dfacedir_conversion(modname, subname) -- Not needed as of Q3 2013, uncomment to fix old maps.
|
||||
end
|
||||
|
||||
function stairsplus:register_alias_all(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_stair_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_slab_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_slope_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_panel_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_micro_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
end
|
||||
function stairsplus:register_alias_force_all(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
self:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
end
|
||||
|
||||
function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light)
|
||||
stairsplus:register_all(modname, subname, recipeitem, {
|
||||
groups = groups,
|
||||
|
@ -20,8 +20,7 @@ function register_micro(modname, subname, recipeitem, groups, images, descriptio
|
||||
})
|
||||
end
|
||||
|
||||
function stairsplus:register_micro(modname, subname, recipeitem, fields)
|
||||
local defs = {
|
||||
local microblocks_defs = {
|
||||
[""] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -66,6 +65,22 @@ function stairsplus:register_micro(modname, subname, recipeitem, fields)
|
||||
}
|
||||
}
|
||||
|
||||
function stairsplus:register_micro_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(microblocks_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_micro_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(microblocks_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias_force(modname_old .. ":micro_" .. subname_old .. alternate, modname_new .. ":micro_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_micro(modname, subname, recipeitem, fields)
|
||||
local defs = stairsplus.copytable(microblocks_defs)
|
||||
local desc = S("%s Microblock"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
for k, v in pairs(fields) do
|
||||
|
@ -20,8 +20,7 @@ function register_panel(modname, subname, recipeitem, groups, images, descriptio
|
||||
})
|
||||
end
|
||||
|
||||
function stairsplus:register_panel(modname, subname, recipeitem, fields)
|
||||
local defs = {
|
||||
local panels_defs = {
|
||||
[""] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -66,6 +65,22 @@ function stairsplus:register_panel(modname, subname, recipeitem, fields)
|
||||
}
|
||||
}
|
||||
|
||||
function stairsplus:register_panel_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(panels_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_panel_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(panels_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias_force(modname_old .. ":panel_" .. subname_old .. alternate, modname_new .. ":panel_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_panel(modname, subname, recipeitem, fields)
|
||||
local defs = stairsplus.copytable(panels_defs)
|
||||
local desc = S("%s Panel"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
for k, v in pairs(fields) do
|
||||
|
@ -20,8 +20,7 @@ function register_slab(modname, subname, recipeitem, groups, images, description
|
||||
})
|
||||
end
|
||||
|
||||
function stairsplus:register_slab(modname, subname, recipeitem, fields)
|
||||
local defs = {
|
||||
local slabs_defs = {
|
||||
[""] = 8,
|
||||
["_quarter"] = 4,
|
||||
["_three_quarter"] = 12,
|
||||
@ -31,6 +30,22 @@ function stairsplus:register_slab(modname, subname, recipeitem, fields)
|
||||
["_15"] = 15,
|
||||
}
|
||||
|
||||
function stairsplus:register_slab_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(slabs_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_slab_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(slabs_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias_force(modname_old .. ":slab_" .. subname_old .. alternate, modname_new .. ":slab_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_slab(modname, subname, recipeitem, fields)
|
||||
local defs = stairsplus.copytable(slabs_defs)
|
||||
local desc_base = S("%s Slab"):format(fields.description)
|
||||
for alternate, num in pairs(defs) do
|
||||
local def = {
|
||||
|
@ -123,8 +123,7 @@ function register_slope(modname, subname, recipeitem, groups, images, descriptio
|
||||
})
|
||||
end
|
||||
|
||||
function stairsplus:register_slope(modname, subname, recipeitem, fields)
|
||||
local defs = {
|
||||
local slopes_defs = {
|
||||
[""] = {
|
||||
mesh = "moreblocks_slope.obj",
|
||||
collision_box = box_slope,
|
||||
@ -220,6 +219,22 @@ function stairsplus:register_slope(modname, subname, recipeitem, fields)
|
||||
},
|
||||
}
|
||||
|
||||
function stairsplus:register_slope_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(slopes_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_slope_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(slopes_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias_force(modname_old .. ":slope_" .. subname_old .. alternate, modname_new .. ":slope_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_slope(modname, subname, recipeitem, fields)
|
||||
local defs = stairsplus.copytable(slopes_defs)
|
||||
local desc = S("%s Slope"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
for k, v in pairs(fields) do
|
||||
|
@ -20,8 +20,7 @@ function register_stair(modname, subname, recipeitem, groups, images, descriptio
|
||||
})
|
||||
end
|
||||
|
||||
function stairsplus:register_stair(modname, subname, recipeitem, fields)
|
||||
local defs = {
|
||||
local stairs_defs = {
|
||||
[""] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -106,6 +105,22 @@ function stairsplus:register_stair(modname, subname, recipeitem, fields)
|
||||
},
|
||||
}
|
||||
|
||||
function stairsplus:register_stair_alias(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(stairs_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_stair_alias_force(modname_old, subname_old, modname_new, subname_new)
|
||||
local defs = stairsplus.copytable(stairs_defs)
|
||||
for alternate, def in pairs(defs) do
|
||||
minetest.register_alias_force(modname_old .. ":stair_" .. subname_old .. alternate, modname_new .. ":stair_" .. subname_new .. alternate)
|
||||
end
|
||||
end
|
||||
|
||||
function stairsplus:register_stair(modname, subname, recipeitem, fields)
|
||||
local defs = stairsplus.copytable(stairs_defs)
|
||||
local desc = S("%s Stairs"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
for k, v in pairs(fields) do
|
||||
|
Loading…
Reference in New Issue
Block a user