]> git.lizzy.rs Git - dragonfireclient.git/blob - games/devtest/mods/testnodes/properties.lua
Add Custom version string
[dragonfireclient.git] / games / devtest / mods / testnodes / properties.lua
1 -- Test Nodes: Node property tests
2
3 local S = minetest.get_translator("testnodes")
4
5 -- Is supposed to fall when it doesn't rest on solid ground
6 minetest.register_node("testnodes:falling", {
7         description = S("Falling Node"),
8         tiles = {
9                 "testnodes_node.png",
10                 "testnodes_node.png",
11                 "testnodes_node_falling.png",
12         },
13         groups = { falling_node = 1, dig_immediate = 3 },
14 })
15
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 },
20
21
22         tiles = {
23                 "testnodes_node.png",
24                 "testnodes_node.png",
25                 "testnodes_node_falling.png",
26         },
27         color = "cyan",
28 })
29
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"),
34         tiles = {
35                 "testnodes_attached_top.png",
36                 "testnodes_attached_bottom.png",
37                 "testnodes_attached_side.png",
38         },
39         groups = { attached_node = 1, dig_immediate = 3 },
40 })
41
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",
47         tiles = {
48                 "testnodes_attachedw_top.png",
49                 "testnodes_attachedw_bottom.png",
50                 "testnodes_attachedw_side.png",
51         },
52         groups = { attached_node = 1, dig_immediate = 3 },
53 })
54
55 -- Jump disabled
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"},
60 })
61
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},
67         walkable = false,
68         tiles = {"testnodes_nojump_top.png"},
69 })
70
71 -- Climbable up and down with jump and sneak keys
72 minetest.register_node("testnodes:climbable", {
73         description = S("Climbable Node"),
74         climbable = true,
75         walkable = false,
76
77
78         paramtype = "light",
79         sunlight_propagates = true,
80         is_ground_content = false,
81         tiles ={"testnodes_climbable_side.png"},
82         drawtype = "glasslike",
83         groups = {dig_immediate=3},
84 })
85
86 -- Climbable only downwards with sneak key
87 minetest.register_node("testnodes:climbable_nojump", {
88         description = S("Downwards-climbable Node"),
89         climbable = true,
90         walkable = false,
91
92         groups = {disable_jump=1, dig_immediate=3},
93         drawtype = "glasslike",
94         tiles ={"testnodes_climbable_nojump_side.png"},
95         paramtype = "light",
96         sunlight_propagates = true,
97 })
98
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",
103         liquid_range = 1,
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},
109         walkable = false,
110
111         drawtype = "liquid",
112         tiles = {"testnodes_liquidsource.png^[colorize:#FF0000:127"},
113         special_tiles = {
114                 {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = false},
115                 {name = "testnodes_liquidsource.png^[colorize:#FF0000:127", backface_culling = true},
116         },
117         use_texture_alpha = true,
118         paramtype = "light",
119         pointable = false,
120         liquids_pointable = true,
121         diggable = false,
122         buildable_to = true,
123         is_ground_content = false,
124         post_effect_color = {a = 70, r = 255, g = 0, b = 200},
125 })
126
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",
131         liquid_range = 1,
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},
137         walkable = false,
138
139
140         drawtype = "flowingliquid",
141         tiles = {"testnodes_liquidflowing.png^[colorize:#FF0000:127"},
142         special_tiles = {
143                 {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
144                 {name = "testnodes_liquidflowing.png^[colorize:#FF0000:127", backface_culling = false},
145         },
146         use_texture_alpha = true,
147         paramtype = "light",
148         paramtype2 = "flowingliquid",
149         pointable = false,
150         liquids_pointable = true,
151         diggable = false,
152         buildable_to = true,
153         is_ground_content = false,
154         post_effect_color = {a = 70, r = 255, g = 0, b = 200},
155 })
156
157 -- Nodes that modify fall damage (various damage modifiers)
158 for i=-100, 100, 25 do
159         if i ~= 0 then
160                 local subname, descnum
161                 if i < 0 then
162                         subname = "m"..math.abs(i)
163                         descnum = tostring(i)
164                 else
165                         subname = tostring(i)
166                         descnum = S("+@1", i)
167                 end
168                 local tex, color, desc
169                 if i > 0 then
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)
174                 else
175                         tex = "testnodes_fall_damage_minus.png"
176                         if i == -100 then
177                                 color = { r=0, b=0, g=255, a=255 }
178                         else
179                                 local val = math.floor((math.abs(i)/100)*255)
180                                 color = { r=0, b=255, g=255-val, a=255 }
181                         end
182                         desc = S("Fall Damage Node (-@1%)", math.abs(i))
183                 end
184                 minetest.register_node("testnodes:damage"..subname, {
185                         description = desc,
186                         groups = {fall_damage_add_percent=i, dig_immediate=3},
187
188
189                         tiles = { tex },
190                         is_ground_content = false,
191                         color = color,
192                 })
193         end
194 end
195
196 -- Bouncy nodes (various bounce levels)
197 for i=20, 180, 20 do
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},
202
203
204                 tiles ={"testnodes_bouncy.png"},
205                 is_ground_content = false,
206                 color = { r=255, g=255-val, b=val, a=255 },
207         })
208 end
209
210 -- Slippery nodes (various slippery levels)
211 for i=1, 5 do
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 },
218         })
219 end
220
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"),
224         buildable_to = true,
225         tiles = {"testnodes_buildable_to.png"},
226         is_ground_content = false,
227         groups = {dig_immediate=3},
228 })
229
230 -- Nodes that deal damage to players that are inside them.
231 -- Negative damage nodes should heal.
232 for d=-3,3 do
233         if d ~= 0 then
234                 local sub, tile
235                 if d > 0 then
236                         sub = tostring(d)
237                         tile = "testnodes_damage.png"
238                 else
239                         sub = "m" .. tostring(math.abs(d))
240                         tile = "testnodes_damage_neg.png"
241                 end
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"
246                 end
247                 minetest.register_node("testnodes:damage_"..sub, {
248                         description = S("Damage Node (@1 damage per second)", d),
249                         damage_per_second = d,
250
251
252                         walkable = false,
253                         is_ground_content = false,
254                         drawtype = "allfaces",
255                         paramtype = "light",
256                         sunlight_propagates = true,
257                         tiles = { tile },
258                         groups = {dig_immediate=3},
259                 })
260         end
261 end
262
263 -- Causes drowning damage
264 minetest.register_node("testnodes:drowning_1", {
265         description = S("Drowning Node (@1 damage)", 1),
266         drowning = 1,
267
268
269         walkable = false,
270         is_ground_content = false,
271         drawtype = "allfaces",
272         paramtype = "light",
273         sunlight_propagates = true,
274         tiles = { "testnodes_drowning.png" },
275         groups = {dig_immediate=3},
276 })
277