mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-06-28 06:12:05 +02:00
Merge ShadowNinja's rewrite.
This commit is contained in:
25
stairsplus/API.md
Normal file
25
stairsplus/API.md
Normal file
@ -0,0 +1,25 @@
|
||||
API documentation for StairsPlus
|
||||
================================
|
||||
- - - - - - - - - - - - - - - -
|
||||
|
||||
* `stairsplus:register_all(modname, subname, recipeitem, fields)`
|
||||
Registers a stair, slab, panel, microblock, and any other types of
|
||||
microblocks to be added in the future.
|
||||
Also registers the node with the circular saw.
|
||||
Example:
|
||||
```lua
|
||||
stairsplus:register_all("moreblocks", "wood", "defaut:wood", {
|
||||
description = "Wooden",
|
||||
tiles = {"default_wood.png"},
|
||||
groups = {oddly_breakabe_by_hand=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
})
|
||||
```
|
||||
The following register only a particular type of microblock.
|
||||
You will probably never want to use them directly.
|
||||
|
||||
* `stairsplus:register_stair(modname, subname, recipeitem, fields)`
|
||||
* `stairsplus:register_slab(modname, subname, recipeitem, fields)`
|
||||
* `stairsplus:register_panel(modname, subname, recipeitem, fields)`
|
||||
* `stairsplus:register_micro(modname, subname, recipeitem, fields)`
|
||||
|
@ -1,33 +1,34 @@
|
||||
function register_stairsplus_alias(modname, origname, newname)
|
||||
minetest.register_alias(modname .. ":slab_" .. origname, "moreblocks:slab_" .. newname)
|
||||
minetest.register_alias(modname .. ":slab_" .. origname .. "_inverted", "moreblocks:slab_" .. newname .. "_inverted")
|
||||
minetest.register_alias(modname .. ":slab_" .. origname .. "_wall", "moreblocks:slab_" .. newname .. "_wall")
|
||||
minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter", "moreblocks:slab_" .. newname .. "_quarter")
|
||||
minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_inverted", "moreblocks:slab_" .. newname .. "_quarter_inverted")
|
||||
minetest.register_alias(modname .. ":slab_" .. origname .. "_quarter_wall", "moreblocks:slab_" .. newname .. "_quarter_wall")
|
||||
minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter", "moreblocks:slab_" .. newname .. "_three_quarter")
|
||||
minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_inverted", "moreblocks:slab_" .. newname .. "_three_quarter_inverted")
|
||||
minetest.register_alias(modname .. ":slab_" .. origname .. "_three_quarter_wall", "moreblocks:slab_" .. newname .. "_three_quarter_wall")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname, "moreblocks:stair_" .. newname)
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_inverted", "moreblocks:stair_" .. newname .. "_inverted")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall", "moreblocks:stair_" .. newname .. "_wall")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", "moreblocks:stair_" .. newname .. "_wall_half")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", "moreblocks:stair_" .. newname .. "_wall_half_inverted")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_half", "moreblocks:stair_" .. newname .. "_half")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_half_inverted", "moreblocks:stair_" .. newname .. "_half_inverted")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half", "moreblocks:stair_" .. newname .. "_right_half")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_right_half_inverted", "moreblocks:stair_" .. newname .. "_right_half_inverted")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half", "moreblocks:stair_" .. newname .. "_wall_half")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_wall_half_inverted", "moreblocks:stair_" .. newname .. "_wall_half_inverted")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_inner", "moreblocks:stair_" .. newname .. "_inner")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_inner_inverted", "moreblocks:stair_" .. newname .. "_inner_inverted")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_outer", "moreblocks:stair_" .. newname .. "_outer")
|
||||
minetest.register_alias(modname .. ":stair_" .. origname .. "_outer_inverted", "moreblocks:stair_" .. newname .. "_outer_inverted")
|
||||
minetest.register_alias(modname .. ":panel_" .. origname .. "_bottom", "moreblocks:panel_" .. newname .. "_bottom")
|
||||
minetest.register_alias(modname .. ":panel_" .. origname .. "_top", "moreblocks:panel_" .. newname .. "_top")
|
||||
minetest.register_alias(modname .. ":panel_" .. origname .. "_vertical", "moreblocks:panel_" .. newname .. "_vertical")
|
||||
minetest.register_alias(modname .. ":micro_" .. origname .. "_bottom", "moreblocks:micro_" .. newname .. "_bottom")
|
||||
minetest.register_alias(modname .. ":micro_" .. origname .. "_top", "moreblocks:micro_" .. newname .. "_top")
|
||||
|
||||
local function register_stairsplus_alias(modname, origname, newname)
|
||||
minetest.register_alias(modname..":slab_"..origname, "moreblocks:slab_"..newname)
|
||||
minetest.register_alias(modname..":slab_"..origname.."_inverted", "moreblocks:slab_"..newname.."_inverted")
|
||||
minetest.register_alias(modname..":slab_"..origname.."_wall", "moreblocks:slab_"..newname.."_wall")
|
||||
minetest.register_alias(modname..":slab_"..origname.."_quarter", "moreblocks:slab_"..newname.."_quarter")
|
||||
minetest.register_alias(modname..":slab_"..origname.."_quarter_inverted", "moreblocks:slab_"..newname.."_quarter_inverted")
|
||||
minetest.register_alias(modname..":slab_"..origname.."_quarter_wall", "moreblocks:slab_"..newname.."_quarter_wall")
|
||||
minetest.register_alias(modname..":slab_"..origname.."_three_quarter", "moreblocks:slab_"..newname.."_three_quarter")
|
||||
minetest.register_alias(modname..":slab_"..origname.."_three_quarter_inverted", "moreblocks:slab_"..newname.."_three_quarter_inverted")
|
||||
minetest.register_alias(modname..":slab_"..origname.."_three_quarter_wall", "moreblocks:slab_"..newname.."_three_quarter_wall")
|
||||
minetest.register_alias(modname..":stair_"..origname, "moreblocks:stair_"..newname)
|
||||
minetest.register_alias(modname..":stair_"..origname.."_inverted", "moreblocks:stair_"..newname.."_inverted")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_wall", "moreblocks:stair_"..newname.."_wall")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_wall_half", "moreblocks:stair_"..newname.."_wall_half")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_wall_half_inverted", "moreblocks:stair_"..newname.."_wall_half_inverted")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_half", "moreblocks:stair_"..newname.."_half")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_half_inverted", "moreblocks:stair_"..newname.."_half_inverted")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_right_half", "moreblocks:stair_"..newname.."_right_half")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_right_half_inverted", "moreblocks:stair_"..newname.."_right_half_inverted")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_wall_half", "moreblocks:stair_"..newname.."_wall_half")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_wall_half_inverted", "moreblocks:stair_"..newname.."_wall_half_inverted")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_inner", "moreblocks:stair_"..newname.."_inner")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_inner_inverted", "moreblocks:stair_"..newname.."_inner_inverted")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_outer", "moreblocks:stair_"..newname.."_outer")
|
||||
minetest.register_alias(modname..":stair_"..origname.."_outer_inverted", "moreblocks:stair_"..newname.."_outer_inverted")
|
||||
minetest.register_alias(modname..":panel_"..origname.."_bottom", "moreblocks:panel_"..newname.."_bottom")
|
||||
minetest.register_alias(modname..":panel_"..origname.."_top", "moreblocks:panel_"..newname.."_top")
|
||||
minetest.register_alias(modname..":panel_"..origname.."_vertical", "moreblocks:panel_"..newname.."_vertical")
|
||||
minetest.register_alias(modname..":micro_"..origname.."_bottom", "moreblocks:micro_"..newname.."_bottom")
|
||||
minetest.register_alias(modname..":micro_"..origname.."_top", "moreblocks:micro_"..newname.."_top")
|
||||
end
|
||||
|
||||
register_stairsplus_alias("stairsplus", "stone", "stone")
|
||||
@ -59,3 +60,4 @@ register_stairsplus_alias("moreblocks", "splitstonesquare", "split_stone_tile")
|
||||
register_stairsplus_alias("moreblocks", "woodtile", "wood_tile")
|
||||
register_stairsplus_alias("moreblocks", "woodtile_centered", "wood_tile_centered")
|
||||
register_stairsplus_alias("moreblocks", "woodtile_full", "wood_tile_full")
|
||||
|
||||
|
132
stairsplus/conversion.lua
Normal file
132
stairsplus/conversion.lua
Normal file
@ -0,0 +1,132 @@
|
||||
-- Function to convert all stairs/slabs/etc nodes from
|
||||
-- inverted, wall, etc to regular + 6d facedir
|
||||
|
||||
local dirs1 = {21, 20, 23, 22, 21}
|
||||
local dirs2 = {15, 8, 17, 6, 15}
|
||||
local dirs3 = {14, 11, 16, 5, 14}
|
||||
|
||||
function stairsplus:register_6dfacedir_conversion(modname, material)
|
||||
--print("Register stairsplus 6d facedir conversion")
|
||||
--print('ABM for '..modname..' "'..material..'"')
|
||||
|
||||
local objects_list1 = {
|
||||
modname..":slab_"..material.."_inverted",
|
||||
modname..":slab_"..material.."_quarter_inverted",
|
||||
modname..":slab_"..material.."_three_quarter_inverted",
|
||||
modname..":stair_"..material.."_inverted",
|
||||
modname..":stair_"..material.."_wall",
|
||||
modname..":stair_"..material.."_wall_half",
|
||||
modname..":stair_"..material.."_wall_half_inverted",
|
||||
modname..":stair_"..material.."_half_inverted",
|
||||
modname..":stair_"..material.."_right_half_inverted",
|
||||
modname..":panel_"..material.."_vertical",
|
||||
modname..":panel_"..material.."_top",
|
||||
}
|
||||
|
||||
local objects_list2 = {
|
||||
modname..":slab_"..material.."_wall",
|
||||
modname..":slab_"..material.."_quarter_wall",
|
||||
modname..":slab_"..material.."_three_quarter_wall",
|
||||
modname..":stair_"..material.."_inner_inverted",
|
||||
modname..":stair_"..material.."_outer_inverted",
|
||||
modname..":micro_"..material.."_top"
|
||||
}
|
||||
|
||||
for _, object in pairs(objects_list1) do
|
||||
local flip_upside_down = false
|
||||
local flip_to_wall = false
|
||||
|
||||
local dest_object = object
|
||||
|
||||
if string.find(dest_object, "_inverted") then
|
||||
flip_upside_down = true
|
||||
dest_object = string.gsub(dest_object, "_inverted", "")
|
||||
end
|
||||
|
||||
if string.find(object, "_top") then
|
||||
flip_upside_down = true
|
||||
dest_object = string.gsub(dest_object, "_top", "")
|
||||
end
|
||||
|
||||
if string.find(dest_object, "_wall") then
|
||||
flip_to_wall = true
|
||||
dest_object = string.gsub(dest_object, "_wall", "")
|
||||
end
|
||||
|
||||
if string.find(dest_object, "_vertical") then
|
||||
flip_to_wall = true
|
||||
dest_object = string.gsub(dest_object, "_vertical", "")
|
||||
end
|
||||
|
||||
if string.find(dest_object, "_half") and not string.find(dest_object, "_right_half") then
|
||||
dest_object = string.gsub(dest_object, "_half", "_right_half")
|
||||
elseif string.find(dest_object, "_right_half") then
|
||||
dest_object = string.gsub(dest_object, "_right_half", "_half")
|
||||
end
|
||||
|
||||
--print(" +---> convert "..object)
|
||||
--print(" | to "..dest_object)
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {object},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local fdir = node.param2 or 0
|
||||
|
||||
if flip_upside_down and not flip_to_wall then
|
||||
nfdir = dirs1[fdir + 2]
|
||||
elseif flip_to_wall and not flip_upside_down then
|
||||
nfdir = dirs2[fdir + 1]
|
||||
elseif flip_to_wall and flip_upside_down then
|
||||
nfdir = dirs3[fdir + 2]
|
||||
end
|
||||
minetest.set_node(pos, {name = dest_object, param2 = nfdir})
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
for _, object in pairs(objects_list2) do
|
||||
local flip_upside_down = false
|
||||
local flip_to_wall = false
|
||||
|
||||
local dest_object = object
|
||||
|
||||
if string.find(dest_object, "_inverted") then
|
||||
flip_upside_down = true
|
||||
dest_object = string.gsub(dest_object, "_inverted", "")
|
||||
end
|
||||
|
||||
if string.find(dest_object, "_top") then
|
||||
flip_upside_down = true
|
||||
dest_object = string.gsub(dest_object, "_top", "")
|
||||
end
|
||||
|
||||
if string.find(dest_object, "_wall") then
|
||||
flip_to_wall = true
|
||||
dest_object = string.gsub(dest_object, "_wall", "")
|
||||
end
|
||||
|
||||
--print(" +---> convert "..object)
|
||||
--print(" | to "..dest_object)
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {object},
|
||||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local fdir = node.param2
|
||||
local nfdir = 20
|
||||
|
||||
if flip_upside_down and not flip_to_wall then
|
||||
nfdir = dirs1[fdir + 1]
|
||||
elseif flip_to_wall and not flip_upside_down then
|
||||
nfdir = dirs2[fdir + 2]
|
||||
|
||||
end
|
||||
minetest.set_node(pos, {name = dest_object, param2 = nfdir})
|
||||
end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
45
stairsplus/init.lua
Normal file
45
stairsplus/init.lua
Normal file
@ -0,0 +1,45 @@
|
||||
|
||||
-- Nodes will be called <modname>:{stair,slab,panel,micro}_<subname>
|
||||
|
||||
local modpath = minetest.get_modpath("moreblocks").."/stairsplus"
|
||||
|
||||
stairsplus = {}
|
||||
stairsplus.expect_infinite_stacks = false
|
||||
|
||||
if not minetest.get_modpath("unified_inventory") and
|
||||
minetest.setting_getbool("creative_mode") then
|
||||
stairsplus.expect_infinite_stacks = true
|
||||
end
|
||||
|
||||
function stairsplus:register_all(modname, subname, recipeitem, fields)
|
||||
fields = fields or {}
|
||||
fields.groups = fields.groups or {}
|
||||
if not moreblocks.config.show_stairsplus_creative_inv then
|
||||
fields.groups.not_in_creative_inventory = 1
|
||||
end
|
||||
self:register_stair(modname, subname, recipeitem, fields)
|
||||
self:register_slab (modname, subname, recipeitem, fields)
|
||||
self:register_panel(modname, subname, recipeitem, fields)
|
||||
self:register_micro(modname, subname, recipeitem, fields)
|
||||
self:register_6dfacedir_conversion(modname, subname)
|
||||
circular_saw.known_nodes[recipeitem] = {modname, subname}
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
dofile(modpath.."/conversion.lua")
|
||||
dofile(modpath.."/stairs.lua")
|
||||
dofile(modpath.."/slabs.lua")
|
||||
dofile(modpath.."/panels.lua")
|
||||
dofile(modpath.."/microblocks.lua")
|
||||
dofile(modpath.."/aliases.lua")
|
||||
dofile(modpath.."/registrations.lua")
|
||||
|
@ -1,142 +1,86 @@
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
if intllib then
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
-- Node will be called <modname>micro_<subname>
|
||||
-- Node will be called <modname>:micro_<subname>
|
||||
|
||||
function register_micro(modname, subname, recipeitem, groups, images, description, drop, light)
|
||||
return stairsplus:register_micro(modname, subname, recipeitem, {
|
||||
groups = groups,
|
||||
tiles = images,
|
||||
description = description,
|
||||
drop = drop,
|
||||
light_source = light,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node(":"..modname .. ":micro_" .. subname, {
|
||||
description = S("%s Microblock"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":micro_" .. drop,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, 0, 0.5},
|
||||
function stairsplus:register_micro(modname, subname, recipeitem, fields)
|
||||
local defs = {
|
||||
[""] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, 0, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":micro_" .. subname .. "_1", {
|
||||
description = S("%s Microblock"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":micro_" .. drop .. "_1",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
|
||||
["_1"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":micro_" .. subname .. "_2", {
|
||||
description = S("%s Microblock"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":micro_" .. drop .. "_2",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5},
|
||||
["_2"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":micro_" .. subname .. "_4", {
|
||||
description = S("%s Microblock"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":micro_" .. drop .. "_4",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5},
|
||||
["_4"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, -0.25, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":micro_" .. subname .. "_12", {
|
||||
description = S("%s Microblock"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":micro_" .. drop .. "_12",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5},
|
||||
["_12"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, 0.25, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":micro_" .. subname .. "_14", {
|
||||
description = S("%s Microblock"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":micro_" .. drop .. "_14",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5},
|
||||
["_14"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, 0.375, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":micro_" .. subname .. "_15", {
|
||||
description = S("%s Microblock"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":micro_" .. drop .. "_15",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
["_15"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0, 0.4375, 0.5},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
local desc = S("%s Microblock"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
for k, v in pairs(fields) do
|
||||
def[k] = v
|
||||
end
|
||||
def.description = desc
|
||||
if fields.drop then
|
||||
def.drop = modname..":micro_"..fields.drop..alternate
|
||||
end
|
||||
minetest.register_node(":"..modname..":micro_"..subname..alternate, def)
|
||||
end
|
||||
|
||||
minetest.register_alias(modname..":micro_"..subname.."_bottom", modname..":micro_"..subname)
|
||||
end
|
||||
|
@ -1,135 +1,87 @@
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
if intllib then
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
-- Node will be called <modname>panel_<subname>
|
||||
-- Node will be called <modname>:panel_<subname>
|
||||
|
||||
function register_panel(modname, subname, recipeitem, groups, images, description, drop, light)
|
||||
return stairsplus:register_panel(modname, subname, recipeitem, {
|
||||
groups = groups,
|
||||
tiles = images,
|
||||
description = description,
|
||||
drop = drop,
|
||||
light_source = light,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
end
|
||||
|
||||
minetest.register_node(":" .. modname .. ":panel_" .. subname, {
|
||||
description = S("%s Panel"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":panel_" .. drop,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
|
||||
|
||||
function stairsplus:register_panel(modname, subname, recipeitem, fields)
|
||||
local defs = {
|
||||
[""] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, 0, 0.5},
|
||||
},
|
||||
},
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":panel_" .. subname .. "_1", {
|
||||
description = S("%s Panel"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":panel_" .. drop .. "_1",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
|
||||
["_1"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, -0.4375, 0.5},
|
||||
},
|
||||
},
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":panel_" .. subname .. "_2", {
|
||||
description = S("%s Panel"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":panel_" .. drop .. "_2",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
|
||||
["_2"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, -0.375, 0.5},
|
||||
},
|
||||
},
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":panel_" .. subname .. "_4", {
|
||||
description = S("%s Panel"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":panel_" .. drop .. "_4",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
|
||||
["_4"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, -0.25, 0.5},
|
||||
},
|
||||
},
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":panel_" .. subname .. "_12", {
|
||||
description = S("%s Panel"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":panel_" .. drop .. "_12",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
|
||||
["_12"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, 0.25, 0.5},
|
||||
},
|
||||
},
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":panel_" .. subname .. "_14", {
|
||||
description = S("%s Panel"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":panel_" .. drop .. "_14",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
|
||||
["_14"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, 0.375, 0.5},
|
||||
},
|
||||
},
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":panel_" .. subname .. "_15", {
|
||||
description = S("%s Panel"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":panel_" .. drop .. "_15",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5},
|
||||
},
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
["_15"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, 0, 0.5, 0.4375, 0.5},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
local desc = S("%s Panel"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
for k, v in pairs(fields) do
|
||||
def[k] = v
|
||||
end
|
||||
def.description = desc
|
||||
if fields.drop then
|
||||
def.drop = modname..":panel_"..fields.drop..alternate
|
||||
end
|
||||
minetest.register_node(":"..modname..":panel_"..subname..alternate, def)
|
||||
end
|
||||
|
||||
minetest.register_alias(modname..":panel_"..subname.."_bottom", modname..":panel_"..subname)
|
||||
end
|
||||
|
45
stairsplus/registrations.lua
Normal file
45
stairsplus/registrations.lua
Normal file
@ -0,0 +1,45 @@
|
||||
-- Default stairs/slabs/panels/microblocks
|
||||
|
||||
local default_nodes = {
|
||||
"stone",
|
||||
"cobble",
|
||||
"mossycobble",
|
||||
"brick",
|
||||
"sandstone",
|
||||
"steelblock",
|
||||
"goldblock",
|
||||
"copperblock",
|
||||
"bronzeblock",
|
||||
"diamondblock",
|
||||
"desert_stone",
|
||||
"glass",
|
||||
"tree",
|
||||
"wood",
|
||||
"jungletree",
|
||||
"junglewood",
|
||||
"obsidian",
|
||||
"obsidian_glass",
|
||||
"stonebrick",
|
||||
"desert_stonebrick",
|
||||
"sandstonebrick",
|
||||
}
|
||||
|
||||
for _, name in pairs(default_nodes) do
|
||||
local nodename = "default:"..name
|
||||
local ndef = minetest.registered_nodes[nodename]
|
||||
local groups = {}
|
||||
for k, v in pairs(ndef.groups) do groups[k] = v end
|
||||
local drop
|
||||
if type(ndef.drop) == "string" then
|
||||
drop = ndef.drop:sub(9)
|
||||
end
|
||||
stairsplus:register_all("moreblocks", name, nodename, {
|
||||
description = ndef.description,
|
||||
drop = drop,
|
||||
groups = groups,
|
||||
sounds = ndef.sounds,
|
||||
tiles = ndef.tiles,
|
||||
sunlight_propagates = ndef.sunlight_propagates,
|
||||
})
|
||||
end
|
||||
|
@ -1,170 +1,96 @@
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
if intllib then
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
-- Node will be called <modname>slab_<subname>
|
||||
-- Node will be called <modname>:slab_<subname>
|
||||
|
||||
function register_slab(modname, subname, recipeitem, groups, images, description, drop, light)
|
||||
|
||||
minetest.register_node(":" .. modname .. ":slab_" .. subname, {
|
||||
description = S("%s Slab"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
return stairsplus:register_slab(modname, subname, recipeitem, {
|
||||
groups = groups,
|
||||
tiles = images,
|
||||
description = description,
|
||||
drop = drop,
|
||||
light_source = light,
|
||||
drop = modname .. ":slab_" .. drop,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":stairs:slab_" .. subname, {
|
||||
description = S("%s Slab"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
drop = modname .. ":slab_" .. drop,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":slab_" .. subname .. "_quarter", {
|
||||
description = S("%s Slab"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":slab_" .. drop .. "_quarter",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":slab_" .. subname .. "_three_quarter", {
|
||||
description = S("%s Slab"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":slab_" .. drop .. "_three_quarter",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.25, 0.5},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":slab_" .. subname .. "_1", {
|
||||
description = S("%s Slab"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":slab_" .. drop .. "_1",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":slab_" .. subname .. "_2", {
|
||||
description = S("%s Slab"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":slab_" .. drop .. "_2",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, -0.375, 0.5},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":slab_" .. subname .. "_14", {
|
||||
description = S("%s Slab"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":slab_" .. drop .. "_14",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.375, 0.5},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":slab_" .. subname .. "_15", {
|
||||
description = S("%s Slab"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":slab_" .. drop .. "_15",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0.4375, 0.5},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
-- Unregister default recipes, optional, see _config.txt
|
||||
|
||||
if allow_stair_slab_crafting == false
|
||||
then
|
||||
minetest.register_craft({
|
||||
output = "moreblocks:nothing 1",
|
||||
recipe = {
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
function stairsplus:register_slab(modname, subname, recipeitem, fields)
|
||||
local defs = {
|
||||
[""] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
},
|
||||
["_quarter"] = {
|
||||
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)
|
||||
for alternate, def in pairs(defs) do
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
for k, v in pairs(fields) do
|
||||
def[k] = v
|
||||
end
|
||||
def.description = desc
|
||||
if fields.drop then
|
||||
def.drop = modname..":slab_"..fields.drop..alternate
|
||||
end
|
||||
minetest.register_node(":"..modname..":slab_"..subname..alternate, def)
|
||||
end
|
||||
minetest.register_alias("stairs:slab_"..subname, modname..":slab_"..subname)
|
||||
|
||||
-- Unregister default recipes, optional, see config.lua
|
||||
|
||||
if not moreblocks.config.allow_stair_slab_crafting then
|
||||
minetest.register_craft({
|
||||
output = "moreblocks:nothing 1",
|
||||
recipe = {
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -1,240 +1,149 @@
|
||||
-- Load translation library if intllib is installed
|
||||
|
||||
local S
|
||||
if (minetest.get_modpath("intllib")) then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
if intllib then
|
||||
S = intllib.Getter(minetest.get_current_modname())
|
||||
else
|
||||
S = function ( s ) return s end
|
||||
else
|
||||
S = function(s) return s end
|
||||
end
|
||||
|
||||
-- Node will be called <modname>:stair_<subname>
|
||||
|
||||
function register_stair(modname, subname, recipeitem, groups, images, description, drop, light)
|
||||
|
||||
minetest.register_node(":" .. modname .. ":stair_" .. subname, {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
return stairsplus:register_stair(modname, subname, recipeitem, {
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":stairs:stair_" .. subname, {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = {cracky=3, not_in_creative_inventory=1},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":stair_" .. subname .. "_half", {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
description = description,
|
||||
drop = drop,
|
||||
light_source = light,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0, 0, 0.5},
|
||||
{-0.5, 0, 0, 0, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":stair_" .. subname .. "_right_half", {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{0, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":stair_" .. subname .. "_inner", {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":stair_" .. drop .. "_inner",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
{-0.5, 0, -0.5, 0, 0.5, 0},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":"..modname .. ":stair_" .. subname .. "_outer", {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
drop = modname .. ":stair_" .. drop .. "_outer",
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":stair_" .. subname .. "_alt", {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":stair_" .. subname .. "_alt_1", {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.0625, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0.4375, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":stair_" .. subname .. "_alt_2", {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.125, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0.375, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
minetest.register_node(":" .. modname .. ":stair_" .. subname .. "_alt_4", {
|
||||
description = S("%s Stairs"):format(S(description)),
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
light_source = light,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
sunlight_propagates = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.25, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0.25, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
on_place = stairsplus_rotate_and_place
|
||||
})
|
||||
|
||||
-- Unregister default recipes, optional, see _config.txt
|
||||
|
||||
if allow_stair_slab_crafting == false
|
||||
then
|
||||
minetest.register_craft({
|
||||
output = "moreblocks:nothing 1",
|
||||
recipe = {
|
||||
{recipeitem, "", ""},
|
||||
{recipeitem, recipeitem, ""},
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moreblocks:nothing 1",
|
||||
recipe = {
|
||||
{"", "", recipeitem},
|
||||
{"", recipeitem, recipeitem},
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
function stairsplus:register_stair(modname, subname, recipeitem, fields)
|
||||
local defs = {
|
||||
[""] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
},
|
||||
["_half"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0, 0, 0.5},
|
||||
{-0.5, 0, 0, 0, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
},
|
||||
["_right_half" ]= {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{0, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{0, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
},
|
||||
["_inner"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
{-0.5, 0, -0.5, 0, 0.5, 0},
|
||||
},
|
||||
},
|
||||
},
|
||||
["_outer"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
},
|
||||
["_alt"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
},
|
||||
["_alt_1"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.0625, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0.4375, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
},
|
||||
["_alt_2"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.125, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0.375, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
},
|
||||
["_alt_4"] = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.25, -0.5, 0.5, 0, 0},
|
||||
{-0.5, 0.25, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
local desc = S("%s Stairs"):format(fields.description)
|
||||
for alternate, def in pairs(defs) do
|
||||
def.drawtype = "nodebox"
|
||||
def.paramtype = "light"
|
||||
def.paramtype2 = "facedir"
|
||||
def.on_place = minetest.rotate_node
|
||||
for k, v in pairs(fields) do
|
||||
def[k] = v
|
||||
end
|
||||
def.description = desc
|
||||
if fields.drop then
|
||||
def.drop = modname..":stair_"..fields.drop..alternate
|
||||
end
|
||||
minetest.register_node(":"..modname..":stair_"..subname..alternate, def)
|
||||
end
|
||||
minetest.register_alias(":stairs:stair_"..subname, modname..":stair_"..subname)
|
||||
|
||||
|
||||
-- Unregister default recipes, optional, see config.lua
|
||||
|
||||
if not moreblocks.config.allow_stair_slab_crafting then
|
||||
minetest.register_craft({
|
||||
output = "moreblocks:nothing 1",
|
||||
recipe = {
|
||||
{recipeitem, "", ""},
|
||||
{recipeitem, recipeitem, ""},
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "moreblocks:nothing 1",
|
||||
recipe = {
|
||||
{"", "", recipeitem},
|
||||
{"", recipeitem, recipeitem},
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user