2015-01-11 22:21:33 +01:00
|
|
|
--[[
|
2015-01-12 17:46:22 +01:00
|
|
|
More Blocks: Stairs+
|
2015-01-11 22:21:33 +01:00
|
|
|
|
2017-02-19 13:35:16 +01:00
|
|
|
Copyright (c) 2011-2017 Hugo Locurcio and contributors.
|
2015-01-11 22:21:33 +01:00
|
|
|
Licensed under the zlib license. See LICENSE.md for more information.
|
|
|
|
--]]
|
|
|
|
|
2014-03-09 10:38:18 +01:00
|
|
|
-- Nodes will be called <modname>:{stair,slab,panel,micro}_<subname>
|
|
|
|
|
2014-07-21 12:24:49 +02:00
|
|
|
local modpath = minetest.get_modpath("moreblocks").. "/stairsplus"
|
2014-03-09 10:38:18 +01:00
|
|
|
|
|
|
|
stairsplus = {}
|
|
|
|
stairsplus.expect_infinite_stacks = false
|
|
|
|
|
2017-02-23 15:28:26 +01:00
|
|
|
stairsplus.shapes_list = {}
|
|
|
|
|
2014-06-27 20:14:08 +02:00
|
|
|
if not minetest.get_modpath("unified_inventory")
|
|
|
|
and minetest.setting_getbool("creative_mode") then
|
2014-03-09 10:38:18 +01:00
|
|
|
stairsplus.expect_infinite_stacks = true
|
|
|
|
end
|
|
|
|
|
2016-10-03 12:14:34 +02:00
|
|
|
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
|
|
|
|
|
2015-11-01 17:54:29 +01:00
|
|
|
function stairsplus:prepare_groups(groups)
|
2016-01-26 21:52:55 +01:00
|
|
|
local result = {}
|
2015-11-01 17:54:29 +01:00
|
|
|
if groups then
|
|
|
|
for k, v in pairs(groups) do
|
|
|
|
if k ~= "wood" and k ~= "stone" then
|
|
|
|
result[k] = v
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2014-10-19 18:15:46 +02:00
|
|
|
if not moreblocks.config.stairsplus_in_creative_inventory then
|
2015-11-01 17:54:29 +01:00
|
|
|
result.not_in_creative_inventory = 1
|
2014-03-09 10:38:18 +01:00
|
|
|
end
|
2015-11-01 17:54:29 +01:00
|
|
|
return result
|
|
|
|
end
|
|
|
|
|
|
|
|
function stairsplus:register_all(modname, subname, recipeitem, fields)
|
2014-03-09 10:38:18 +01:00
|
|
|
self:register_stair(modname, subname, recipeitem, fields)
|
|
|
|
self:register_slab (modname, subname, recipeitem, fields)
|
2014-10-28 22:12:40 +01:00
|
|
|
self:register_slope(modname, subname, recipeitem, fields)
|
2014-03-09 10:38:18 +01:00
|
|
|
self:register_panel(modname, subname, recipeitem, fields)
|
|
|
|
self:register_micro(modname, subname, recipeitem, fields)
|
2014-06-27 20:14:08 +02:00
|
|
|
-- self:register_6dfacedir_conversion(modname, subname) -- Not needed as of Q3 2013, uncomment to fix old maps.
|
2014-03-09 10:38:18 +01:00
|
|
|
end
|
|
|
|
|
2016-10-03 12:14:34 +02:00
|
|
|
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
|
|
|
|
|
2014-03-09 10:38:18 +01:00
|
|
|
function register_stair_slab_panel_micro(modname, subname, recipeitem, groups, images, description, drop, light)
|
|
|
|
stairsplus:register_all(modname, subname, recipeitem, {
|
|
|
|
groups = groups,
|
|
|
|
tiles = images,
|
|
|
|
description = description,
|
|
|
|
drop = drop,
|
|
|
|
light_source = light
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2014-07-21 12:24:49 +02:00
|
|
|
-- dofile(modpath.. "/aliases.lua") -- Not needed as of Q2 2013, uncomment to fix old maps.
|
|
|
|
-- dofile(modpath.. "/conversion.lua") -- Not needed as of Q2 2013, uncomment to fix old maps.
|
2014-10-28 22:12:40 +01:00
|
|
|
dofile(modpath .. "/stairs.lua")
|
|
|
|
dofile(modpath .. "/slabs.lua")
|
|
|
|
dofile(modpath .. "/slopes.lua")
|
|
|
|
dofile(modpath .. "/panels.lua")
|
|
|
|
dofile(modpath .. "/microblocks.lua")
|
|
|
|
dofile(modpath .. "/registrations.lua")
|