init.lua 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. --------------------------------------------------------------------------------------------------------
  2. --Ambience Configuration for version .34
  3. --Added Faraway & Ethereal by Amethystium
  4. --find out why wind stops while flying
  5. --add an extra node near feet to handle treading water as a special case, and don't have to use node under feet. which gets
  6. --invoked when staning on a ledge near water.
  7. --reduce redundant code (stopplay and add ambience to list)
  8. local max_frequency_all = 8000 --the larger you make this number the less frequent ALL sounds will happen recommended values between 100-2000.
  9. --for frequencies below use a number between 0 and max_frequency_all
  10. --for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds
  11. local night_frequency = 85 --crickets
  12. local night_volume = 0.4
  13. local night_frequent_frequency = 160 --owls, wolves, crows
  14. local night_frequent_volume = 0.7
  15. local day_frequency = 70 --misc birds
  16. local day_volume = 0.4
  17. local day_frequent_frequency = 200 --robin, bluejay, cardinal
  18. local day_frequent_volume = 0.18
  19. local cave_frequency = 6 --about every 5 minutes, scary cave sounds
  20. local cave_volume = 0.9
  21. local cave_frequent_frequency = 150 --drops of water dripping
  22. local cave_frequent_volume = 0.8
  23. local beach_frequency = 150 --seagulls
  24. local beach_volume = 0.4
  25. local beach_frequent_frequency = max_frequency_all --waves
  26. local beach_frequent_volume = 0.3
  27. local water_frequent_frequency = max_frequency_all --water sounds
  28. local water_frequent_volume = 0.6
  29. local desert_frequency = 20 --coyote
  30. local desert_volume = 0.6
  31. local desert_frequent_frequency = max_frequency_all --desertwind
  32. local desert_frequent_volume = 0.6
  33. local swimming_frequent_frequency = 0 --swimming splashes
  34. local swimming_frequent_volume = 0
  35. local water_surface_volume = 0 -- sloshing water
  36. local lava_volume = 1 --lava
  37. local flowing_water_volume = 0.4 --waterfall
  38. local splashing_water_volume = 0.4
  39. local pos, minp, maxp, temp, humid, nodes, height, minheight, grad, yint, desert_in_range, node_at_upper_body
  40. --End of Config
  41. ----------------------------------------------------------------------------------------------------
  42. local ambiences
  43. local counter=0--*****************
  44. local SOUNDVOLUME = 0.5
  45. local sound_vol = 1
  46. local last_x_pos = 0
  47. local last_y_pos = 0
  48. local last_z_pos = 0
  49. local node_under_feet
  50. local node_at_upper_body
  51. local node_at_lower_body
  52. local node_3_under_feet
  53. local night = {
  54. name = "night",
  55. handler = {},
  56. fading = {},
  57. started = {},
  58. --on_start = "horned_owl",
  59. frequency = night_frequency,
  60. {name="Crickets_At_NightCombo", length=47, gain=night_frequent_volume},
  61. }
  62. local night_frequent = {
  63. name = "night_frequent",
  64. handler = {},
  65. fading = {},
  66. started = {},
  67. frequency = night_frequent_frequency,
  68. {name="horned_owl", length=3, gain=night_volume},
  69. {name="Wolves_Howling", length=11, gain=night_volume},
  70. {name="craw", length=3, gain=night_volume},
  71. }
  72. local day = {
  73. name = "day",
  74. handler = {},
  75. fading = {},
  76. started = {},
  77. --on_start = "Best_Cardinal_Bird",
  78. frequency = day_frequency,
  79. {name="birdsongnl", length=13, gain=day_frequent_volume},
  80. {name="bird", length=30, gain=day_frequent_volume},
  81. }
  82. local day_frequent = {
  83. name = "day_frequent",
  84. handler = {},
  85. fading = {},
  86. started = {},
  87. frequency = day_frequent_frequency,
  88. {name="robin2", length=16, gain=day_frequent_volume},
  89. {name="bluejay", length=18, gain=day_frequent_volume},
  90. {name="Best_Cardinal_Bird", length=4, gain=day_frequent_volume},
  91. }
  92. --[[local swimming_frequent = {
  93. handler = {},
  94. frequency = 0,
  95. {name="water_swimming_splashing_breath", length=11.5, gain=swimming_frequent_volume},
  96. {name="water_swimming_splashing", length=9, gain=swimming_frequent_volume}
  97. }]]
  98. local cave = {
  99. name = "cave",
  100. handler = {},
  101. fading = {},
  102. started = {},
  103. frequency = cave_frequency,
  104. {name="cave_scary_1", length=10, gain=cave_volume},
  105. {name="cave_scary_2", length=21, gain=cave_volume},
  106. {name="cave_scary_3", length=5, gain=cave_volume},
  107. {name="cave_scary_4", length=9, gain=cave_volume},
  108. {name="cave_scary_5", length=6, gain=cave_volume},
  109. {name="cave_scary_6", length=31, gain=cave_volume},
  110. {name="cave_scary_7", length=11, gain=cave_volume},
  111. {name="cave_scary_8", length=11, gain=cave_volume},
  112. {name="cave_scary_9", length=6, gain=cave_volume},
  113. {name="cave_scary_10", length=17, gain=cave_volume},
  114. {name="cave_scary_11", length=51, gain=cave_volume},
  115. {name="cave_scary_12", length=18, gain=cave_volume},
  116. {name="cave_scary_13", length=34, gain=cave_volume},
  117. {name="cave_scary_14", length=7, gain=cave_volume},
  118. {name="cave_scary_15", length=6, gain=cave_volume},
  119. {name="cave_scary_16", length=5, gain=cave_volume},
  120. {name="cave_scary_17", length=8, gain=cave_volume},
  121. {name="cave_scary_18", length=7, gain=cave_volume},
  122. {name="cave_scary_19", length=7, gain=cave_volume},
  123. {name="cave_scary_20", length=13, gain=cave_volume},
  124. {name="cave_scary_21", length=20, gain=cave_volume},
  125. {name="cave_scary_22", length=6, gain=cave_volume},
  126. }
  127. local cave_frequent = {
  128. name = "cave_frequent",
  129. handler = {},
  130. fading = {},
  131. started = {},
  132. frequency = cave_frequent_frequency,
  133. {name="drippingwater_drip_a", length=2, gain=cave_frequent_volume},
  134. {name="drippingwater_drip_b", length=2, gain=cave_frequent_volume},
  135. {name="drippingwater_drip_c", length=2, gain=cave_frequent_volume},
  136. {name="Single_Water_Droplet", length=3, gain=cave_frequent_volume},
  137. {name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume},
  138. {name="cave_dust_fall", length=3, gain=cave_frequent_volume},
  139. {name="cave_crumble_2", length=3, gain=cave_frequent_volume},
  140. {name="cave_crumble_10", length=2, gain=cave_frequent_volume},
  141. {name="cave_crumble_12", length=2, gain=cave_frequent_volume},
  142. }
  143. local beach = {
  144. name = "beach",
  145. handler = {},
  146. fading = {},
  147. started = {},
  148. frequency = beach_frequency,
  149. {name="seagull", length=4.5, gain=beach_volume}
  150. }
  151. local beach_frequent = {
  152. name = "beach_frequent",
  153. handler = {},
  154. fading = {},
  155. started = {},
  156. frequency = beach_frequent_frequency,
  157. {name="ambience_soundscape_beach", length=170, gain=beach_frequent_volume}
  158. }
  159. local desert = {
  160. name = "desert",
  161. handler = {},
  162. fading = {},
  163. started = {},
  164. frequency = desert_frequency,
  165. {name="coyote2", length=2.5, gain=desert_volume},
  166. {name="RattleSnake", length=8, gain=desert_volume}
  167. }
  168. local desert_frequent = {
  169. name = "desert_frequent",
  170. handler = {},
  171. fading = {},
  172. started = {},
  173. frequency = desert_frequent_frequency,
  174. {name="DesertMonolithMed", length=34.5, gain=desert_frequent_volume}
  175. }
  176. --[[
  177. local flying = {
  178. handler = {},
  179. frequency = 8000,
  180. on_start = "nothing_yet",
  181. on_stop = "nothing_yet",
  182. {name="ComboWind", length=17, gain=1}
  183. }
  184. local water = {
  185. handler = {},
  186. frequency = 0,--dolphins dont fit into small lakes
  187. {name="dolphins", length=6, gain=1},
  188. {name="dolphins_screaming", length=16.5, gain=1}
  189. }
  190. ]]
  191. local water_frequent = {
  192. name = "water_frequent",
  193. handler = {},
  194. fading = {},
  195. started = {},
  196. gain = water_frequent_volume,
  197. frequency = water_frequent_frequency,
  198. on_stop = "drowning_gasp",
  199. --on_start = "Splash",
  200. {name="scuba1bubbles", length=11, gain=water_frequent_volume},
  201. {name="scuba1calm", length=10, gain=water_frequent_volume}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here.
  202. {name="scuba1calm2", length=8.5, gain=water_frequent_volume},
  203. {name="scuba1interestingbubbles", length=11, gain=water_frequent_volume},
  204. {name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume}
  205. }
  206. --[[
  207. local water_surface = {
  208. handler = {},
  209. frequency = max_frequency_all,
  210. {name="lake_waves_2_calm", length=9.5, gain=water_surface_volume},
  211. {name="lake_waves_2_variety", length=13.1, gain=water_surface_volume}
  212. }
  213. local splashing_water = {
  214. handler = {},
  215. frequency = 0,
  216. {name="Splash_disabled_too_buggy", length=1.22, gain=splashing_water_volume}
  217. }
  218. local flowing_water = {
  219. handler = {},
  220. frequency = 0,
  221. {name="small_waterfall_disabled_too_buggy", length=14, gain=flowing_water_volume}
  222. }
  223. local flowing_water2 = {
  224. handler = {},
  225. frequency = 0,
  226. {name="small_waterfall_disabled_too_buggy", length=11, gain=flowing_water_volume}
  227. }]]
  228. local lava = {
  229. name = "lava",
  230. handler = {},
  231. fading = {},
  232. started = {},
  233. gain = lava_volume,
  234. frequency = max_frequency_all,
  235. {name="earth01a", length=20, gain=lava_volume}
  236. }
  237. local lava2 = {
  238. name = "lava2",
  239. handler = {},
  240. fading = {},
  241. started = {},
  242. gain = lava_volume,
  243. frequency = max_frequency_all,
  244. {name="earth01a", length=15, gain=lava_volume}
  245. }
  246. local play_music = false
  247. local is_daytime = function()
  248. return (minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8)
  249. end
  250. local nodes_in_range = function(pos, search_distance, node_name)
  251. minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
  252. maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
  253. nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
  254. --minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
  255. return #nodes
  256. end
  257. local nodes_in_coords = function(minp, maxp, node_name)
  258. nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
  259. --minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
  260. return #nodes
  261. end
  262. local atleast_nodes_in_grid = function(minp, maxp, node_name, threshold)
  263. --counter = counter +1
  264. -- minetest.chat_send_all("counter: (" .. counter .. ")")
  265. height = maxp.y
  266. minheight = minp.y
  267. local totalnodes = 0
  268. local nodes
  269. while height >= minheight do
  270. minp.y = height
  271. maxp.y = height
  272. nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
  273. -- minetest.chat_send_all("z+Found (" .. node_name .. ": " .. #nodes .. ")")
  274. height = height - 1
  275. if #nodes >= threshold then
  276. return true
  277. end
  278. totalnodes = totalnodes + #nodes
  279. if totalnodes >= threshold then
  280. return true
  281. end
  282. end
  283. return false
  284. end
  285. local humidmap = nil
  286. local tempmap = nil
  287. local function is_skylit(pos)
  288. if minetest.get_modpath("minetest_systemd") then
  289. return (minetestd.utils.get_natural_light(pos) > 0)
  290. else
  291. return (minetest.get_node_light(pos, 0.5) ~= minetest.get_node_light(pos, 0))
  292. end
  293. end
  294. local get_ambience = function(player)
  295. --[[local player_is_climbing = false
  296. local player_is_descending = false
  297. local player_is_moving_horiz = false
  298. local standing_in_water = false]]
  299. local pos = player:getpos()
  300. local skylit = is_skylit(pos)
  301. node_at_upper_body = minetest.registered_nodes[minetest.get_node(vector.add(pos, {x=0,y=1.2,z=0})).name]
  302. --Thanks/credit to the snowdrift mod for these calculations.
  303. humidmap = humidmap or minetest.get_perlin({
  304. offset = 50,
  305. scale = 50,
  306. spread = {x = 1000, y = 1000, z = 1000},
  307. seed = 842,
  308. octaves = 3,
  309. persist = 0.5,
  310. lacunarity = 2.0,
  311. flags = "defaults"
  312. })
  313. tempmap = tempmap or minetest.get_perlin({
  314. offset = 50,
  315. scale = 50,
  316. spread = {x = 1000, y = 1000, z = 1000},
  317. seed = 5349,
  318. octaves = 3,
  319. persist = 0.5,
  320. lacunarity = 2.0,
  321. flags = "defaults"
  322. })
  323. temp = tempmap:get2d({x = math.floor(pos.x+0.5), y = math.floor(pos.z+0.5)}) - pos.y*(20 / 90)
  324. humid = humidmap:get2d({x = math.floor(pos.x+0.5), y = math.floor(pos.z+0.5)})
  325. if node_at_upper_body and node_at_upper_body.liquidtype ~= "none" then
  326. if music then
  327. return {water_frequent=water_frequent, music=music}
  328. else
  329. return {water_frequent=water_frequent}
  330. end
  331. end
  332. if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 or
  333. nodes_in_range(pos, 7, "dfcaverns:mantle_flowing")>5 or nodes_in_range(pos, 7, "dfcaverns:mantle_source")>5
  334. then
  335. if music then
  336. return {lava=lava, music=music}
  337. else
  338. return {lava=lava}
  339. end
  340. end
  341. --if we are near sea level and there is lots of water around the area
  342. if pos.y > -10 and pos.y < 32 and atleast_nodes_in_grid({x=pos.x-21, y=-10, z=pos.z-21}, {x=pos.x+21, y=1, z=pos.z+21}, "default:water_source", 140 ) then
  343. if temp > 30 then --Frozen = no seagulls
  344. if music then
  345. return {beach=beach, beach_frequent=beach_frequent, music=music}
  346. else
  347. return {beach=beach, beach_frequent=beach_frequent}
  348. end
  349. else
  350. if music then
  351. return {beach_frequent=beach_frequent, music=music}
  352. else
  353. return {beach_frequent=beach_frequent}
  354. end
  355. end
  356. end
  357. --[[if standing_in_water then
  358. if music then
  359. return {water_surface=water_surface, music=music}
  360. else
  361. return {water_surface}
  362. end
  363. end]]
  364. grad = 14 / 95
  365. yint = 1496 / 95
  366. desert_in_range = pos.y > -32 and humid - grad * temp < yint
  367. if desert_in_range then
  368. if music then
  369. return {desert=desert, desert_frequent=desert_frequent, music=music}
  370. else
  371. return {desert=desert, desert_frequent=desert_frequent}
  372. end
  373. end
  374. if pos.y > 128 and pos.y < 1000 and skylit then -- Play desert wind at really high altitude for an icy wind effect
  375. if music then
  376. return {desert_frequent=desert_frequent, music=music}
  377. else
  378. return {desert_frequent=desert_frequent}
  379. end
  380. end
  381. -- pos.y = pos.y-2
  382. -- nodename = minetest.env:get_node(pos).name
  383. -- minetest.chat_send_all("Found " .. nodename .. pos.y )
  384. if player:getpos().y < 0 and not skylit then
  385. if music then
  386. return {cave=cave, cave_frequent=cave_frequent, music=music}
  387. else
  388. return {cave=cave, cave_frequent=cave_frequent}
  389. end
  390. end
  391. if skylit
  392. and temp > 30
  393. then
  394. if is_daytime() then
  395. if music then
  396. return {day=day, day_frequent=day_frequent, music=music}
  397. else
  398. return {day=day, day_frequent=day_frequent}
  399. end
  400. else
  401. if music then
  402. return {night=night, night_frequent=night_frequent, music=music}
  403. else
  404. return {night=night, night_frequent=night_frequent}
  405. end
  406. end
  407. end
  408. if music then
  409. return {music=music}
  410. else
  411. return {}
  412. end
  413. end
  414. -- start playing the sound, set the handler and delete the handler after sound is played
  415. local play_sound = function(player, list, number, is_music)
  416. local ambience_player_name = player:get_player_name()
  417. if list.handler[ambience_player_name] == nil then
  418. local gain = 1.0
  419. if list[number].gain ~= nil then
  420. if is_music then
  421. gain = list[number].gain*MUSICVOLUME
  422. --minetest.chat_send_all("gain music: " .. gain )
  423. else
  424. gain = list[number].gain*SOUNDVOLUME
  425. --minetest.chat_send_all("gain sound: " .. gain )
  426. end
  427. end
  428. local handler = minetest.sound_play(list[number].name, {to_player=ambience_player_name, gain=gain})
  429. if handler ~= nil then
  430. list.handler[ambience_player_name] = handler
  431. minetest.after(list[number].length, function(args)
  432. local list = args[1]
  433. local ambience_player_name = args[2]
  434. if list.handler[ambience_player_name] ~= nil then
  435. minetest.sound_stop(list.handler[ambience_player_name])
  436. list.handler[ambience_player_name] = nil
  437. end
  438. end, {list, ambience_player_name})
  439. end
  440. end
  441. end
  442. local fade_out_sound = function(list, name)
  443. if not list.fading[name] then
  444. list.fading[name] = list[1].gain
  445. if list.on_stop ~= nil then
  446. minetest.sound_play(list.on_stop, {to_player=name,gain=SOUNDVOLUME})
  447. end
  448. elseif list.fading[name] > 0 then
  449. list.fading[name] = list.fading[name] - (list[1].gain/4)
  450. --minetest.chat_send_all("fading "..list.name.." "..list.fading[name])
  451. minetest.sound_fade(list.handler[name], -(list[1].gain/8), math.max(0, list.fading[name]))
  452. if list.fading[name] <= 0 then
  453. minetest.after(0.25, function(list, name)
  454. --minetest.chat_send_all("stopping "..list.name.." "..(list.fading[name] or "nil"))
  455. if list.handler[name] then
  456. minetest.sound_stop(list.handler[name])
  457. end
  458. list.handler[name] = nil
  459. list.fading[name] = nil
  460. end, list, name)
  461. end
  462. end
  463. end
  464. minetest.register_on_leaveplayer(function(player)
  465. local ambience_player_name = player:get_player_name()
  466. local lists = {
  467. cave,
  468. cave_frequent,
  469. beach,
  470. beach_frequent,
  471. desert,
  472. desert_frequent,
  473. night,
  474. night_frequent,
  475. day,
  476. day_frequent,
  477. lava,
  478. lava2,
  479. water_frequent
  480. }
  481. for _,list in pairs(lists) do
  482. if list.handler[ambience_player_name] ~= nil then
  483. list.handler[ambience_player_name] = nil
  484. end
  485. if list.fading[ambience_player_name] ~= nil then
  486. list.fading[ambience_player_name] = nil
  487. end
  488. end
  489. end)
  490. -- stops all sounds that are not in still_playing
  491. local stop_sound = function(still_playing, player, dtime)
  492. local ambience_player_name = player:get_player_name()
  493. local lists = {
  494. cave,
  495. cave_frequent,
  496. beach,
  497. beach_frequent,
  498. desert,
  499. desert_frequent,
  500. night,
  501. night_frequent,
  502. day,
  503. day_frequent,
  504. lava,
  505. lava2,
  506. water_frequent
  507. }
  508. for _,list in pairs(lists) do
  509. if still_playing[list.name] == nil then
  510. --minetest.log('line 556')
  511. if list.handler[ambience_player_name] ~= nil then
  512. --minetest.log('line 558')
  513. fade_out_sound(list, ambience_player_name, dtime)
  514. end
  515. list.started[ambience_player_name] = nil
  516. elseif list.handler[ambience_player_name] and list.fading[ambience_player_name] --Un-fade the sound if it started to fade out for some reason
  517. and list.fading[ambience_player_name] > 0 --Don't rescue sounds that are too far gone
  518. then
  519. --minetest.chat_send_all("reamplifying "..list.name.." to "..list[1].gain)
  520. minetest.sound_fade(list.handler[ambience_player_name], (list[1].gain/4), list[1].gain)
  521. list.fading[ambience_player_name] = nil
  522. end
  523. end
  524. end
  525. local timer = 0
  526. minetest.register_globalstep(function(dtime)
  527. timer = timer+dtime
  528. if timer < 0.5 then
  529. return
  530. end
  531. timer = 0
  532. for _,player in ipairs(minetest.get_connected_players()) do
  533. ambiences = get_ambience(player)
  534. for _,ambience in pairs(ambiences) do
  535. if (ambience.on_start ~= nil) and not ambience.started[player:get_player_name()] then
  536. minetest.sound_play(ambience.on_start, {to_player=player:get_player_name(),gain=SOUNDVOLUME})
  537. ambience.started[player:get_player_name()] = true
  538. end
  539. end
  540. stop_sound(ambiences, player)
  541. --minetest.log("ambiences is "..dump(ambiences))
  542. for _,ambience in pairs(ambiences) do
  543. --minetest.log("max_frequency_all is "..dump(max_frequency_all))
  544. --minetest.log("ambience is "..dump(ambience))
  545. if math.random(1, max_frequency_all) <= ambience.frequency then
  546. -- if(played_on_start) then
  547. -- -- minetest.chat_send_all("playedOnStart " )
  548. -- else
  549. -- -- minetest.chat_send_all("FALSEplayedOnStart " )
  550. -- end
  551. -- minetest.chat_send_all("ambience: " ..ambience )
  552. -- if ambience.on_start ~= nil and played_on_start_flying == false then
  553. -- played_on_start_flying = true
  554. -- minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
  555. -- end
  556. local is_music =false
  557. if ambience.is_music ~= nil then
  558. is_music = true
  559. end
  560. play_sound(player, ambience, math.random(1, #ambience),is_music)
  561. end
  562. end
  563. end
  564. end
  565. )
  566. minetest.register_chatcommand("svol", {
  567. params = "<svol>",
  568. description = "set volume of ambiance, default 0.5 normal volume.",
  569. privs = {server=true},
  570. func = function(name, param)
  571. SOUNDVOLUME = param
  572. -- local player = minetest.env:get_player_by_name(name)
  573. -- ambiences = get_ambience(player)
  574. -- stop_sound({}, player)
  575. minetest.chat_send_player(name, "Sound volume set.")
  576. end,
  577. })