mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-24 00:49:34 +01:00
Add hardness support for stairs and slabs
This commit is contained in:
parent
051799bb3d
commit
ed882cd70b
2 changed files with 120 additions and 65 deletions
|
@ -614,7 +614,8 @@ function mcstair.add(name, stairtiles)
|
|||
},
|
||||
drop = drop,
|
||||
stairs = {name, name.."_outer", name.."_inner"},
|
||||
after_dig_node = function(pos, oldnode) after_dig_node(pos, oldnode) end
|
||||
after_dig_node = function(pos, oldnode) after_dig_node(pos, oldnode) end,
|
||||
_mcl_hardness = node_def._mcl_hardness,
|
||||
})
|
||||
minetest.register_node(":"..name.."_inner", {
|
||||
description = node_def.description,
|
||||
|
@ -636,7 +637,8 @@ function mcstair.add(name, stairtiles)
|
|||
},
|
||||
drop = drop,
|
||||
stairs = {name, name.."_outer", name.."_inner"},
|
||||
after_dig_node = function(pos, oldnode) after_dig_node(pos, oldnode) end
|
||||
after_dig_node = function(pos, oldnode) after_dig_node(pos, oldnode) end,
|
||||
_mcl_hardness = node_def._mcl_hardness,
|
||||
})
|
||||
end
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ stairs = {}
|
|||
-- Register stairs.
|
||||
-- Node will be called stairs:stair_<subname>
|
||||
|
||||
function stairs.register_stair(subname, recipeitem, groups, images, description, sounds)
|
||||
function stairs.register_stair(subname, recipeitem, groups, images, description, sounds, hardness)
|
||||
groups.stair = 1
|
||||
groups.building_block = 1
|
||||
minetest.register_node(":stairs:stair_" .. subname, {
|
||||
|
@ -67,6 +67,7 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
|||
|
||||
return minetest.item_place(itemstack, placer, pointed_thing, param2)
|
||||
end,
|
||||
_mcl_hardness = hardness,
|
||||
})
|
||||
|
||||
if recipeitem then
|
||||
|
@ -103,7 +104,7 @@ local slab_trans_dir_place = {[0] = 0, 20, 12, 16, 4, 8}
|
|||
-- double_description, full_node: NEW arguments, not supported in Minetest Game
|
||||
-- double_description: If set, add a separate “double slab” node. The description is the name of this new node
|
||||
-- full_node: If set, this node is used when two nodes are placed on top of each other. Use this if recipeitem is a group
|
||||
function stairs.register_slab(subname, recipeitem, groups, images, description, sounds, double_description, full_node)
|
||||
function stairs.register_slab(subname, recipeitem, groups, images, description, sounds, hardness, double_description, full_node)
|
||||
groups.slab = 1
|
||||
groups.building_block = 1
|
||||
minetest.register_node(":stairs:slab_" .. subname, {
|
||||
|
@ -185,6 +186,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
return minetest.item_place(itemstack, placer, pointed_thing, rot)
|
||||
end
|
||||
end,
|
||||
_mcl_hardness = hardness,
|
||||
})
|
||||
|
||||
-- Double slab node
|
||||
|
@ -199,6 +201,7 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
|||
groups = dgroups,
|
||||
sounds = sounds,
|
||||
drop = "stairs:slab_"..subname.." 2",
|
||||
_mcl_hardness = hardness,
|
||||
})
|
||||
end
|
||||
|
||||
|
@ -218,145 +221,195 @@ end
|
|||
-- Nodes will be called stairs:{stair,slab}_<subname>
|
||||
|
||||
function stairs.register_stair_and_slab(subname, recipeitem,
|
||||
groups, images, desc_stair, desc_slab, sounds,
|
||||
groups, images, desc_stair, desc_slab, sounds, hardness,
|
||||
double_description, full_node)
|
||||
stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds)
|
||||
stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds, double_description, full_node)
|
||||
stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds, hardness)
|
||||
stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds, hardness, double_description, full_node)
|
||||
end
|
||||
|
||||
-- Register all Minecraft stairs and slabs
|
||||
-- Note about hardness: For some reason, the hardness of slabs and stairs don't always match nicely, so that some
|
||||
-- slabs actually take slightly longer to be dug than their stair counterparts.
|
||||
-- Note sure if it is a good idea to preserve this oddity.
|
||||
|
||||
stairs.register_stair("wood", "mcl_core:wood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_stairs=1},
|
||||
{handy=1,axey=1, flammable=3,wood_stairs=1},
|
||||
{"default_wood.png"},
|
||||
"Oak Wood Stairs",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
stairs.register_slab("wood", "mcl_core:wood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_slab=1},
|
||||
{handy=1,axey=1, flammable=3,wood_slab=1},
|
||||
{"default_wood.png"},
|
||||
"Oak Wood Slab",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
|
||||
stairs.register_stair("junglewood", "mcl_core:junglewood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_stairs=1},
|
||||
{handy=1,axey=1, flammable=3,wood_stairs=1},
|
||||
{"default_junglewood.png"},
|
||||
"Jungle Wood Stairs",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
stairs.register_slab("junglewood", "mcl_core:junglewood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_slab=1},
|
||||
{handy=1,axey=1, flammable=3,wood_slab=1},
|
||||
{"default_junglewood.png"},
|
||||
"Jungle Wood Slab",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
|
||||
stairs.register_stair("acaciawood", "mcl_core:acaciawood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_stairs=1},
|
||||
{handy=1,axey=1, flammable=3,wood_stairs=1},
|
||||
{"default_acaciawood.png"},
|
||||
"Acacia Wood Stairs",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
|
||||
stairs.register_slab("acaciawood", "mcl_core:acaciawood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_slab=1},
|
||||
{handy=1,axey=1, flammable=3,wood_slab=1},
|
||||
{"default_acaciawood.png"},
|
||||
"Acacia Wood Slab",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
|
||||
stairs.register_stair("sprucewood", "mcl_core:sprucewood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_stairs=1},
|
||||
{handy=1,axey=1, flammable=3,wood_stairs=1},
|
||||
{"default_sprucewood.png"},
|
||||
"Spruce Wood Stairs",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
stairs.register_slab("sprucewood", "mcl_core:sprucewood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_slab=1},
|
||||
{handy=1,axey=1, flammable=3,wood_slab=1},
|
||||
{"default_sprucewood.png"},
|
||||
"Spruce Wood Slab",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
|
||||
stairs.register_stair("birchwood", "mcl_core:birchwood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_stairs=1},
|
||||
{handy=1,axey=1, flammable=3,wood_stairs=1},
|
||||
{"default_planks_birch.png"},
|
||||
"Birch Wood Stairs",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
stairs.register_slab("birchwood", "mcl_core:birchwood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_slab=1},
|
||||
{handy=1,axey=1, flammable=3,wood_slab=1},
|
||||
{"default_planks_birch.png"},
|
||||
"Birch Wood Slab",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
|
||||
stairs.register_stair("darkwood", "mcl_core:darkwood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_stairs=1},
|
||||
{handy=1,axey=1, flammable=3,wood_stairs=1},
|
||||
{"default_planks_big_oak.png"},
|
||||
"Dark Oak Wood Stairs",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
stairs.register_slab("darkwood", "mcl_core:darkwood",
|
||||
{snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3,wood_slab=1},
|
||||
{handy=1,axey=1, flammable=3,wood_slab=1},
|
||||
{"default_planks_big_oak.png"},
|
||||
"Dark Oak Wood Slab",
|
||||
mcl_sounds.node_sound_wood_defaults())
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
|
||||
stairs.register_slab("stone", "mcl_core:stone",
|
||||
{cracky=3},
|
||||
{pickaxey=1},
|
||||
{"stairs_stone_slab_top.png", "stairs_stone_slab_top.png", "stairs_stone_slab_side.png"},
|
||||
"Stone Slab",
|
||||
mcl_sounds.node_sound_stone_defaults(), "Double Stone Slab")
|
||||
mcl_sounds.node_sound_stone_defaults(), 2, "Double Stone Slab")
|
||||
|
||||
stairs.register_stair_and_slab("cobble", "mcl_core:cobble",
|
||||
{cracky=3},
|
||||
{pickaxey=1},
|
||||
{"default_cobble.png"},
|
||||
"Cobblestone Stairs",
|
||||
"Cobblestone Slab",
|
||||
mcl_sounds.node_sound_stone_defaults())
|
||||
mcl_sounds.node_sound_stone_defaults(), 2)
|
||||
|
||||
stairs.register_stair_and_slab("brick_block", "mcl_core:brick_block",
|
||||
{cracky=3},
|
||||
{pickaxey=1},
|
||||
{"default_brick.png"},
|
||||
"Brick Stairs",
|
||||
"Brick Slab",
|
||||
mcl_sounds.node_sound_stone_defaults())
|
||||
mcl_sounds.node_sound_stone_defaults(), 2)
|
||||
|
||||
stairs.register_stair_and_slab("sandstone", "group:sandstone",
|
||||
{crumbly=2,cracky=2},
|
||||
|
||||
stairs.register_stair("sprucewood", "mcl_core:sprucewood",
|
||||
{handy=1,axey=1, flammable=3,wood_stairs=1},
|
||||
{"default_sprucewood.png"},
|
||||
"Spruce Wood Stairs",
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
stairs.register_slab("sprucewood", "mcl_core:sprucewood",
|
||||
{handy=1,axey=1, flammable=3,wood_slab=1},
|
||||
{"default_sprucewood.png"},
|
||||
"Spruce Wood Slab",
|
||||
mcl_sounds.node_sound_wood_defaults(),
|
||||
2)
|
||||
|
||||
|
||||
stairs.register_stair("sandstone", "group:sandstone",
|
||||
{pickaxey=1},
|
||||
{"default_sandstone_top.png", "default_sandstone_bottom.png", "default_sandstone_normal.png"},
|
||||
"Sandstone Stairs",
|
||||
mcl_sounds.node_sound_stone_defaults(), 0.8, nil, "mcl_core:sandstone")
|
||||
stairs.register_slab("sandstone", "group:sandstone",
|
||||
{pickaxey=1},
|
||||
{"default_sandstone_top.png", "default_sandstone_bottom.png", "default_sandstone_normal.png"},
|
||||
"Sandstone Slab",
|
||||
mcl_sounds.node_sound_stone_defaults(), "mcl_core:sandstone")
|
||||
mcl_sounds.node_sound_stone_defaults(), 2, nil, "mcl_core:sandstone")
|
||||
|
||||
stairs.register_stair_and_slab("redsandstone", "group:redsandstone",
|
||||
{crumbly=2,cracky=2},
|
||||
stairs.register_stair("redsandstone", "group:redsandstone",
|
||||
{pickaxey=1},
|
||||
{"default_redsandstone_top.png", "default_redsandstone_bottom.png", "default_redsandstone_normal.png"},
|
||||
"Red Sandstone Stairs",
|
||||
mcl_sounds.node_sound_stone_defaults(), 0.8, nil, "mcl_core:redsandstone")
|
||||
stairs.register_slab("redsandstone", "group:redsandstone",
|
||||
{pickaxey=1},
|
||||
{"default_redsandstone_top.png", "default_redsandstone_bottom.png", "default_redsandstone_normal.png"},
|
||||
"Red Sandstone Slab",
|
||||
mcl_sounds.node_sound_stone_defaults(), nil, "mcl_core:redsandstone")
|
||||
mcl_sounds.node_sound_stone_defaults(), 2, nil, "mcl_core:redsandstone")
|
||||
|
||||
stairs.register_stair_and_slab("stonebrick", "group:stonebrick",
|
||||
{cracky=3},
|
||||
stairs.register_stair("stonebrick", "group:stonebrick",
|
||||
{pickaxey=1},
|
||||
{"default_stone_brick.png"},
|
||||
"Stone Bricks Stairs",
|
||||
mcl_sounds.node_sound_stone_defaults(), 1.5, nil, "mcl_core:stonebrick")
|
||||
stairs.register_slab("stonebrick", "group:stonebrick",
|
||||
{pickaxey=1},
|
||||
{"default_stone_brick.png"},
|
||||
"Stone Bricks Slab",
|
||||
mcl_sounds.node_sound_stone_defaults(), nil, "mcl_core:stonebrick"
|
||||
)
|
||||
mcl_sounds.node_sound_stone_defaults(), 2, nil, "mcl_core:stonebrick")
|
||||
|
||||
stairs.register_stair_and_slab("quartzblock", "group:quartz_block",
|
||||
{cracky=3},
|
||||
{"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"},
|
||||
"Quartz Stairs",
|
||||
"Quartz Slab",
|
||||
mcl_sounds.node_sound_stone_defaults(), nil, "mcl_nether:quartz_block"
|
||||
)
|
||||
stairs.register_stair("quartzblock", "group:quartz_block",
|
||||
{pickaxey=1},
|
||||
{"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"},
|
||||
"Quartz Stairs",
|
||||
mcl_sounds.node_sound_stone_defaults(), 0.8, nil, "mcl_nether:quartz_block")
|
||||
stairs.register_slab("quartzblock", "group:quartz_block",
|
||||
{pickaxey=1},
|
||||
{"mcl_nether_quartz_block_top.png", "mcl_nether_quartz_block_bottom.png", "mcl_nether_quartz_block_side.png"},
|
||||
"Quartz Slab",
|
||||
mcl_sounds.node_sound_stone_defaults(), 2, nil, "mcl_nether:quartz_block")
|
||||
|
||||
stairs.register_stair_and_slab("nether_brick", "mcl_nether:nether_brick",
|
||||
{cracky=2},
|
||||
{"mcl_nether_nether_brick.png"},
|
||||
"Nether Brick Stairs",
|
||||
"Nether Brick Slab",
|
||||
mcl_sounds.node_sound_stone_defaults()
|
||||
)
|
||||
{pickaxey=1},
|
||||
{"mcl_nether_nether_brick.png"},
|
||||
"Nether Brick Stairs",
|
||||
"Nether Brick Slab",
|
||||
mcl_sounds.node_sound_stone_defaults(),
|
||||
2)
|
||||
|
||||
stairs.register_stair_and_slab("purpur_block", "mcl_end:purpur_block",
|
||||
{cracky=3},
|
||||
stairs.register_stair("purpur_block", "mcl_end:purpur_block",
|
||||
{pickaxey=1},
|
||||
{"mcl_end_purpur_block.png"},
|
||||
"Purpur Stairs",
|
||||
mcl_sounds.node_sound_stone_defaults(),
|
||||
1.5)
|
||||
stairs.register_slab("purpur_block", "mcl_end:purpur_block",
|
||||
{pickaxey=1},
|
||||
{"mcl_end_purpur_block.png"},
|
||||
"Purpur Slab",
|
||||
mcl_sounds.node_sound_stone_defaults()
|
||||
)
|
||||
mcl_sounds.node_sound_stone_defaults(),
|
||||
2)
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'mcl_core:sandstonecarved',
|
||||
|
|
Loading…
Reference in a new issue