2020-05-24 15:46:26 +02:00
|
|
|
local S = minetest.get_translator("testnodes")
|
|
|
|
|
|
|
|
-- Nodebox examples and tests.
|
|
|
|
|
|
|
|
-- An simple example nodebox with one centered box
|
|
|
|
minetest.register_node("testnodes:nodebox_fixed", {
|
2022-10-09 14:05:22 +02:00
|
|
|
description = S("Fixed Nodebox Test Node").."\n"..
|
|
|
|
S("Nodebox is always the same"),
|
2020-05-24 15:46:26 +02:00
|
|
|
tiles = {"testnodes_nodebox.png"},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.25, -0.25, -0.25, 0.25, 0.25, 0.25},
|
|
|
|
},
|
|
|
|
|
|
|
|
groups = {dig_immediate=3},
|
|
|
|
})
|
|
|
|
|
|
|
|
-- 50% higher than a regular node
|
|
|
|
minetest.register_node("testnodes:nodebox_overhigh", {
|
2020-12-10 20:59:24 +01:00
|
|
|
description = S("+50% high Nodebox Test Node"),
|
2020-05-24 15:46:26 +02:00
|
|
|
tiles = {"testnodes_nodebox.png"},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, 1, 0.5},
|
|
|
|
},
|
|
|
|
|
|
|
|
groups = {dig_immediate=3},
|
|
|
|
})
|
|
|
|
|
2020-12-10 20:59:24 +01:00
|
|
|
-- 95% higher than a regular node
|
2020-05-24 15:46:26 +02:00
|
|
|
minetest.register_node("testnodes:nodebox_overhigh2", {
|
2020-12-10 20:59:24 +01:00
|
|
|
description = S("+95% high Nodebox Test Node"),
|
2020-05-24 15:46:26 +02:00
|
|
|
tiles = {"testnodes_nodebox.png"},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
2020-12-10 20:59:24 +01:00
|
|
|
-- Y max: more is possible, but glitchy
|
|
|
|
fixed = {-0.5, -0.5, -0.5, 0.5, 1.45, 0.5},
|
2020-05-24 15:46:26 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
groups = {dig_immediate=3},
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Height of nodebox changes with its param2 value
|
|
|
|
minetest.register_node("testnodes:nodebox_leveled", {
|
2022-10-09 14:05:22 +02:00
|
|
|
description = S("Leveled Nodebox Test Node").."\n"..
|
|
|
|
S("param2 = height (0..127)"),
|
2022-10-09 16:50:35 +02:00
|
|
|
tiles = {"testnodes_nodebox.png^[colorize:#0F0:32"},
|
2020-05-24 15:46:26 +02:00
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "leveled",
|
|
|
|
node_box = {
|
|
|
|
type = "leveled",
|
|
|
|
fixed = {-0.5, 0.0, -0.5, 0.5, -0.499, 0.5},
|
|
|
|
},
|
|
|
|
|
|
|
|
groups = {dig_immediate=3},
|
|
|
|
})
|
|
|
|
|
2022-09-16 13:18:55 +02:00
|
|
|
|
|
|
|
local nodebox_wall = {
|
|
|
|
type = "connected",
|
|
|
|
fixed = {-0.125, -0.500, -0.125, 0.125, 0.500, 0.125},
|
|
|
|
connect_front = {-0.125, -0.500, -0.500, 0.125, 0.400, -0.125},
|
|
|
|
connect_back = {-0.125, -0.500, 0.125, 0.125, 0.400, 0.500},
|
|
|
|
connect_left = {-0.500, -0.500, -0.125, -0.125, 0.400, 0.125},
|
|
|
|
connect_right = {0.125, -0.500, -0.125, 0.500, 0.400, 0.125},
|
|
|
|
}
|
|
|
|
|
2023-10-29 16:30:03 +01:00
|
|
|
local nodebox_cable = {
|
|
|
|
type = "connected",
|
|
|
|
fixed = {-2/16, -2/16, -2/16, 2/16, 2/16, 2/16},
|
|
|
|
connect_front = {-1/16, -1/16, -8/16, 1/16, 1/16, -2/16},
|
|
|
|
connect_back = {-1/16, -1/16, 2/16, 1/16, 1/16, 8/16},
|
|
|
|
connect_left = {-8/16, -1/16, -1/16, -2/16, 1/16, 1/16},
|
|
|
|
connect_right = { 2/16, -1/16, -1/16, 8/16, 1/16, 1/16},
|
|
|
|
connect_bottom = {-1/16, -8/16, -1/16, 1/16, -2/16, 1/16},
|
|
|
|
connect_top = {-1/16, 2/16, -1/16, 1/16, 8/16, 1/16},
|
|
|
|
}
|
|
|
|
|
2022-09-16 13:18:55 +02:00
|
|
|
local nodebox_wall_thick = {
|
|
|
|
type = "connected",
|
|
|
|
fixed = {-0.25, -0.500, -0.25, 0.25, 0.500, 0.25},
|
|
|
|
connect_front = {-0.25, -0.500, -0.500, 0.25, 0.400, -0.25},
|
|
|
|
connect_back = {-0.25, -0.500, 0.25, 0.25, 0.400, 0.500},
|
|
|
|
connect_left = {-0.500, -0.500, -0.25, -0.25, 0.400, 0.25},
|
|
|
|
connect_right = {0.25, -0.500, -0.25, 0.500, 0.400, 0.25},
|
|
|
|
}
|
|
|
|
|
2023-10-29 16:30:03 +01:00
|
|
|
-- Wall-like nodebox that connects to 4 neighbors
|
2020-05-24 15:46:26 +02:00
|
|
|
minetest.register_node("testnodes:nodebox_connected", {
|
2023-10-29 16:30:03 +01:00
|
|
|
description = S("Connected Nodebox Test Node (4 Side Wall)").."\n"..
|
|
|
|
S("Connects to 4 neighbors sideways"),
|
2022-10-09 16:50:35 +02:00
|
|
|
tiles = {"testnodes_nodebox.png^[colorize:#F00:32"},
|
2020-05-24 15:46:26 +02:00
|
|
|
groups = {connected_nodebox=1, dig_immediate=3},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
connects_to = {"group:connected_nodebox"},
|
|
|
|
connect_sides = {"front", "back", "left", "right"},
|
2022-09-16 13:18:55 +02:00
|
|
|
node_box = nodebox_wall,
|
|
|
|
})
|
|
|
|
|
2023-10-29 16:30:03 +01:00
|
|
|
-- Cable-like nodebox that connects to 6 neighbors
|
|
|
|
minetest.register_node("testnodes:nodebox_connected_6side", {
|
|
|
|
description = S("Connected Nodebox Test Node (6 Side Cable)").."\n"..
|
|
|
|
S("Connects to 6 neighbors"),
|
|
|
|
tiles = {"testnodes_nodebox.png^[colorize:#F00:32"},
|
|
|
|
groups = {connected_nodebox=1, dig_immediate=3},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
connects_to = {"group:connected_nodebox"},
|
|
|
|
connect_sides = {"front", "back", "left", "right", "top", "bottom"},
|
|
|
|
node_box = nodebox_cable,
|
|
|
|
})
|
|
|
|
|
|
|
|
-- More walls
|
2022-09-16 13:18:55 +02:00
|
|
|
minetest.register_node("testnodes:nodebox_connected_facedir", {
|
2023-10-29 16:30:03 +01:00
|
|
|
description = S("Facedir Connected Nodebox Test Node (4 Side Wall)").."\n"..
|
2022-10-09 14:05:22 +02:00
|
|
|
S("Connects to neighbors").."\n"..
|
|
|
|
S("param2 = facedir rotation of textures (not of the nodebox!)"),
|
2022-09-16 13:18:55 +02:00
|
|
|
tiles = {
|
|
|
|
"testnodes_1.png",
|
|
|
|
"testnodes_2.png",
|
|
|
|
"testnodes_3.png",
|
|
|
|
"testnodes_4.png",
|
|
|
|
"testnodes_5.png",
|
|
|
|
"testnodes_6.png",
|
2020-05-24 15:46:26 +02:00
|
|
|
},
|
2022-09-16 13:18:55 +02:00
|
|
|
groups = {connected_nodebox=1, dig_immediate=3},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
connects_to = {"group:connected_nodebox"},
|
|
|
|
connect_sides = {"front", "back", "left", "right"},
|
|
|
|
node_box = nodebox_wall_thick,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("testnodes:nodebox_connected_4dir", {
|
2022-10-09 14:05:22 +02:00
|
|
|
description = S("4Dir Connected Nodebox Test Node").."\n"..
|
|
|
|
S("Connects to neighbors").."\n"..
|
|
|
|
S("param2 = 4dir rotation of textures (not of the nodebox!)"),
|
2022-09-16 13:18:55 +02:00
|
|
|
tiles = {
|
2022-10-09 16:19:42 +02:00
|
|
|
"testnodes_1f.png",
|
|
|
|
"testnodes_2f.png",
|
|
|
|
"testnodes_3f.png",
|
|
|
|
"testnodes_4f.png",
|
|
|
|
"testnodes_5f.png",
|
|
|
|
"testnodes_6f.png",
|
2022-09-16 13:18:55 +02:00
|
|
|
},
|
|
|
|
groups = {connected_nodebox=1, dig_immediate=3},
|
|
|
|
drawtype = "nodebox",
|
|
|
|
paramtype = "light",
|
|
|
|
paramtype2 = "4dir",
|
|
|
|
connects_to = {"group:connected_nodebox"},
|
|
|
|
connect_sides = {"front", "back", "left", "right"},
|
|
|
|
node_box = nodebox_wall_thick,
|
2020-05-24 15:46:26 +02:00
|
|
|
})
|
|
|
|
|
2023-10-29 16:30:03 +01:00
|
|
|
-- Doesn't connect, but lets other nodes connect
|
|
|
|
minetest.register_node("testnodes:facedir_to_connect_to", {
|
|
|
|
description = S("Facedir Node that connected Nodeboxes connect to").."\n"..
|
|
|
|
S("Neighbors connect only to left (blue 4) and top (yellow 1) face").."\n"..
|
|
|
|
S("(Currently broken for param2 >= 4, see FIXME in nodedef.cpp)").."\n"..
|
|
|
|
S("param2 = facedir"),
|
|
|
|
tiles = {
|
|
|
|
"testnodes_1.png",
|
|
|
|
"testnodes_2.png",
|
|
|
|
"testnodes_3.png",
|
|
|
|
"testnodes_4.png",
|
|
|
|
"testnodes_5.png",
|
|
|
|
"testnodes_6.png",
|
|
|
|
},
|
|
|
|
groups = {connected_nodebox=1, dig_immediate=3},
|
|
|
|
drawtype = "normal",
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
connect_sides = {"left", "top"},
|
|
|
|
})
|