2020-10-26 17:38:53 +01:00
|
|
|
--[[
|
|
|
|
Default Sound Sets
|
|
|
|
------------------
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
Order is very important when adding a sound set so it will play
|
|
|
|
certain sound sets before any another.
|
2020-10-26 17:38:53 +01:00
|
|
|
--]]
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
-- mod support
|
|
|
|
|
|
|
|
local mod_def = minetest.get_modpath("default")
|
|
|
|
local mod_mcl = minetest.get_modpath("mcl_core")
|
|
|
|
|
2020-10-26 17:38:53 +01:00
|
|
|
-- Underwater sounds play when player head is submerged
|
|
|
|
|
|
|
|
ambience.add_set("underwater", {
|
|
|
|
|
|
|
|
frequency = 1000,
|
|
|
|
|
|
|
|
sounds = {
|
|
|
|
{name = "scuba", length = 8}
|
|
|
|
},
|
|
|
|
|
|
|
|
sound_check = function(def)
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
local nodef = minetest.registered_nodes[def.head_node]
|
|
|
|
|
|
|
|
if nodef and nodef.groups and nodef.groups.water then
|
2020-10-26 17:38:53 +01:00
|
|
|
return "underwater"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
2021-06-12 20:20:04 +02:00
|
|
|
-- Splashing sound plays when player walks inside water nodes (if enabled)
|
|
|
|
|
|
|
|
if minetest.settings:get_bool("ambience_water_move") ~= false then
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
-- 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
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
ambience.add_set("splash", {
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
frequency = 1000,
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
sounds = {
|
|
|
|
{name = "default_water_footstep", length = 2}
|
|
|
|
},
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local nodef = minetest.registered_nodes[def.feet_node]
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if nodef and nodef.groups and nodef.groups.water then
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
local control = def.player:get_player_control()
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if control.up or control.down or control.left or control.right then
|
|
|
|
return "splash"
|
|
|
|
end
|
2020-10-26 17:38:53 +01:00
|
|
|
end
|
|
|
|
end
|
2024-12-19 12:55:40 +01:00
|
|
|
})
|
2021-06-12 20:20:04 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
-- check for env_sounds mod, if not found enable water flowing and lava sounds
|
2020-10-26 17:38:53 +01:00
|
|
|
if not minetest.get_modpath("env_sounds") then
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
-- Water sound plays when near flowing water
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
ambience.add_set("flowing_water", {
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
frequency = 1000,
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
sounds = {
|
|
|
|
{name = "waterfall", length = 6}
|
|
|
|
},
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
nodes = {"group:water"},
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
sound_check = function(def)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
local c = (def.totals["default:water_flowing"] or 0)
|
|
|
|
+ (def.totals["mcl_core:water_flowing"] or 0)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if c > 40 then return "flowing_water", 0.5
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
elseif c > 5 then return "flowing_water" end
|
2020-10-26 17:38:53 +01:00
|
|
|
end
|
2024-12-19 12:55:40 +01:00
|
|
|
})
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
-- River sound plays when near flowing river
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
ambience.add_set("river", {
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
frequency = 1000,
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
sounds = {
|
|
|
|
{name = "river", length = 4, gain = 0.1}
|
|
|
|
},
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
sound_check = function(def)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
local c = (def.totals["default:river_water_flowing"] or 0)
|
|
|
|
+ (def.totals["mclx_core:river_water_flowing"] or 0)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if c > 20 then return "river", 0.5
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
elseif c > 5 then return "river" end
|
2020-10-26 17:38:53 +01:00
|
|
|
end
|
2024-12-19 12:55:40 +01:00
|
|
|
})
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
-- Lava sound plays when near lava
|
2021-06-12 20:20:04 +02:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
ambience.add_set("lava", {
|
2021-06-12 20:20:04 +02:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
frequency = 1000,
|
2021-06-12 20:20:04 +02:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
sounds = {
|
|
|
|
{name = "lava", length = 7}
|
|
|
|
},
|
2021-06-12 20:20:04 +02:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
nodes = {"group:lava"},
|
2021-06-12 20:20:04 +02:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
sound_check = function(def)
|
2021-06-12 20:20:04 +02:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
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)
|
2021-06-12 20:20:04 +02:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if c > 20 then return "lava", 0.5
|
2021-06-12 20:20:04 +02:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
elseif c > 5 then return "lava" end
|
2021-06-12 20:20:04 +02:00
|
|
|
end
|
2024-12-19 12:55:40 +01:00
|
|
|
})
|
2020-10-26 17:38:53 +01:00
|
|
|
else
|
2024-12-19 12:55:40 +01:00
|
|
|
print ("[MOD] Ambience - found env_sounds, using for water and lava sounds.")
|
2020-10-26 17:38:53 +01:00
|
|
|
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},
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "seagull", length = 4.5, pitch = 1.2, ephemeral = true},
|
2020-10-26 17:38:53 +01:00
|
|
|
{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)
|
2024-12-19 12:55:40 +01:00
|
|
|
+ (def.totals["mcl_core:water_source"] or 0)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
|
|
|
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 = {
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "icecrack", length = 5, gain = 1.1},
|
2020-10-26 17:38:53 +01:00
|
|
|
{name = "desertwind", length = 8},
|
|
|
|
{name = "wind", length = 9}
|
|
|
|
},
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
nodes = (mod_mcl and {"mcl_core:ice", "mcl_core:packed_ice"} or {"default:ice"}),
|
2020-10-26 17:38:53 +01:00
|
|
|
|
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:ice"] or 0)
|
2024-12-19 12:55:40 +01:00
|
|
|
+(def.totals["mcl_core:ice"] or 0)
|
|
|
|
+ (def.totals["mcl_core:packed_ice"] or 0)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if c > 100 then return "ice" end
|
2020-10-26 17:38:53 +01:00
|
|
|
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}
|
|
|
|
},
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
nodes = {
|
|
|
|
(mod_mcl and "mcl_core:redsand" or "default:desert_sand"),
|
|
|
|
(mod_mcl and "mcl_core:sand" or "default:sand")
|
|
|
|
},
|
2020-10-26 17:38:53 +01:00
|
|
|
|
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:desert_sand"] or 0)
|
|
|
|
+ (def.totals["default:sand"] or 0)
|
2024-12-19 12:55:40 +01:00
|
|
|
+ (def.totals["mcl_core:sand"] or 0)
|
|
|
|
+ (def.totals["mcl_core:redsand"] or 0)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if c > 150 and def.pos.y > 10 then return "desert" end
|
2020-10-26 17:38:53 +01:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
2021-07-24 12:22:10 +02:00
|
|
|
-- Cave sounds play when below player position Y -25 and water nearby
|
2020-10-26 17:38:53 +01:00
|
|
|
|
|
|
|
ambience.add_set("cave", {
|
|
|
|
|
|
|
|
frequency = 60,
|
|
|
|
|
|
|
|
sounds = {
|
|
|
|
{name = "drippingwater1", length = 1.5, ephemeral = true},
|
2024-12-19 12:55:40 +01:00
|
|
|
{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}
|
2020-10-26 17:38:53 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
sound_check = function(def)
|
|
|
|
|
2021-07-24 12:22:10 +02:00
|
|
|
local c = (def.totals["default:water_source"] or 0)
|
2024-12-19 12:55:40 +01:00
|
|
|
+ (def.totals["mcl_core:water_source"] or 0)
|
2021-07-24 12:22:10 +02:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if c > 0 and def.pos.y < -25 then return "cave" end
|
2020-10-26 17:38:53 +01:00
|
|
|
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},
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "peacock", length = 2, ephemeral = true},
|
|
|
|
{name = "peacock", length = 2, pitch = 1.2, ephemeral = true}
|
2020-10-26 17:38:53 +01:00
|
|
|
},
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
nodes = {(mod_mcl and "mcl_trees:tree_jungle" or "default:jungletree")},
|
2020-10-26 17:38:53 +01:00
|
|
|
|
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:jungletree"] or 0)
|
2024-12-19 12:55:40 +01:00
|
|
|
+ (def.totals["mcl_trees:tree_jungle"] or 0)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if def.tod > 0.2 and def.tod < 0.8 and c > 79 then return "jungle" end
|
2020-10-26 17:38:53 +01:00
|
|
|
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},
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "frog", length = 1, ephemeral = true},
|
|
|
|
{name = "frog", length = 1, pitch = 1.3, ephemeral = true}
|
2020-10-26 17:38:53 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
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)
|
2024-12-19 12:55:40 +01:00
|
|
|
+ (def.totals["mcl_trees:tree_jungle"] or 0)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if (def.tod < 0.2 or def.tod > 0.8) and c > 79 then return "jungle_night" end
|
2020-10-26 17:38:53 +01:00
|
|
|
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},
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "robin", length = 4, pitch = 1.2, ephemeral = true},
|
2020-10-26 17:38:53 +01:00
|
|
|
{name = "bird1", length = 11},
|
|
|
|
{name = "bird2", length = 6, ephemeral = true},
|
|
|
|
{name = "crestedlark", length = 6, ephemeral = true},
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "crestedlark", length = 6, pitch = 1.1, ephemeral = true},
|
2020-10-26 17:38:53 +01:00
|
|
|
{name = "peacock", length = 2, ephemeral = true},
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "peacock", length = 2, pitch = 1.2, ephemeral = true},
|
2020-10-26 17:38:53 +01:00
|
|
|
{name = "wind", length = 9}
|
|
|
|
},
|
|
|
|
|
|
|
|
nodes = {"group:leaves"},
|
|
|
|
|
|
|
|
sound_check = function(def)
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
-- use handy function to count all nodes in group:leaves
|
|
|
|
local c = ambience.group_total(def.totals, "leaves")
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if (def.tod > 0.2 and def.tod < 0.8) and def.pos.y > -10 and c > 5 then
|
2020-10-26 17:38:53 +01:00
|
|
|
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},
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "hornedowl", length = 2, pitch = 1.1, ephemeral = true},
|
2020-10-26 17:38:53 +01:00
|
|
|
{name = "wolves", length = 4, gain = 0.4, ephemeral = true},
|
|
|
|
{name = "cricket", length = 6, ephemeral = true},
|
|
|
|
{name = "deer", length = 7, ephemeral = true},
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "frog", length = 1, ephemeral = true},
|
|
|
|
{name = "frog", length = 1, pitch = 1.2, ephemeral = true}
|
2020-10-26 17:38:53 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
sound_check = function(def)
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
-- use handy function to count all nodes in group:leaves
|
|
|
|
local c = ambience.group_total(def.totals, "leaves")
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if (def.tod < 0.2 or def.tod > 0.8) and def.pos.y > -10 and c > 5 then
|
2020-10-26 17:38:53 +01:00
|
|
|
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},
|
2024-12-19 12:55:40 +01:00
|
|
|
{name = "desertwind", length = 8, pitch = 1.3},
|
|
|
|
{name = "wind", length = 9},
|
|
|
|
{name = "wind", length = 9, pitch = 1.4}
|
2020-10-26 17:38:53 +01:00
|
|
|
},
|
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
nodes = {(mod_mcl and "mcl_core:snowblock" or "default:snowblock")},
|
2020-10-26 17:38:53 +01:00
|
|
|
|
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:snowblock"] or 0)
|
2024-12-19 12:55:40 +01:00
|
|
|
+ (def.totals["mcl_core:snowblock"] or 0)
|
2020-10-26 17:38:53 +01:00
|
|
|
|
2024-12-19 12:55:40 +01:00
|
|
|
if def.pos.y > 50 or c > 100 then return "high_up" end
|
2020-10-26 17:38:53 +01:00
|
|
|
end
|
|
|
|
})
|