1 -- Test Nodes: Node property tests
3 local S = minetest.get_translator("testnodes")
5 -- Is supposed to fall when it doesn't rest on solid ground
6 minetest.register_node("testnodes:falling", {
7 description = S("Falling Node"),
11 "testnodes_node_falling.png",
13 groups = { falling_node = 1, dig_immediate = 3 },
16 -- Same as falling node, but will stop falling on top of liquids
17 minetest.register_node("testnodes:falling_float", {
18 description = S("Falling+Floating Node"),
19 groups = { falling_node = 1, float = 1, dig_immediate = 3 },
25 "testnodes_node_falling.png",
30 -- This node attaches to the floor and drops as item
31 -- when the floor is gone.
32 minetest.register_node("testnodes:attached", {
33 description = S("Floor-Attached Node"),
35 "testnodes_attached_top.png",
36 "testnodes_attached_bottom.png",
37 "testnodes_attached_side.png",
39 groups = { attached_node = 1, dig_immediate = 3 },
42 -- This node attaches to the side of a node and drops as item
43 -- when the node it attaches to is gone.
44 minetest.register_node("testnodes:attached_wallmounted", {
45 description = S("Wallmounted Attached Node"),
46 paramtype2 = "wallmounted",
48 "testnodes_attachedw_top.png",
49 "testnodes_attachedw_bottom.png",
50 "testnodes_attachedw_side.png",
52 groups = { attached_node = 1, dig_immediate = 3 },
56 minetest.register_node("testnodes:nojump", {
57 description = S("Non-jumping Node"),
58 groups = {disable_jump=1, dig_immediate=3},
59 tiles = {"testnodes_nojump_top.png", "testnodes_nojump_side.png"},
62 -- Jump disabled plant
63 minetest.register_node("testnodes:nojump_walkable", {
64 description = S("Non-jumping Plant Node"),
65 drawtype = "plantlike",
66 groups = {disable_jump=1, dig_immediate=3},
68 tiles = {"testnodes_nojump_top.png"},
71 -- Climbable up and down with jump and sneak keys
72 minetest.register_node("testnodes:climbable", {
73 description = S("Climbable Node"),
79 sunlight_propagates = true,
80 is_ground_content = false,
81 tiles ={"testnodes_climbable_side.png"},
82 drawtype = "glasslike",
83 groups = {dig_immediate=3},
86 -- Climbable only downwards with sneak key
87 minetest.register_node("testnodes:climbable_nojump", {
88 description = S("Downwards-climbable Node"),
92 groups = {disable_jump=1, dig_immediate=3},
93 drawtype = "glasslike",
94 tiles ={"testnodes_climbable_nojump_side.png"},
96 sunlight_propagates = true,
99 -- A liquid in which you can't rise
100 minetest.register_node("testnodes:liquid_nojump", {
101 description = S("Non-jumping Liquid Source Node"),
102 liquidtype = "source",
104 liquid_viscosity = 0,
105 liquid_alternative_flowing = "testnodes:liquidflowing_nojump",
106 liquid_alternative_source = "testnodes:liquid_nojump",
107 liquid_renewable = false,
108 groups = {disable_jump=1, dig_immediate=3},
112 tiles = {"testnodes_liquidsource.png^[colorize:#FF0000:127"},
114 {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = false},
115 {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = true},
117 use_texture_alpha = "blend",
120 liquids_pointable = true,
122 is_ground_content = false,
123 post_effect_color = {a = 70, r = 255, g = 0, b = 200},
126 -- A liquid in which you can't rise (flowing variant)
127 minetest.register_node("testnodes:liquidflowing_nojump", {
128 description = S("Non-jumping Flowing Liquid Node"),
129 liquidtype = "flowing",
131 liquid_viscosity = 0,
132 liquid_alternative_flowing = "testnodes:liquidflowing_nojump",
133 liquid_alternative_source = "testnodes:liquid_nojump",
134 liquid_renewable = false,
135 groups = {disable_jump=1, dig_immediate=3},
139 drawtype = "flowingliquid",
140 tiles = {"testnodes_liquidflowing.png^[colorize:#FF0000:127"},
142 {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
143 {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
145 use_texture_alpha = "blend",
147 paramtype2 = "flowingliquid",
149 liquids_pointable = true,
151 is_ground_content = false,
152 post_effect_color = {a = 70, r = 255, g = 0, b = 200},
155 -- Nodes that modify fall damage (various damage modifiers)
156 for i=-100, 100, 25 do
158 local subname, descnum
160 subname = "m"..math.abs(i)
161 descnum = tostring(i)
163 subname = tostring(i)
164 descnum = S("+@1", i)
166 local tex, color, desc
168 local val = math.floor((i/100)*255)
169 tex = "testnodes_fall_damage_plus.png"
170 color = { b=0, g=255-val, r=255, a=255 }
171 desc = S("Fall Damage Node (+@1%)", i)
173 tex = "testnodes_fall_damage_minus.png"
175 color = { r=0, b=0, g=255, a=255 }
177 local val = math.floor((math.abs(i)/100)*255)
178 color = { r=0, b=255, g=255-val, a=255 }
180 desc = S("Fall Damage Node (-@1%)", math.abs(i))
182 minetest.register_node("testnodes:damage"..subname, {
184 groups = {fall_damage_add_percent=i, dig_immediate=3},
188 is_ground_content = false,
194 -- Bouncy nodes (various bounce levels)
196 local val = math.floor(((i-20)/200)*255)
197 minetest.register_node("testnodes:bouncy"..i, {
198 description = S("Bouncy Node (@1%)", i),
199 groups = {bouncy=i, dig_immediate=3},
202 tiles ={"testnodes_bouncy.png"},
203 is_ground_content = false,
204 color = { r=255, g=255-val, b=val, a=255 },
208 -- Slippery nodes (various slippery levels)
210 minetest.register_node("testnodes:slippery"..i, {
211 description = S("Slippery Node (@1)", i),
212 tiles ={"testnodes_slippery.png"},
213 is_ground_content = false,
214 groups = {slippery=i, dig_immediate=3},
215 color = { r=0, g=255, b=math.floor((i/5)*255), a=255 },
219 -- By placing something on the node, the node itself will be replaced
220 minetest.register_node("testnodes:buildable_to", {
221 description = S("Replacable Node"),
223 tiles = {"testnodes_buildable_to.png"},
224 is_ground_content = false,
225 groups = {dig_immediate=3},
228 -- Nodes that deal damage to players that are inside them.
229 -- Negative damage nodes should heal.
235 tile = "testnodes_damage.png"
237 sub = "m" .. tostring(math.abs(d))
238 tile = "testnodes_damage_neg.png"
240 if math.abs(d) == 2 then
241 tile = tile .. "^[colorize:#000000:70"
242 elseif math.abs(d) == 3 then
243 tile = tile .. "^[colorize:#000000:140"
245 minetest.register_node("testnodes:damage_"..sub, {
246 description = S("Damage Node (@1 damage per second)", d),
247 damage_per_second = d,
251 is_ground_content = false,
252 drawtype = "allfaces",
254 sunlight_propagates = true,
256 groups = {dig_immediate=3},
261 -- Causes drowning damage
262 minetest.register_node("testnodes:drowning_1", {
263 description = S("Drowning Node (@1 damage)", 1),
268 is_ground_content = false,
269 drawtype = "allfaces",
271 sunlight_propagates = true,
272 tiles = { "testnodes_drowning.png" },
273 groups = {dig_immediate=3},