1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-15 18:57:08 +00:00

Add rotation support for wallmounted nodes in 'ceiling' or 'floor' mode (#11073)

This commit is contained in:
Wuzzy 2024-01-17 17:47:06 +01:00 committed by GitHub
parent e7dd9737bd
commit 08ee6d8d4b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 375 additions and 33 deletions

View file

@ -163,7 +163,7 @@ minetest.register_node("testnodes:torchlike", {
minetest.register_node("testnodes:torchlike_wallmounted", {
description = S("Wallmounted \"torchlike\" Drawtype Test Node").."\n"..
S("param2 = wallmounted rotation (0..5)"),
S("param2 = wallmounted rotation (0..7)"),
drawtype = "torchlike",
paramtype = "light",
paramtype2 = "wallmounted",
@ -179,6 +179,24 @@ minetest.register_node("testnodes:torchlike_wallmounted", {
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:torchlike_wallmounted_rot", {
description = S("Wallmounted Rotatable Torchlike Drawtype Test Node"),
drawtype = "torchlike",
paramtype = "light",
paramtype2 = "wallmounted",
wallmounted_rotate_vertical = true,
tiles = {
"testnodes_torchlike_floor.png^[colorize:#FFFF00:40",
"testnodes_torchlike_ceiling.png^[colorize:#FFFF00:40",
"testnodes_torchlike_wall.png^[colorize:#FFFF00:40",
},
walkable = false,
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:signlike", {
description = S("Floor \"signlike\" Drawtype Test Node").."\n"..
S("Always on floor"),
@ -186,16 +204,14 @@ minetest.register_node("testnodes:signlike", {
paramtype = "light",
tiles = { "testnodes_signlike.png^[colorize:#FF0000:64" },
walkable = false,
groups = { dig_immediate = 3 },
sunlight_propagates = true,
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:signlike_wallmounted", {
description = S("Wallmounted \"signlike\" Drawtype Test Node").."\n"..
S("param2 = wallmounted rotation (0..5)"),
S("param2 = wallmounted rotation (0..7)"),
drawtype = "signlike",
paramtype = "light",
paramtype2 = "wallmounted",
@ -207,6 +223,22 @@ minetest.register_node("testnodes:signlike_wallmounted", {
sunlight_propagates = true,
})
minetest.register_node("testnodes:signlike_rot", {
description = S("Wallmounted Rotatable Signlike Drawtype Test Node"),
drawtype = "signlike",
paramtype = "light",
paramtype2 = "wallmounted",
wallmounted_rotate_vertical = true,
tiles = { "testnodes_signlike.png^[colorize:#FFFF00:40" },
walkable = false,
groups = { dig_immediate = 3 },
sunlight_propagates = true,
})
minetest.register_node("testnodes:plantlike", {
description = S("\"plantlike\" Drawtype Test Node"),
drawtype = "plantlike",
@ -235,7 +267,7 @@ minetest.register_node("testnodes:plantlike_waving", {
minetest.register_node("testnodes:plantlike_wallmounted", {
description = S("Wallmounted \"plantlike\" Drawtype Test Node").."\n"..
S("param2 = wallmounted rotation (0..5)"),
S("param2 = wallmounted rotation (0..7)"),
drawtype = "plantlike",
paramtype = "light",
paramtype2 = "wallmounted",
@ -366,7 +398,7 @@ minetest.register_node("testnodes:plantlike_rooted", {
minetest.register_node("testnodes:plantlike_rooted_wallmounted", {
description = S("Wallmounted \"rooted_plantlike\" Drawtype Test Node").."\n"..
S("param2 = wallmounted rotation (0..5)"),
S("param2 = wallmounted rotation (0..7)"),
drawtype = "plantlike_rooted",
paramtype = "light",
paramtype2 = "wallmounted",

View file

@ -92,7 +92,7 @@ minetest.register_node("testnodes:mesh_color4dir", {
-- Wallmounted mesh: pyramid
minetest.register_node("testnodes:mesh_wallmounted", {
description = S("Wallmounted Mesh Test Node").."\n"..
S("param2 = wallmounted rotation (0..5)"),
S("param2 = wallmounted rotation (0..7)"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes9.png"},
@ -105,7 +105,7 @@ minetest.register_node("testnodes:mesh_wallmounted", {
minetest.register_node("testnodes:mesh_colorwallmounted", {
description = S("Color Wallmounted Mesh Test Node").."\n"..
S("param2 = color + wallmounted rotation (0..5, 8..13, ...)"),
S("param2 = color + wallmounted rotation (0..7, 8..15, ...)"),
drawtype = "mesh",
mesh = "testnodes_pyramid.obj",
tiles = {"testnodes_mesh_stripes10.png"},

View file

@ -180,3 +180,63 @@ minetest.register_node("testnodes:facedir_to_connect_to", {
paramtype2 = "facedir",
connect_sides = {"left", "top"},
})
-- 3D sign and button:
-- These are example nodes for more realistic example uses
-- of wallmounted_rotate_vertical
minetest.register_node("testnodes:sign3d", {
description = S("Nodebox Sign, Nodebox Type \"fixed\""),
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
wallmounted_rotate_vertical = true,
sunlight_propagates = true,
walkable = false,
tiles = {
"testnodes_sign3d.png",
},
groups = { dig_immediate = 3 },
node_box = {
type = "fixed",
fixed = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
},
})
minetest.register_node("testnodes:sign3d_wallmounted", {
description = S("Nodebox Sign, Nodebox Type \"wallmounted\""),
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
wallmounted_rotate_vertical = true,
sunlight_propagates = true,
walkable = false,
tiles = {
"testnodes_sign3d.png^[colorize:#ff0000:127",
},
groups = { dig_immediate = 3 },
node_box = {
type = "wallmounted",
wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125},
wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125},
wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375},
},
})
minetest.register_node("testnodes:button", {
description = S("Button Nodebox Test Node"),
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "wallmounted",
wallmounted_rotate_vertical = true,
sunlight_propagates = true,
walkable = false,
tiles = {
"testnodes_nodebox.png",
},
groups = { dig_immediate = 3 },
node_box = {
type = "fixed",
fixed = { -4/16, -8/16, -2/16, 4/16, -6/16, 2/16 },
},
})

View file

@ -80,7 +80,7 @@ minetest.register_node("testnodes:4dir_nodebox", {
minetest.register_node("testnodes:wallmounted", {
description = S("Wallmounted Test Node").."\n"..
S("param2 = wallmounted rotation (0..5)"),
S("param2 = wallmounted rotation (0..7)"),
paramtype2 = "wallmounted",
tiles = {
"testnodes_1w.png",
@ -94,9 +94,25 @@ minetest.register_node("testnodes:wallmounted", {
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:wallmounted_rot", {
description = S("Wallmounted Rotatable Test Node"),
paramtype2 = "wallmounted",
wallmounted_rotate_vertical = true,
tiles = {
"testnodes_1w.png^[colorize:#FFFF00:40",
"testnodes_2w.png^[colorize:#FFFF00:40",
"testnodes_3w.png^[colorize:#FFFF00:40",
"testnodes_4w.png^[colorize:#FFFF00:40",
"testnodes_5w.png^[colorize:#FFFF00:40",
"testnodes_6w.png^[colorize:#FFFF00:40",
},
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:wallmounted_nodebox", {
description = S("Wallmounted Nodebox Test Node").."\n"..
S("param2 = wallmounted rotation (0..5)"),
S("param2 = wallmounted rotation (0..7)"),
paramtype2 = "wallmounted",
paramtype = "light",
tiles = {
@ -118,6 +134,30 @@ minetest.register_node("testnodes:wallmounted_nodebox", {
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:wallmounted_nodebox_rot", {
description = S("Wallmounted Rotatable Nodebox Test Node"),
paramtype2 = "wallmounted",
wallmounted_rotate_vertical = true,
paramtype = "light",
tiles = {
"testnodes_1w.png^[colorize:#FFFF00:40",
"testnodes_2w.png^[colorize:#FFFF00:40",
"testnodes_3w.png^[colorize:#FFFF00:40",
"testnodes_4w.png^[colorize:#FFFF00:40",
"testnodes_5w.png^[colorize:#FFFF00:40",
"testnodes_6w.png^[colorize:#FFFF00:40",
},
drawtype = "nodebox",
node_box = {
type = "wallmounted",
wall_top = { -0.5, 0, -0.5, 0.5, 0.5, 0.5 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0, 0.5 },
wall_side = { -0.5, -0.5, -0.5, 0, 0.5, 0.5 },
},
groups = { dig_immediate = 3 },
})
minetest.register_node("testnodes:color", {
description = S("Color Test Node").."\n"..
S("param2 = color (0..255)"),
@ -212,7 +252,7 @@ minetest.register_node("testnodes:color4dir_nodebox", {
minetest.register_node("testnodes:colorwallmounted", {
description = S("Color Wallmounted Test Node").."\n"..
S("param2 = color + wallmounted rotation (0..5, 8..13, ...)"),
S("param2 = color + wallmounted rotation (0..7, 8..15, ...)"),
paramtype2 = "colorwallmounted",
paramtype = "light",
palette = "testnodes_palette_wallmounted.png",
@ -230,7 +270,7 @@ minetest.register_node("testnodes:colorwallmounted", {
minetest.register_node("testnodes:colorwallmounted_nodebox", {
description = S("Color Wallmounted Nodebox Test Node").."\n"..
S("param2 = color + wallmounted rotation (0..5, 8..13, ...)"),
S("param2 = color + wallmounted rotation (0..7, 8..15, ...)"),
paramtype2 = "colorwallmounted",
paramtype = "light",
palette = "testnodes_palette_wallmounted.png",

View file

@ -61,8 +61,8 @@ minetest.register_node("testnodes:attached", {
-- when the node it attaches to is gone.
minetest.register_node("testnodes:attached_wallmounted", {
description = S("Wallmounted Attached Node").."\n"..
S("Attaches to wall; drops as item if neighbor node is gone").."\n"..
S("param2 = wallmounted rotation (0..5)"),
S("Attaches to solid node it was placed on; drops as item if neighbor node is gone").."\n"..
S("param2 = wallmounted rotation (0..7)"),
paramtype2 = "wallmounted",
tiles = {
"testnodes_attachedw_top.png",
@ -72,9 +72,29 @@ minetest.register_node("testnodes:attached_wallmounted", {
groups = { attached_node = 1, dig_immediate = 3 },
})
-- This node attaches to the side of a node and drops as item
-- when the node it attaches to is gone.
-- Also adds vertical 90° rotation variants.
minetest.register_node("testnodes:attached_wallmounted_rot", {
description = S("Rotatable Wallmounted Attached Node").."\n"..
S("Attaches to solid node it was placed on; drops as item if neighbor node is gone").."\n"..
S("param2 = wallmounted rotation (0..7)").."\n"..
S("May be rotated by 90° if placed at floor or ceiling"),
paramtype2 = "wallmounted",
tiles = {
"testnodes_attachedwr_top.png",
"testnodes_attachedwr_bottom.png",
"testnodes_attachedwr_side.png",
},
wallmounted_rotate_vertical = true,
groups = { attached_node = 1, dig_immediate = 3 },
})
-- Wallmounted node that always attaches to the floor
minetest.register_node("testnodes:attached_wallmounted_floor", {
description = S("Floor-Attached Wallmounted Node"),
description = S("Floor-Attached Wallmounted Node").."\n"..
S("Drops as item if no solid node below (regardless of rotation)").."\n"..
S("param2 = wallmounted rotation (visual only) (0..7)"),
paramtype2 = "wallmounted",
tiles = {
"testnodes_attached_top.png",
@ -85,10 +105,28 @@ minetest.register_node("testnodes:attached_wallmounted_floor", {
color = "#FF8080",
})
-- Wallmounted node that always attaches to the floor.
-- Also adds 90° rotation variants.
minetest.register_node("testnodes:attached_wallmounted_floor_rot", {
description = S("Rotatable Floor-Attached Wallmounted Node").."\n"..
S("Drops as item if no solid node below (regardless of rotation)").."\n"..
S("param2 = wallmounted rotation (visual only) (0..7)").."\n"..
S("May be rotated by 90° if placed at floor or ceiling"),
paramtype2 = "wallmounted",
tiles = {
"testnodes_attachedfr_top.png",
"testnodes_attachedfr_bottom.png",
"testnodes_attachedfr_side.png",
},
wallmounted_rotate_vertical = true,
groups = { attached_node = 3, dig_immediate = 3 },
})
-- This node attaches to the ceiling and drops as item
-- when the ceiling is gone.
minetest.register_node("testnodes:attached_top", {
description = S("Ceiling-Attached Node"),
description = S("Ceiling-Attached Node").."\n"..
S("Drops as item if no solid node above"),
tiles = {
"testnodes_attached_bottom.png",
"testnodes_attached_top.png",
@ -99,7 +137,9 @@ minetest.register_node("testnodes:attached_top", {
-- Same as wallmounted attached, but for facedir
minetest.register_node("testnodes:attached_facedir", {
description = S("Facedir Attached Node"),
description = S("Facedir Attached Node").."\n"..
S("Attaches to a neighboring solid node; drops as item if that node is gone").."\n"..
S("param2 = facedir rotation (0..23)"),
paramtype2 = "facedir",
tiles = {
"testnodes_attachedf_side.png^[transformR180",
@ -114,7 +154,9 @@ minetest.register_node("testnodes:attached_facedir", {
-- Same as facedir attached, but for 4dir
minetest.register_node("testnodes:attached_4dir", {
description = S("4dir Attached Node"),
description = S("4dir Attached Node").."\n"..
S("Attaches to the side of a solid node; drops as item if that node is gone").."\n"..
S("param2 = 4dir rotation (0..3)"),
paramtype2 = "4dir",
tiles = {
"testnodes_attached4_side.png^[transformR180",

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B