aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods/testnodes/nodeboxes.lua
blob: 00e4c59ee8e43c24970bbaa0abd6136d59482593 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
local S = minetest.get_translator("testnodes")

-- Nodebox examples and tests.

-- An simple example nodebox with one centered box
minetest.register_node("testnodes:nodebox_fixed", {
	description = S("Fixed Nodebox Test Node").."\n"..
		S("Nodebox is always the same"),
	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", {
	description = S("+50% high Nodebox Test Node"),
	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},
})

-- 95% higher than a regular node
minetest.register_node("testnodes:nodebox_overhigh2", {
	description = S("+95% high Nodebox Test Node"),
	tiles = {"testnodes_nodebox.png"},
	drawtype = "nodebox",
	paramtype = "light",
	node_box = {
		type = "fixed",
		-- Y max: more is possible, but glitchy
		fixed = {-0.5, -0.5, -0.5, 0.5, 1.45, 0.5},
	},

	groups = {dig_immediate=3},
})

-- Height of nodebox changes with its param2 value
minetest.register_node("testnodes:nodebox_leveled", {
	description = S("Leveled Nodebox Test Node").."\n"..
		S("param2 = height (0..127)"),
	tiles = {"testnodes_nodebox.png^[colorize:#0F0:32"},
	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},
})


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").."\n"..
		S("Connects to 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"},
	node_box = nodebox_wall,
})

minetest.register_node("testnodes:nodebox_connected_facedir", {
	description = S("Facedir Connected Nodebox Test Node").."\n"..
		S("Connects to neighbors").."\n"..
		S("param2 = facedir rotation of textures (not of the nodebox!)"),
	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").."\n"..
		S("Connects to neighbors").."\n"..
		S("param2 = 4dir rotation of textures (not of the nodebox!)"),
	tiles = {
		"testnodes_1f.png",
		"testnodes_2f.png",
		"testnodes_3f.png",
		"testnodes_4f.png",
		"testnodes_5f.png",
		"testnodes_6f.png",
	},
	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,
})