Skip to content

Commit

Permalink
Add docs+tests for facedir/4dir connected nodebox
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuzzy2 committed Jan 10, 2022
1 parent 9fd5952 commit 6e389be
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 7 deletions.
2 changes: 2 additions & 0 deletions doc/lua_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,8 @@ The function of `param2` is determined by `paramtype2` in node definition.
* facedir modulo 4 = rotation around that axis
* By default, on placement the param2 is automatically set to the
horizondal direction the player was looking at (values 0-3)
* Special case: If the node is a connected nodebox, the nodebox
will NOT rotate, only the textures will.
* `paramtype2 = "4dir"`
* Supported drawtypes: "normal", "nodebox", "mesh"
* The rotation of the node is stored in `param2`.
Expand Down
64 changes: 57 additions & 7 deletions games/devtest/mods/testnodes/nodeboxes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,25 @@ minetest.register_node("testnodes:nodebox_leveled", {
groups = {dig_immediate=3},
})


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},
}

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},
}

-- Wall-like nodebox that connects to neighbors
minetest.register_node("testnodes:nodebox_connected", {
description = S("Connected Nodebox Test Node"),
Expand All @@ -69,13 +88,44 @@ minetest.register_node("testnodes:nodebox_connected", {
paramtype = "light",
connects_to = {"group:connected_nodebox"},
connect_sides = {"front", "back", "left", "right"},
node_box = {
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},
node_box = nodebox_wall,
})

minetest.register_node("testnodes:nodebox_connected_facedir", {
description = S("Facedir Connected Nodebox Test Node"),
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 = "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", {
description = S("4Dir Connected Nodebox Test Node"),
tiles = {
"testnodes_1.png^[colorize:#FFFF00:127",
"testnodes_2.png^[colorize:#FFFF00:127",
"testnodes_3.png^[colorize:#FFFF00:127",
"testnodes_4.png^[colorize:#FFFF00:127",
"testnodes_5.png^[colorize:#FFFF00:127",
"testnodes_6.png^[colorize:#FFFF00:127",
},
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,
})

0 comments on commit 6e389be

Please sign in to comment.