2017-05-18 21:32:19 +02:00
|
|
|
|
2015-09-29 20:19:14 +02:00
|
|
|
--
|
|
|
|
-- Partial blocks mod
|
|
|
|
-- By Kaadmy, for Pixture
|
|
|
|
--
|
2019-08-28 17:31:41 +02:00
|
|
|
local S = minetest.get_translator("partialblocks")
|
2015-09-29 20:19:14 +02:00
|
|
|
|
|
|
|
partialblocks = {}
|
|
|
|
|
2019-08-28 17:31:41 +02:00
|
|
|
function partialblocks.register_material(name, desc_slab, desc_stair, node, is_fuel)
|
2017-05-12 04:29:55 +02:00
|
|
|
local nodedef = minetest.registered_nodes[node]
|
2015-09-29 20:19:14 +02:00
|
|
|
|
|
|
|
if nodedef == nil then
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.log("warning", "Cannot find node for partialblock: " .. node)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
2015-09-29 20:19:14 +02:00
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Slab
|
2017-05-16 20:12:49 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2017-05-18 21:32:19 +02:00
|
|
|
"partialblocks:slab_" .. name,
|
2015-09-29 20:19:14 +02:00
|
|
|
{
|
|
|
|
tiles = nodedef.tiles,
|
|
|
|
groups = nodedef.groups,
|
|
|
|
sounds = nodedef.sounds,
|
|
|
|
|
2019-08-28 17:31:41 +02:00
|
|
|
description = desc_slab,
|
2015-09-29 20:19:14 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
|
|
|
|
node_box = {
|
2017-05-18 21:32:19 +02:00
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
2015-09-29 20:19:14 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
paramtype = "light",
|
2017-05-18 21:32:19 +02:00
|
|
|
|
|
|
|
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,
|
2017-05-16 20:12:49 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
crafting.register_craft( -- Craft to
|
2015-09-29 20:19:14 +02:00
|
|
|
{
|
2017-05-18 21:32:19 +02:00
|
|
|
output = "partialblocks:slab_" .. name,
|
2017-05-16 20:12:49 +02:00
|
|
|
items = {
|
2017-05-18 21:32:19 +02:00
|
|
|
node,
|
2015-09-29 20:19:14 +02:00
|
|
|
},
|
2017-05-16 20:12:49 +02:00
|
|
|
})
|
2015-09-29 20:19:14 +02:00
|
|
|
|
2017-05-18 21:32:19 +02:00
|
|
|
if is_fuel then
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_craft( -- Fuel
|
2015-10-04 02:07:04 +02:00
|
|
|
{
|
|
|
|
type = "fuel",
|
2017-05-18 21:32:19 +02:00
|
|
|
recipe = "partialblocks:slab_" .. name,
|
2015-10-04 02:07:04 +02:00
|
|
|
burntime = 7,
|
2017-05-16 20:12:49 +02:00
|
|
|
})
|
2015-10-04 02:07:04 +02:00
|
|
|
end
|
|
|
|
|
2015-09-29 20:19:14 +02:00
|
|
|
-- Stair
|
2017-05-16 20:12:49 +02:00
|
|
|
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_node(
|
2017-05-18 21:32:19 +02:00
|
|
|
"partialblocks:stair_" .. name,
|
2015-09-29 20:19:14 +02:00
|
|
|
{
|
|
|
|
tiles = nodedef.tiles,
|
|
|
|
groups = nodedef.groups,
|
|
|
|
sounds = nodedef.sounds,
|
|
|
|
|
2019-08-28 17:31:41 +02:00
|
|
|
description = desc_stair,
|
2015-09-29 20:19:14 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
|
|
|
|
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},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
2017-05-16 20:12:49 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
crafting.register_craft( -- Craft to
|
2015-09-29 20:19:14 +02:00
|
|
|
{
|
2017-05-18 21:32:19 +02:00
|
|
|
output = "partialblocks:stair_" .. name,
|
2017-05-16 20:12:49 +02:00
|
|
|
items = {
|
2017-05-18 21:32:19 +02:00
|
|
|
node,
|
2015-09-29 20:19:14 +02:00
|
|
|
},
|
2017-05-16 20:12:49 +02:00
|
|
|
})
|
2015-10-04 02:07:04 +02:00
|
|
|
|
2017-05-18 21:32:19 +02:00
|
|
|
if is_fuel then
|
2017-05-12 04:29:55 +02:00
|
|
|
minetest.register_craft( -- Fuel
|
2015-10-04 02:07:04 +02:00
|
|
|
{
|
|
|
|
type = "fuel",
|
2017-05-18 21:32:19 +02:00
|
|
|
recipe = "partialblocks:stair_" .. name,
|
2015-10-04 02:07:04 +02:00
|
|
|
burntime = 7,
|
2017-05-16 20:12:49 +02:00
|
|
|
})
|
2015-10-04 02:07:04 +02:00
|
|
|
end
|
2015-09-29 20:19:14 +02:00
|
|
|
end
|
|
|
|
|
2017-05-16 20:12:49 +02:00
|
|
|
-- Stonelike materials
|
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"cobble", S("Cobble Slab"), S("Cobble Stair"), "default:cobble", false)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"stone", S("Stone Slab"), S("Stone Stair"), "default:stone", false)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"brick", S("Brick Slab"), S("Brick Stair"), "default:brick", false)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
-- Woodlike
|
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"wood", S("Wooden Slab"), S("Wooden Stair"), "default:planks", true)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"oak", S("Oak Slab"), S("Oak Stair"), "default:planks_oak", true)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"birch", S("Birch Slab"), S("Birch Stair"), "default:planks_birch", true)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
-- Frames
|
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"frame", S("Frame Slab"), S("Frame Stair"), "default:frame", true)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"reinforced_frame", S("Reinforced Frame Slab"), S("Reinforced Frame Stair"), "default:reinforced_frame", true)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"reinforced_cobble", S("Reinforced Cobble Slab"), S("Reinforced Cobble Stair"), "default:reinforced_cobble", false)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
-- Misc. blocks
|
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"coal", S("Coal Slab"), S("Coal Stair"), "default:block_coal", false)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"steel", S("Steel Slab"), S("Steel Stair"), "default:block_steel", false)
|
2017-05-16 20:12:49 +02:00
|
|
|
|
|
|
|
partialblocks.register_material(
|
2019-08-28 17:31:41 +02:00
|
|
|
"compressed_sandstone", S("Compressed Sandstone Slab"), S("Compressed Sandstone Stair"), "default:compressed_sandstone", false)
|
2016-06-21 13:57:38 +02:00
|
|
|
|
|
|
|
default.log("mod:partialblocks", "loaded")
|