forked from mtcontrib/homedecor_modpack
Building Blocks moreblocks and stairs
Simplify integration moreblocks Replace bb stairs by Stairs
This commit is contained in:
parent
c786e3ae05
commit
6c9da755f3
@ -1,3 +1,4 @@
|
||||
default
|
||||
homedecor_i18n
|
||||
moreblocks?
|
||||
stairs?
|
||||
|
@ -1,14 +1,52 @@
|
||||
|
||||
local S = homedecor_i18n.gettext
|
||||
|
||||
minetest.register_node("building_blocks:adobe", {
|
||||
local function building_blocks_stairs(nodename, def)
|
||||
minetest.register_node(nodename, def)
|
||||
if minetest.get_modpath("moreblocks") or minetest.get_modpath("stairs") then
|
||||
local mod, name = nodename:match("(.*):(.*)")
|
||||
for groupname,value in pairs(def.groups) do
|
||||
if groupname ~= "cracky" and
|
||||
groupname ~= "choppy" and
|
||||
groupname ~="flammable" and
|
||||
groupname ~="crumbly" and
|
||||
groupname ~="snappy"
|
||||
then
|
||||
def.groups.groupname = nil
|
||||
end
|
||||
end
|
||||
|
||||
if minetest.get_modpath("moreblocks") then
|
||||
stairsplus:register_all(
|
||||
mod,
|
||||
name,
|
||||
nodename,
|
||||
{
|
||||
description = def.description,
|
||||
tiles = def.tiles,
|
||||
groups = def.groups,
|
||||
sounds = def.sounds,
|
||||
}
|
||||
)
|
||||
else
|
||||
stairs.register_stair_and_slab(name,nodename,
|
||||
def.groups,
|
||||
def.tiles,
|
||||
("%s Stair"):format(def.description),
|
||||
("%s Slab"):format(def.description),
|
||||
def.sounds
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
building_blocks_stairs("building_blocks:adobe", {
|
||||
tiles = {"building_blocks_Adobe.png"},
|
||||
description = S("Adobe"),
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
minetest.register_node("building_blocks:roofing", {
|
||||
building_blocks_stairs("building_blocks:roofing", {
|
||||
tiles = {"building_blocks_Roofing.png"},
|
||||
is_ground_content = true,
|
||||
description = S("Roof block"),
|
||||
@ -162,7 +200,7 @@ minetest.register_node("building_blocks:smoothglass", {
|
||||
groups = {snappy=3,cracky=3,oddly_breakable_by_hand=3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
minetest.register_node("building_blocks:grate", {
|
||||
building_blocks_stairs("building_blocks:grate", {
|
||||
drawtype = "glasslike",
|
||||
description = S("Grate"),
|
||||
tiles = {"building_blocks_grate.png"},
|
||||
@ -293,7 +331,7 @@ minetest.register_node("building_blocks:gravel_spread", {
|
||||
dug = {name="default_gravel_footstep", gain=1.0},
|
||||
}),
|
||||
})
|
||||
minetest.register_node("building_blocks:hardwood", {
|
||||
building_blocks_stairs("building_blocks:hardwood", {
|
||||
tiles = {"building_blocks_hardwood.png"},
|
||||
is_ground_content = true,
|
||||
description = S("Hardwood"),
|
||||
@ -302,43 +340,6 @@ minetest.register_node("building_blocks:hardwood", {
|
||||
})
|
||||
|
||||
if minetest.get_modpath("moreblocks") then
|
||||
|
||||
stairsplus:register_all(
|
||||
"building_blocks",
|
||||
"marble",
|
||||
"building_blocks:Marble",
|
||||
{
|
||||
description = S("Marble"),
|
||||
tiles = {"building_blocks_marble.png"},
|
||||
groups = {cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
}
|
||||
)
|
||||
stairsplus:register_all(
|
||||
"building_blocks",
|
||||
"hardwood",
|
||||
"building_blocks:hardwood",
|
||||
{
|
||||
description = S("Hardwood"),
|
||||
tiles = {"building_blocks_hardwood.png"},
|
||||
groups = {choppy=1,flammable=1},
|
||||
sounds = default.node_sound_wood_defaults(),
|
||||
}
|
||||
)
|
||||
stairsplus:register_all(
|
||||
"building_blocks",
|
||||
"fakegrass",
|
||||
"building_blocks:fakegrass",
|
||||
{
|
||||
description = S("Grass"),
|
||||
tiles = {"default_grass.png"},
|
||||
groups = {crumbly=3},
|
||||
sounds = default.node_sound_dirt_defaults({
|
||||
footstep = {name="default_grass_footstep", gain=0.4},
|
||||
}),
|
||||
}
|
||||
)
|
||||
|
||||
for _, i in ipairs(stairsplus.shapes_list) do
|
||||
local class = i[1]
|
||||
local cut = i[2]
|
||||
@ -348,168 +349,6 @@ if minetest.get_modpath("moreblocks") then
|
||||
end
|
||||
minetest.unregister_item("moreblocks:tar")
|
||||
minetest.register_alias("moreblocks:tar", "building_blocks:tar")
|
||||
|
||||
stairsplus:register_all(
|
||||
"building_blocks",
|
||||
"tar",
|
||||
"building_blocks:Tar",
|
||||
{
|
||||
description = S("Tar"),
|
||||
tiles = {"building_blocks_tar.png"},
|
||||
groups = {crumbly=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
}
|
||||
)
|
||||
|
||||
stairsplus:register_all(
|
||||
"building_blocks",
|
||||
"grate",
|
||||
"building_blocks:grate",
|
||||
{
|
||||
description = S("Grate"),
|
||||
tiles = {"building_blocks_grate.png"},
|
||||
groups = {cracky=1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
}
|
||||
)
|
||||
stairsplus:register_all(
|
||||
"building_blocks",
|
||||
"Adobe",
|
||||
"building_blocks:Adobe",
|
||||
{
|
||||
description = S("Adobe"),
|
||||
tiles = {"building_blocks_Adobe.png"},
|
||||
groups = {crumbly=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
}
|
||||
)
|
||||
stairsplus:register_all(
|
||||
"building_blocks",
|
||||
"Roofing",
|
||||
"building_blocks:Roofing",
|
||||
{
|
||||
description = S("Roofing"),
|
||||
tiles = {"building_blocks_Roofing.png"},
|
||||
groups = {snappy=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
}
|
||||
)
|
||||
else
|
||||
bb_stairs = {}
|
||||
|
||||
-- Node will be called stairs:stair_<subname>
|
||||
function bb_stairs.register_stair(subname, recipeitem, groups, images, description)
|
||||
minetest.register_node("building_blocks:stair_" .. subname, {
|
||||
description = description,
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = 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},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'building_blocks:stair_' .. subname .. ' 4',
|
||||
recipe = {
|
||||
{recipeitem, "", ""},
|
||||
{recipeitem, recipeitem, ""},
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
|
||||
-- Flipped recipe for the silly minecrafters
|
||||
minetest.register_craft({
|
||||
output = 'building_blocks:stair_' .. subname .. ' 4',
|
||||
recipe = {
|
||||
{"", "", recipeitem},
|
||||
{"", recipeitem, recipeitem},
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
-- Node will be called stairs:slab_<subname>
|
||||
function bb_stairs.register_slab(subname, recipeitem, groups, images, description)
|
||||
minetest.register_node("building_blocks:slab_" .. subname, {
|
||||
description = description,
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
paramtype = "light",
|
||||
is_ground_content = true,
|
||||
groups = groups,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'building_blocks:slab_' .. subname .. ' 3',
|
||||
recipe = {
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
-- Nodes will be called stairs:{stair,slab}_<subname>
|
||||
function bb_stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab)
|
||||
bb_stairs.register_stair(subname, recipeitem, groups, images, desc_stair)
|
||||
bb_stairs.register_slab(subname, recipeitem, groups, images, desc_slab)
|
||||
end
|
||||
bb_stairs.register_stair_and_slab("marble","building_blocks:Marble",
|
||||
{cracky=3},
|
||||
{"building_blocks_marble.png"},
|
||||
S("Marble stair"),
|
||||
S("Marble slab")
|
||||
)
|
||||
bb_stairs.register_stair_and_slab("hardwood","building_blocks:hardwood",
|
||||
{choppy=1,flammable=1},
|
||||
{"building_blocks_hardwood.png"},
|
||||
S("Hardwood stair"),
|
||||
S("Hardwood slab")
|
||||
)
|
||||
bb_stairs.register_stair_and_slab("fakegrass","building_blocks:fakegrass",
|
||||
{crumbly=3},
|
||||
{"default_grass.png"},
|
||||
S("Grass stair"),
|
||||
S("Grass slab")
|
||||
)
|
||||
bb_stairs.register_stair_and_slab("tar","building_blocks:Tar",
|
||||
{crumbly=1},
|
||||
{"building_blocks_tar.png"},
|
||||
S("Tar stair"),
|
||||
S("Tar slab")
|
||||
)
|
||||
bb_stairs.register_stair_and_slab("grate","building_blocks:grate",
|
||||
{cracky=1},
|
||||
{"building_blocks_grate.png"},
|
||||
S("Grate Stair"),
|
||||
S("Grate Slab")
|
||||
)
|
||||
bb_stairs.register_stair_and_slab("Adobe", "building_blocks:Adobe",
|
||||
{crumbly=3},
|
||||
{"building_blocks_Adobe.png"},
|
||||
S("Adobe stair"),
|
||||
S("Adobe slab")
|
||||
)
|
||||
bb_stairs.register_stair_and_slab("Roofing", "building_blocks:Roofing",
|
||||
{snappy=3},
|
||||
{"building_blocks_Roofing.png"},
|
||||
S("Roofing stair"),
|
||||
S("Roofing slab")
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
@ -519,7 +358,7 @@ minetest.register_craft({
|
||||
burntime = 28,
|
||||
})
|
||||
|
||||
minetest.register_node("building_blocks:fakegrass", {
|
||||
building_blocks_stairs("building_blocks:fakegrass", {
|
||||
tiles = {"default_grass.png", "default_dirt.png", "default_dirt.png^default_grass_side.png"},
|
||||
description = S("Fake Grass"),
|
||||
is_ground_content = true,
|
||||
@ -564,14 +403,14 @@ minetest.register_alias("building_blocks:Roofing", "building_blocks:roofing")
|
||||
minetest.register_alias("building_blocks:Tar", "building_blocks:tar")
|
||||
minetest.register_alias("building_blocks:Marble", "building_blocks:marble")
|
||||
|
||||
minetest.register_node("building_blocks:tar", {
|
||||
building_blocks_stairs("building_blocks:tar", {
|
||||
description = S("Tar"),
|
||||
tiles = {"building_blocks_tar.png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=1, tar_block = 1},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
minetest.register_node("building_blocks:marble", {
|
||||
building_blocks_stairs("building_blocks:marble", {
|
||||
description = S("Marble"),
|
||||
tiles = {"building_blocks_marble.png"},
|
||||
is_ground_content = true,
|
||||
|
Loading…
Reference in New Issue
Block a user