-
Notifications
You must be signed in to change notification settings - Fork 0
/
soundsets.lua
413 lines (295 loc) · 10.6 KB
/
soundsets.lua
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
--[[
Default Sound Sets
------------------
Order is very important when adding a sound set so it will play
certain sound sets before any another.
--]]
-- mod support
local mod_def = minetest.get_modpath("default")
local mod_mcl = minetest.get_modpath("mcl_core")
-- Underwater sounds play when player head is submerged
ambience.add_set("underwater", {
frequency = 1000,
sounds = {
{name = "scuba", length = 8}
},
sound_check = function(def)
local nodef = minetest.registered_nodes[def.head_node]
if nodef and nodef.groups and nodef.groups.water then
return "underwater"
end
end
})
-- Splashing sound plays when player walks inside water nodes (if enabled)
if minetest.settings:get_bool("ambience_water_move") ~= false then
-- override default water sounds
if mod_def then
minetest.override_item("default:water_source", { sounds = {} })
minetest.override_item("default:water_flowing", { sounds = {} })
minetest.override_item("default:river_water_source", { sounds = {} })
minetest.override_item("default:river_water_flowing", { sounds = {} })
elseif mod_mcl then
minetest.override_item("mcl_core:water_source", { sounds = {} })
minetest.override_item("mcl_core:water_flowing", { sounds = {} })
minetest.override_item("mclx_core:river_water_source", { sounds = {} })
minetest.override_item("mclx_core:river_water_flowing", { sounds = {} })
end
ambience.add_set("splash", {
frequency = 1000,
sounds = {
{name = "default_water_footstep", length = 2}
},
sound_check = function(def)
local nodef = minetest.registered_nodes[def.feet_node]
if nodef and nodef.groups and nodef.groups.water then
local control = def.player:get_player_control()
if control.up or control.down or control.left or control.right then
return "splash"
end
end
end
})
end
-- check for env_sounds mod, if not found enable water flowing and lava sounds
if not minetest.get_modpath("env_sounds") then
-- Water sound plays when near flowing water
ambience.add_set("flowing_water", {
frequency = 1000,
sounds = {
{name = "waterfall", length = 6}
},
nodes = {"group:water"},
sound_check = function(def)
local c = (def.totals["default:water_flowing"] or 0)
+ (def.totals["mcl_core:water_flowing"] or 0)
if c > 40 then return "flowing_water", 0.5
elseif c > 5 then return "flowing_water" end
end
})
-- River sound plays when near flowing river
ambience.add_set("river", {
frequency = 1000,
sounds = {
{name = "river", length = 4, gain = 0.1}
},
sound_check = function(def)
local c = (def.totals["default:river_water_flowing"] or 0)
+ (def.totals["mclx_core:river_water_flowing"] or 0)
if c > 20 then return "river", 0.5
elseif c > 5 then return "river" end
end
})
-- Lava sound plays when near lava
ambience.add_set("lava", {
frequency = 1000,
sounds = {
{name = "lava", length = 7}
},
nodes = {"group:lava"},
sound_check = function(def)
local c = (def.totals["default:lava_source"] or 0)
+ (def.totals["default:lava_flowing"] or 0)
+ (def.totals["mcl_core:lava_source"] or 0)
+ (def.totals["mcl_core:lava_flowing"] or 0)
if c > 20 then return "lava", 0.5
elseif c > 5 then return "lava" end
end
})
else
print ("[MOD] Ambience - found env_sounds, using for water and lava sounds.")
end
-- Beach sounds play when below y-pos 6 and 150+ water source found
ambience.add_set("beach", {
frequency = 40,
sounds = {
{name = "seagull", length = 4.5, ephemeral = true},
{name = "seagull", length = 4.5, pitch = 1.2, ephemeral = true},
{name = "beach", length = 13},
{name = "gull", length = 1, ephemeral = true},
{name = "beach_2", length = 6}
},
sound_check = function(def)
local c = (def.totals["default:water_source"] or 0)
+ (def.totals["mcl_core:water_source"] or 0)
if def.pos.y < 6 and def.pos.y > 0 and c > 150 then
return "beach"
end
end
})
-- Ice sounds play when 100 or more ice are nearby
ambience.add_set("ice", {
frequency = 250,
sounds = {
{name = "icecrack", length = 5, gain = 1.1},
{name = "desertwind", length = 8},
{name = "wind", length = 9}
},
nodes = (mod_mcl and {"mcl_core:ice", "mcl_core:packed_ice"} or {"default:ice"}),
sound_check = function(def)
local c = (def.totals["default:ice"] or 0)
+(def.totals["mcl_core:ice"] or 0)
+ (def.totals["mcl_core:packed_ice"] or 0)
if c > 100 then return "ice" end
end
})
-- Desert sounds play when near 150+ desert or normal sand
ambience.add_set("desert", {
frequency = 20,
sounds = {
{name = "coyote", length = 2.5, ephemeral = true},
{name = "wind", length = 9},
{name = "desertwind", length = 8}
},
nodes = {
(mod_mcl and "mcl_core:redsand" or "default:desert_sand"),
(mod_mcl and "mcl_core:sand" or "default:sand")
},
sound_check = function(def)
local c = (def.totals["default:desert_sand"] or 0)
+ (def.totals["default:sand"] or 0)
+ (def.totals["mcl_core:sand"] or 0)
+ (def.totals["mcl_core:redsand"] or 0)
if c > 150 and def.pos.y > 10 then return "desert" end
end
})
-- Cave sounds play when below player position Y -25 and water nearby
ambience.add_set("cave", {
frequency = 60,
sounds = {
{name = "drippingwater1", length = 1.5, ephemeral = true},
{name = "drippingwater2", length = 1.5, ephemeral = true},
{name = "drippingwater2", length = 1.5, pitch = 1.2, ephemeral = true},
{name = "drippingwater2", length = 1.5, pitch = 1.4, ephemeral = true},
{name = "bats", length = 5, ephemeral = true}
},
sound_check = function(def)
local c = (def.totals["default:water_source"] or 0)
+ (def.totals["mcl_core:water_source"] or 0)
if c > 0 and def.pos.y < -25 then return "cave" end
end
})
-- Jungle sounds play during day and when around 90 jungletree trunks
ambience.add_set("jungle", {
frequency = 200,
sounds = {
{name = "jungle_day_1", length = 7},
{name = "deer", length = 7, ephemeral = true},
{name = "canadianloon2", length = 14},
{name = "bird1", length = 11},
{name = "peacock", length = 2, ephemeral = true},
{name = "peacock", length = 2, pitch = 1.2, ephemeral = true}
},
nodes = {(mod_mcl and "mcl_trees:tree_jungle" or "default:jungletree")},
sound_check = function(def)
local c = (def.totals["default:jungletree"] or 0)
+ (def.totals["mcl_trees:tree_jungle"] or 0)
if def.tod > 0.2 and def.tod < 0.8 and c > 79 then return "jungle" end
end
})
-- Jungle sounds play during night and when around 90 jungletree trunks
ambience.add_set("jungle_night", {
frequency = 200,
sounds = {
{name = "jungle_night_1", length = 4, ephemeral = true},
{name = "jungle_night_2", length = 4, ephemeral = true},
{name = "deer", length = 7, ephemeral = true},
{name = "frog", length = 1, ephemeral = true},
{name = "frog", length = 1, pitch = 1.3, ephemeral = true}
},
sound_check = function(def)
-- jungle tree was added in last set, so doesnt need to be added in this one
local c = (def.totals["default:jungletree"] or 0)
+ (def.totals["mcl_trees:tree_jungle"] or 0)
if (def.tod < 0.2 or def.tod > 0.8) and c > 79 then return "jungle_night" end
end
})
-- Daytime sounds play during day when around leaves and above ground
ambience.add_set("day", {
frequency = 40,
sounds = {
{name = "cardinal", length = 3, ephemeral = true},
{name = "craw", length = 3, ephemeral = true},
{name = "bluejay", length = 6, ephemeral = true},
{name = "robin", length = 4, ephemeral = true},
{name = "robin", length = 4, pitch = 1.2, ephemeral = true},
{name = "bird1", length = 11},
{name = "bird2", length = 6, ephemeral = true},
{name = "crestedlark", length = 6, ephemeral = true},
{name = "crestedlark", length = 6, pitch = 1.1, ephemeral = true},
{name = "peacock", length = 2, ephemeral = true},
{name = "peacock", length = 2, pitch = 1.2, ephemeral = true},
{name = "wind", length = 9}
},
nodes = {"group:leaves"},
sound_check = function(def)
-- we used group:leaves but still need to specify actual nodes for total
local c = (def.totals["default:leaves"] or 0)
+ (def.totals["default:bush_leaves"] or 0)
+ (def.totals["default:pine_needles"] or 0)
+ (def.totals["default:aspen_leaves"] or 0)
+ (def.totals["mcl_trees:leaves_spruce"] or 0)
+ (def.totals["mcl_trees:leaves_oak"] or 0)
+ (def.totals["mcl_trees:leaves_mangrove"] or 0)
+ (def.totals["mcl_trees:leaves_birch"] or 0)
+ (def.totals["mcl_trees:leaves_acacia"] or 0)
+ (def.totals["ethereal:birch_leaves"] or 0)
+ (def.totals["ethereal:lemon_leaves"] or 0)
+ (def.totals["ethereal:olive_leaves"] or 0)
+ (def.totals["ethereal:redwood_leaves"] or 0)
+ (def.totals["ethereal:sakura_leaves"] or 0)
+ (def.totals["ethereal:sakura_leaves2"] or 0)
if (def.tod > 0.2 and def.tod < 0.8) and def.pos.y > -10 and c > 5 then
return "day"
end
end
})
-- Nighttime sounds play at night when above ground near leaves
ambience.add_set("night", {
frequency = 40,
sounds = {
{name = "hornedowl", length = 2, ephemeral = true},
{name = "hornedowl", length = 2, pitch = 1.1, ephemeral = true},
{name = "wolves", length = 4, gain = 0.4, ephemeral = true},
{name = "cricket", length = 6, ephemeral = true},
{name = "deer", length = 7, ephemeral = true},
{name = "frog", length = 1, ephemeral = true},
{name = "frog", length = 1, pitch = 1.2, ephemeral = true}
},
sound_check = function(def)
-- leaves were added in last set, so don't need to be added to this one
local c = (def.totals["default:leaves"] or 0)
+ (def.totals["default:bush_leaves"] or 0)
+ (def.totals["default:pine_needles"] or 0)
+ (def.totals["default:aspen_leaves"] or 0)
+ (def.totals["mcl_trees:leaves_spruce"] or 0)
+ (def.totals["mcl_trees:leaves_oak"] or 0)
+ (def.totals["mcl_trees:leaves_mangrove"] or 0)
+ (def.totals["mcl_trees:leaves_birch"] or 0)
+ (def.totals["mcl_trees:leaves_acacia"] or 0)
+ (def.totals["ethereal:birch_leaves"] or 0)
+ (def.totals["ethereal:lemon_leaves"] or 0)
+ (def.totals["ethereal:olive_leaves"] or 0)
+ (def.totals["ethereal:redwood_leaves"] or 0)
+ (def.totals["ethereal:sakura_leaves"] or 0)
+ (def.totals["ethereal:sakura_leaves2"] or 0)
if (def.tod < 0.2 or def.tod > 0.8) and def.pos.y > -10 and c > 5 then
return "night"
end
end
})
-- Winds play when player is above 50 y-pos or near 150+ snow blocks
ambience.add_set("high_up", {
frequency = 40,
sounds = {
{name = "desertwind", length = 8},
{name = "desertwind", length = 8, pitch = 1.3},
{name = "wind", length = 9},
{name = "wind", length = 9, pitch = 1.4}
},
nodes = {(mod_mcl and "mcl_core:snowblock" or "default:snowblock")},
sound_check = function(def)
local c = (def.totals["default:snowblock"] or 0)
+ (def.totals["mcl_core:snowblock"] or 0)
if def.pos.y > 50 or c > 100 then return "high_up" end
end
})