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 = true,
120 liquids_pointable = true,
123 is_ground_content = false,
124 post_effect_color = {a = 70, r = 255, g = 0, b = 200},
127 -- A liquid in which you can't rise (flowing variant)
128 minetest.register_node("testnodes:liquidflowing_nojump", {
129 description = S("Non-jumping Flowing Liquid Node"),
130 liquidtype = "flowing",
132 liquid_viscosity = 0,
133 liquid_alternative_flowing = "testnodes:liquidflowing_nojump",
134 liquid_alternative_source = "testnodes:liquid_nojump",
135 liquid_renewable = false,
136 groups = {disable_jump=1, dig_immediate=3},
140 drawtype = "flowingliquid",
141 tiles = {"testnodes_liquidflowing.png^[colorize:#FF0000:127"},
143 {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
144 {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
146 use_texture_alpha = true,
148 paramtype2 = "flowingliquid",
150 liquids_pointable = true,
153 is_ground_content = false,
154 post_effect_color = {a = 70, r = 255, g = 0, b = 200},
157 -- Nodes that modify fall damage (various damage modifiers)
158 for i=-100, 100, 25 do
160 local subname, descnum
162 subname = "m"..math.abs(i)
163 descnum = tostring(i)
165 subname = tostring(i)
166 descnum = S("+@1", i)
168 local tex, color, desc
170 local val = math.floor((i/100)*255)
171 tex = "testnodes_fall_damage_plus.png"
172 color = { b=0, g=255-val, r=255, a=255 }
173 desc = S("Fall Damage Node (+@1%)", i)
175 tex = "testnodes_fall_damage_minus.png"
177 color = { r=0, b=0, g=255, a=255 }
179 local val = math.floor((math.abs(i)/100)*255)
180 color = { r=0, b=255, g=255-val, a=255 }
182 desc = S("Fall Damage Node (-@1%)", math.abs(i))
184 minetest.register_node("testnodes:damage"..subname, {
186 groups = {fall_damage_add_percent=i, dig_immediate=3},
190 is_ground_content = false,
196 -- Bouncy nodes (various bounce levels)
198 local val = math.floor(((i-20)/200)*255)
199 minetest.register_node("testnodes:bouncy"..i, {
200 description = S("Bouncy Node (@1%)", i),
201 groups = {bouncy=i, dig_immediate=3},
204 tiles ={"testnodes_bouncy.png"},
205 is_ground_content = false,
206 color = { r=255, g=255-val, b=val, a=255 },
210 -- Slippery nodes (various slippery levels)
212 minetest.register_node("testnodes:slippery"..i, {
213 description = S("Slippery Node (@1)", i),
214 tiles ={"testnodes_slippery.png"},
215 is_ground_content = false,
216 groups = {slippery=i, dig_immediate=3},
217 color = { r=0, g=255, b=math.floor((i/5)*255), a=255 },
221 -- By placing something on the node, the node itself will be replaced
222 minetest.register_node("testnodes:buildable_to", {
223 description = S("Replacable Node"),
225 tiles = {"testnodes_buildable_to.png"},
226 is_ground_content = false,
227 groups = {dig_immediate=3},
230 -- Nodes that deal damage to players that are inside them.
231 -- Negative damage nodes should heal.
237 tile = "testnodes_damage.png"
239 sub = "m" .. tostring(math.abs(d))
240 tile = "testnodes_damage_neg.png"
242 if math.abs(d) == 2 then
243 tile = tile .. "^[colorize:#000000:70"
244 elseif math.abs(d) == 3 then
245 tile = tile .. "^[colorize:#000000:140"
247 minetest.register_node("testnodes:damage_"..sub, {
248 description = S("Damage Node (@1 damage per second)", d),
249 damage_per_second = d,
253 is_ground_content = false,
254 drawtype = "allfaces",
256 sunlight_propagates = true,
258 groups = {dig_immediate=3},
263 -- Causes drowning damage
264 minetest.register_node("testnodes:drowning_1", {
265 description = S("Drowning Node (@1 damage)", 1),
270 is_ground_content = false,
271 drawtype = "allfaces",
273 sunlight_propagates = true,
274 tiles = { "testnodes_drowning.png" },
275 groups = {dig_immediate=3},