7
7
function default .node_sound_defaults (table )
8
8
table = table or {}
9
9
table .footstep = table .footstep or
10
- {name = " " , gain = 1.0 }
10
+ {name = " " , gain = 1.0 }
11
11
table .dug = table .dug or
12
- {name = " default_dug_node" , gain = 0.25 }
12
+ {name = " default_dug_node" , gain = 0.25 }
13
13
table .place = table .place or
14
- {name = " default_place_node_hard" , gain = 1.0 }
14
+ {name = " default_place_node_hard" , gain = 1.0 }
15
15
return table
16
16
end
17
17
18
18
function default .node_sound_stone_defaults (table )
19
19
table = table or {}
20
20
table .footstep = table .footstep or
21
- {name = " default_hard_footstep" , gain = 0.5 }
21
+ {name = " default_hard_footstep" , gain = 0.5 }
22
22
table .dug = table .dug or
23
- {name = " default_hard_footstep" , gain = 1.0 }
23
+ {name = " default_hard_footstep" , gain = 1.0 }
24
24
default .node_sound_defaults (table )
25
25
return table
26
26
end
27
27
28
28
function default .node_sound_dirt_defaults (table )
29
29
table = table or {}
30
30
table .footstep = table .footstep or
31
- {name = " default_dirt_footstep" , gain = 1.0 }
31
+ {name = " default_dirt_footstep" , gain = 1.0 }
32
32
table .dug = table .dug or
33
- {name = " default_dirt_footstep" , gain = 1.5 }
33
+ {name = " default_dirt_footstep" , gain = 1.5 }
34
34
table .place = table .place or
35
- {name = " default_place_node" , gain = 1.0 }
35
+ {name = " default_place_node" , gain = 1.0 }
36
36
default .node_sound_defaults (table )
37
37
return table
38
38
end
39
39
40
40
function default .node_sound_sand_defaults (table )
41
41
table = table or {}
42
42
table .footstep = table .footstep or
43
- {name = " default_sand_footstep" , gain = 0.2 }
43
+ {name = " default_sand_footstep" , gain = 0.2 }
44
44
table .dug = table .dug or
45
- {name = " default_sand_footstep" , gain = 0.4 }
45
+ {name = " default_sand_footstep" , gain = 0.4 }
46
46
table .place = table .place or
47
- {name = " default_place_node" , gain = 1.0 }
47
+ {name = " default_place_node" , gain = 1.0 }
48
48
default .node_sound_defaults (table )
49
49
return table
50
50
end
51
51
52
52
function default .node_sound_wood_defaults (table )
53
53
table = table or {}
54
54
table .footstep = table .footstep or
55
- {name = " default_wood_footstep" , gain = 0.5 }
55
+ {name = " default_wood_footstep" , gain = 0.5 }
56
56
table .dug = table .dug or
57
- {name = " default_wood_footstep" , gain = 1.0 }
57
+ {name = " default_wood_footstep" , gain = 1.0 }
58
58
default .node_sound_defaults (table )
59
59
return table
60
60
end
61
61
62
62
function default .node_sound_leaves_defaults (table )
63
63
table = table or {}
64
64
table .footstep = table .footstep or
65
- {name = " default_grass_footstep" , gain = 0.35 }
65
+ {name = " default_grass_footstep" , gain = 0.35 }
66
66
table .dug = table .dug or
67
- {name = " default_grass_footstep" , gain = 0.7 }
67
+ {name = " default_grass_footstep" , gain = 0.7 }
68
68
table .dig = table .dig or
69
- {name = " default_dig_crumbly" , gain = 0.4 }
69
+ {name = " default_dig_crumbly" , gain = 0.4 }
70
70
table .place = table .place or
71
- {name = " default_place_node" , gain = 1.0 }
71
+ {name = " default_place_node" , gain = 1.0 }
72
72
default .node_sound_defaults (table )
73
73
return table
74
74
end
75
75
76
76
function default .node_sound_glass_defaults (table )
77
77
table = table or {}
78
78
table .footstep = table .footstep or
79
- {name = " default_glass_footstep" , gain = 0.5 }
79
+ {name = " default_glass_footstep" , gain = 0.5 }
80
80
table .dug = table .dug or
81
- {name = " default_break_glass" , gain = 1.0 }
81
+ {name = " default_break_glass" , gain = 1.0 }
82
82
default .node_sound_defaults (table )
83
83
return table
84
84
end
89
89
--
90
90
91
91
default .cool_lava_source = function (pos )
92
- minetest .set_node (pos , {name = " default:obsidian" })
93
- minetest .sound_play (" default_cool_lava" , {pos = pos , gain = 0.25 })
92
+ minetest .set_node (pos , {name = " default:obsidian" })
93
+ minetest .sound_play (" default_cool_lava" , {pos = pos , gain = 0.25 })
94
94
end
95
95
96
96
default .cool_lava_flowing = function (pos )
97
- minetest .set_node (pos , {name = " default:stone" })
98
- minetest .sound_play (" default_cool_lava" , {pos = pos , gain = 0.25 })
97
+ minetest .set_node (pos , {name = " default:stone" })
98
+ minetest .sound_play (" default_cool_lava" , {pos = pos , gain = 0.25 })
99
99
end
100
100
101
101
minetest .register_abm ({
@@ -123,55 +123,53 @@ minetest.register_abm({
123
123
-- Papyrus and cactus growing
124
124
--
125
125
126
+ -- wrapping the functions in abm action is necessary to make overriding them possible
127
+
126
128
function default .grow_cactus (pos , node )
127
129
if node .param2 >= 4 then
128
130
return
129
131
end
130
- pos .y = pos .y - 1
132
+ pos .y = pos .y - 1
131
133
if minetest .get_item_group (minetest .get_node (pos ).name , " sand" ) == 0 then
132
134
return
133
135
end
134
- pos .y = pos .y + 1
136
+ pos .y = pos .y + 1
135
137
local height = 0
136
- while node .name == " default:cactus" and height < 4 and node . param2 == 0 do
137
- height = height + 1
138
- pos .y = pos .y + 1
138
+ while node .name == " default:cactus" and height < 4 do
139
+ height = height + 1
140
+ pos .y = pos .y + 1
139
141
node = minetest .get_node (pos )
140
142
end
141
- if height == 4
142
- or node .name ~= " air" then
143
+ if height == 4 or node .name ~= " air" then
143
144
return
144
145
end
145
- minetest .set_node (pos , {name = " default:cactus" })
146
+ minetest .set_node (pos , {name = " default:cactus" })
146
147
return true
147
148
end
148
149
149
150
function default .grow_papyrus (pos , node )
150
- pos .y = pos .y - 1
151
+ pos .y = pos .y - 1
151
152
local name = minetest .get_node (pos ).name
152
- if name ~= " default:dirt_with_grass"
153
- and name ~= " default:dirt" then
153
+ if name ~= " default:dirt_with_grass" and name ~= " default:dirt" then
154
154
return
155
155
end
156
156
if not minetest .find_node_near (pos , 3 , {" group:water" }) then
157
157
return
158
158
end
159
- pos .y = pos .y + 1
159
+ pos .y = pos .y + 1
160
160
local height = 0
161
161
while node .name == " default:papyrus" and height < 4 do
162
- height = height + 1
163
- pos .y = pos .y + 1
162
+ height = height + 1
163
+ pos .y = pos .y + 1
164
164
node = minetest .get_node (pos )
165
165
end
166
- if height == 4
167
- or node .name ~= " air" then
166
+ if height == 4 or node .name ~= " air" then
168
167
return
169
168
end
170
- minetest .set_node (pos , {name = " default:papyrus" })
169
+ minetest .set_node (pos , {name = " default:papyrus" })
171
170
return true
172
171
end
173
172
174
- -- wrapping the functions in abm action is necessary to make overriding them possible
175
173
minetest .register_abm ({
176
174
nodenames = {" default:cactus" },
177
175
neighbors = {" group:sand" },
@@ -255,8 +253,10 @@ minetest.register_abm({
255
253
if trunkp then
256
254
local n = minetest .get_node (trunkp )
257
255
local reg = minetest .registered_nodes [n .name ]
258
- -- Assume ignore is a trunk, to make the thing work at the border of the active area
259
- if n .name == " ignore" or (reg and reg .groups .tree and reg .groups .tree ~= 0 ) then
256
+ -- Assume ignore is a trunk, to make the thing
257
+ -- work at the border of the active area
258
+ if n .name == " ignore" or (reg and reg .groups .tree and
259
+ reg .groups .tree ~= 0 ) then
260
260
-- print("cached trunk still exists")
261
261
return
262
262
end
@@ -270,7 +270,8 @@ minetest.register_abm({
270
270
end
271
271
default .leafdecay_trunk_find_allow_accumulator =
272
272
default .leafdecay_trunk_find_allow_accumulator - 1
273
- -- Assume ignore is a trunk, to make the thing work at the border of the active area
273
+ -- Assume ignore is a trunk, to make the thing
274
+ -- work at the border of the active area
274
275
local p1 = minetest .find_node_near (p0 , d , {" ignore" , " group:tree" })
275
276
if p1 then
276
277
do_preserve = true
@@ -301,6 +302,7 @@ minetest.register_abm({
301
302
end
302
303
})
303
304
305
+
304
306
--
305
307
-- Grass growing
306
308
--
@@ -310,12 +312,12 @@ minetest.register_abm({
310
312
interval = 2 ,
311
313
chance = 200 ,
312
314
action = function (pos , node )
313
- local above = {x = pos .x , y = pos .y + 1 , z = pos .z }
315
+ local above = {x = pos .x , y = pos .y + 1 , z = pos .z }
314
316
local name = minetest .get_node (above ).name
315
317
local nodedef = minetest .registered_nodes [name ]
316
- if nodedef and (nodedef .sunlight_propagates or nodedef .paramtype == " light" )
317
- and nodedef .liquidtype == " none"
318
- and (minetest .get_node_light (above ) or 0 ) >= 13 then
318
+ if nodedef and (nodedef .sunlight_propagates or nodedef .paramtype == " light" ) and
319
+ nodedef .liquidtype == " none" and
320
+ (minetest .get_node_light (above ) or 0 ) >= 13 then
319
321
if name == " default:snow" or name == " default:snowblock" then
320
322
minetest .set_node (pos , {name = " default:dirt_with_snow" })
321
323
else
@@ -330,13 +332,14 @@ minetest.register_abm({
330
332
interval = 2 ,
331
333
chance = 20 ,
332
334
action = function (pos , node )
333
- local above = {x = pos .x , y = pos .y + 1 , z = pos .z }
335
+ local above = {x = pos .x , y = pos .y + 1 , z = pos .z }
334
336
local name = minetest .get_node (above ).name
335
337
local nodedef = minetest .registered_nodes [name ]
336
- if name ~= " ignore" and nodedef
337
- and not (( nodedef .sunlight_propagates or nodedef . paramtype == " light" )
338
- and nodedef .liquidtype == " none" ) then
338
+ if name ~= " ignore" and nodedef and not (( nodedef . sunlight_propagates or
339
+ nodedef .paramtype == " light" ) and
340
+ nodedef .liquidtype == " none" ) then
339
341
minetest .set_node (pos , {name = " default:dirt" })
340
342
end
341
343
end
342
344
})
345
+
0 commit comments