Modify partialblocks API a bit; make slabs join into the full block. WARNING: NOT BACKWARDS COMPATIBLE, NODE NAMES CHANGED
This commit is contained in:
parent
9f5ee3bad6
commit
10d36bc643
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
--
|
--
|
||||||
-- Partial blocks mod
|
-- Partial blocks mod
|
||||||
-- By Kaadmy, for Pixture
|
-- By Kaadmy, for Pixture
|
||||||
@ -5,7 +6,7 @@
|
|||||||
|
|
||||||
partialblocks = {}
|
partialblocks = {}
|
||||||
|
|
||||||
function partialblocks.register_material(name, desc, node, can_burn)
|
function partialblocks.register_material(name, desc, node, is_fuel)
|
||||||
local nodedef = minetest.registered_nodes[node]
|
local nodedef = minetest.registered_nodes[node]
|
||||||
|
|
||||||
if nodedef == nil then
|
if nodedef == nil then
|
||||||
@ -17,39 +18,47 @@ function partialblocks.register_material(name, desc, node, can_burn)
|
|||||||
-- Slab
|
-- Slab
|
||||||
|
|
||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
"partialblocks:" .. name .. "_slab",
|
"partialblocks:slab_" .. name,
|
||||||
{
|
{
|
||||||
tiles = nodedef.tiles,
|
tiles = nodedef.tiles,
|
||||||
groups = nodedef.groups,
|
groups = nodedef.groups,
|
||||||
sounds = nodedef.sounds,
|
sounds = nodedef.sounds,
|
||||||
|
|
||||||
description = desc .. " slab",
|
description = desc .. " Slab",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
|
||||||
node_box = {
|
node_box = {
|
||||||
type = "wallmounted",
|
type = "fixed",
|
||||||
wall_top = {-0.5, 0, -0.5, 0.5, 0.5, 0.5},
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||||
wall_side = {-0.5, -0.5, -0.5, 0, 0.5, 0.5},
|
|
||||||
wall_bottom = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "wallmounted",
|
|
||||||
|
on_rightclick = function(pos, _, _, itemstack, _)
|
||||||
|
if minetest.get_node(pos).name == itemstack:get_name()
|
||||||
|
and itemstack:get_count() >= 1 then
|
||||||
|
minetest.set_node(pos, {name = node})
|
||||||
|
|
||||||
|
itemstack:take_item()
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
crafting.register_craft( -- Craft to
|
crafting.register_craft( -- Craft to
|
||||||
{
|
{
|
||||||
output = "partialblocks:" .. name .. "_slab 3",
|
output = "partialblocks:slab_" .. name,
|
||||||
items = {
|
items = {
|
||||||
node .. " 3",
|
node,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if can_burn then
|
if is_fuel then
|
||||||
minetest.register_craft( -- Fuel
|
minetest.register_craft( -- Fuel
|
||||||
{
|
{
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "partialblocks:" .. name .. "_slab",
|
recipe = "partialblocks:slab_" .. name,
|
||||||
burntime = 7,
|
burntime = 7,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
@ -57,13 +66,13 @@ function partialblocks.register_material(name, desc, node, can_burn)
|
|||||||
-- Stair
|
-- Stair
|
||||||
|
|
||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
"partialblocks:" .. name .. "_stair",
|
"partialblocks:stair_" .. name,
|
||||||
{
|
{
|
||||||
tiles = nodedef.tiles,
|
tiles = nodedef.tiles,
|
||||||
groups = nodedef.groups,
|
groups = nodedef.groups,
|
||||||
sounds = nodedef.sounds,
|
sounds = nodedef.sounds,
|
||||||
|
|
||||||
description = desc .. " stair",
|
description = desc .. " Stair",
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
|
|
||||||
node_box = {
|
node_box = {
|
||||||
@ -80,17 +89,17 @@ function partialblocks.register_material(name, desc, node, can_burn)
|
|||||||
|
|
||||||
crafting.register_craft( -- Craft to
|
crafting.register_craft( -- Craft to
|
||||||
{
|
{
|
||||||
output = "partialblocks:" .. name .. "_stair 6",
|
output = "partialblocks:stair_" .. name,
|
||||||
items = {
|
items = {
|
||||||
node .. " 6",
|
node,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
if can_burn then
|
if is_fuel then
|
||||||
minetest.register_craft( -- Fuel
|
minetest.register_craft( -- Fuel
|
||||||
{
|
{
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = "partialblocks:" .. name .. "_stair",
|
recipe = "partialblocks:stair_" .. name,
|
||||||
burntime = 7,
|
burntime = 7,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user