2018-08-30 16:09:48 +02:00
|
|
|
--[[
|
|
|
|
Default Sound Sets
|
|
|
|
------------------
|
|
|
|
|
|
|
|
Order is very important when adding a sound set so it will play a certain
|
|
|
|
set of sounds before any another.
|
|
|
|
--]]
|
|
|
|
|
|
|
|
-- Underwater sounds play when player head is submerged
|
|
|
|
|
|
|
|
ambience.add_set("underwater", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 1000,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
|
|
|
{name = "scuba", length = 8}
|
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
if minetest.registered_nodes[def.head_node]
|
|
|
|
and minetest.registered_nodes[def.head_node].groups.water then
|
|
|
|
return "underwater"
|
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2021-06-09 09:53:52 +02:00
|
|
|
-- 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
|
|
|
|
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 = {} })
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
ambience.add_set("splash", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 1000,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
2021-05-17 20:06:30 +02:00
|
|
|
{name = "swim_splashing", length = 3}
|
2018-08-30 16:09:48 +02:00
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
if minetest.registered_nodes[def.feet_node]
|
|
|
|
and minetest.registered_nodes[def.feet_node].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
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2021-06-09 09:53:52 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
-- check for env_sounds mod, if not found enable water flowing and lava sounds
|
2019-11-10 10:15:59 +01:00
|
|
|
if not minetest.get_modpath("env_sounds") then
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- Water sound plays when near flowing water
|
2018-11-02 14:24:16 +01:00
|
|
|
|
|
|
|
ambience.add_set("flowing_water", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-11-02 14:24:16 +01:00
|
|
|
frequency = 1000,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-11-02 14:24:16 +01:00
|
|
|
sounds = {
|
|
|
|
{name = "waterfall", length = 6}
|
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
|
|
|
nodes = {"default:water_flowing"},
|
|
|
|
|
2018-11-02 14:24:16 +01:00
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:water_flowing"] or 0)
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
if c > 40 then
|
|
|
|
return "flowing_water", 0.5
|
2020-06-14 11:12:22 +02:00
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
elseif c > 5 then
|
|
|
|
return "flowing_water"
|
|
|
|
end
|
|
|
|
end
|
2018-11-02 14:24:16 +01:00
|
|
|
})
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- River sound plays when near flowing river
|
2018-11-02 14:24:16 +01:00
|
|
|
|
|
|
|
ambience.add_set("river", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-11-02 14:24:16 +01:00
|
|
|
frequency = 1000,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-11-02 14:24:16 +01:00
|
|
|
sounds = {
|
|
|
|
{name = "river", length = 4, gain = 0.1}
|
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
|
|
|
nodes = {"default:river_water_flowing"},
|
|
|
|
|
2018-11-02 14:24:16 +01:00
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:river_water_flowing"] or 0)
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
if c > 20 then
|
|
|
|
return "river", 0.5
|
2020-06-14 11:12:22 +02:00
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
elseif c > 5 then
|
|
|
|
return "river"
|
|
|
|
end
|
|
|
|
end
|
2018-11-02 14:24:16 +01:00
|
|
|
})
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2021-06-09 09:53:52 +02:00
|
|
|
-- Lava sound plays when near lava
|
|
|
|
|
|
|
|
ambience.add_set("lava", {
|
|
|
|
|
|
|
|
frequency = 1000,
|
|
|
|
|
|
|
|
sounds = {
|
|
|
|
{name = "lava", length = 7}
|
|
|
|
},
|
|
|
|
|
|
|
|
nodes = {"default:lava_source", "default:lava_flowing"},
|
|
|
|
|
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:lava_source"] or 0)
|
|
|
|
+ (def.totals["default:lava_flowing"] or 0)
|
|
|
|
|
|
|
|
if c > 20 then
|
|
|
|
return "lava", 0.5
|
|
|
|
|
|
|
|
elseif c > 5 then
|
|
|
|
return "lava"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
2019-11-10 10:15:59 +01:00
|
|
|
else
|
2021-07-05 10:11:21 +02:00
|
|
|
print ("[Ambience] found env_sounds, flowing water and lava sounds disabled.")
|
2019-11-10 10:15:59 +01:00
|
|
|
end
|
2018-11-02 14:24:16 +01:00
|
|
|
|
2020-06-10 17:36:45 +02:00
|
|
|
-- Only add fire sounds set if flame_sound is disabled or fire redo active
|
|
|
|
|
|
|
|
local flame_sound = minetest.settings:get_bool("flame_sound", true)
|
|
|
|
local fire_redo = minetest.get_modpath("fire") and fire.mod and fire.mod == "redo"
|
|
|
|
|
|
|
|
if flame_sound and not fire_redo then
|
|
|
|
|
|
|
|
print ("[Ambience] fire sounds not enabled, already active in fire mod.")
|
|
|
|
|
|
|
|
else
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- Small fire sound plays when near lower than 9 flames
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
ambience.add_set("smallfire", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 1000,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
|
|
|
{name = "fire_small", length = 6, gain = 0.1}
|
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
|
|
|
nodes = {"fire:basic_flame", "fire:permanent_flame"},
|
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
2020-06-10 17:36:45 +02:00
|
|
|
local c = (def.totals["fire:basic_flame"] or 0)
|
|
|
|
+ (def.totals["fire:permanent_flame"] or 0)
|
2018-08-30 16:09:48 +02:00
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
if c > 5 and c < 9 then
|
|
|
|
return "smallfire", 0.5
|
2018-08-30 16:09:48 +02:00
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
elseif c > 0 and c < 9 then
|
2020-06-10 17:36:45 +02:00
|
|
|
return "smallfire"
|
2018-08-30 16:09:48 +02:00
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- Large fire sound plays when near more than 9 flames
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
ambience.add_set("largefire", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 1000,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
|
|
|
{name = "fire_large", length = 8, gain = 0.4}
|
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- fire nodes were added in last set, so don't need to be added in this one
|
2020-06-10 17:36:45 +02:00
|
|
|
local c = (def.totals["fire:basic_flame"] or 0)
|
|
|
|
+ (def.totals["fire:permanent_flame"] or 0)
|
2018-08-30 16:09:48 +02:00
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
if c > 20 then
|
|
|
|
return "largefire", 0.5
|
2018-08-30 16:09:48 +02:00
|
|
|
|
2020-06-10 17:36:45 +02:00
|
|
|
elseif c > 8 then
|
|
|
|
return "largefire"
|
2018-08-30 16:09:48 +02:00
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2020-06-10 17:36:45 +02:00
|
|
|
end
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- Beach sounds play when below y-pos 6 and 150+ water source found
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
ambience.add_set("beach", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 40,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
2020-06-14 16:01:59 +02:00
|
|
|
{name = "seagull", length = 4.5, ephemeral = true},
|
2018-08-30 16:09:48 +02:00
|
|
|
{name = "beach", length = 13},
|
2020-06-14 16:01:59 +02:00
|
|
|
{name = "gull", length = 1, ephemeral = true},
|
2020-06-14 14:20:55 +02:00
|
|
|
{name = "beach_2", length = 6}
|
2018-08-30 16:09:48 +02:00
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
|
|
|
nodes = {"default:water_source"},
|
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:water_source"] or 0)
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
if def.pos.y < 6 and def.pos.y > 0 and c > 150 then
|
2018-08-30 16:09:48 +02:00
|
|
|
return "beach"
|
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
-- Ice sounds play when 100 or more ice are nearby
|
|
|
|
|
|
|
|
ambience.add_set("ice", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 250,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
2021-07-03 15:08:28 +02:00
|
|
|
{name = "icecrack", length = 23, gain = 0.7},
|
2018-08-30 16:09:48 +02:00
|
|
|
{name = "desertwind", length = 8},
|
2020-06-14 14:20:55 +02:00
|
|
|
{name = "wind", length = 9}
|
2018-08-30 16:09:48 +02:00
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
|
|
|
nodes = {"default:ice"},
|
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:ice"] or 0)
|
|
|
|
|
|
|
|
if c > 100 then
|
|
|
|
return "ice"
|
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2018-11-02 14:49:26 +01:00
|
|
|
-- Desert sounds play when near 150+ desert or normal sand
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
ambience.add_set("desert", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 20,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
2020-06-14 16:01:59 +02:00
|
|
|
{name = "coyote", length = 2.5, ephemeral = true},
|
2018-08-30 16:09:48 +02:00
|
|
|
{name = "wind", length = 9},
|
|
|
|
{name = "desertwind", length = 8}
|
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
|
|
|
nodes = {"default:desert_sand", "default:sand"},
|
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
2018-11-02 15:00:18 +01:00
|
|
|
local c = (def.totals["default:desert_sand"] or 0)
|
|
|
|
+ (def.totals["default:sand"] or 0)
|
2018-08-30 16:09:48 +02:00
|
|
|
|
2018-11-03 09:53:45 +01:00
|
|
|
if c > 150 and def.pos.y > 10 then
|
2018-08-30 16:09:48 +02:00
|
|
|
return "desert"
|
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2021-07-05 10:11:21 +02:00
|
|
|
-- Cave sounds play when below player position Y -25 and water nearby
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
ambience.add_set("cave", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 60,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
2020-06-14 16:01:59 +02:00
|
|
|
{name = "drippingwater1", length = 1.5, ephemeral = true},
|
|
|
|
{name = "drippingwater2", length = 1.5, ephemeral = true}
|
2018-08-30 16:09:48 +02:00
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
2021-07-05 10:11:21 +02:00
|
|
|
local c = (def.totals["default:water_source"] or 0)
|
|
|
|
|
|
|
|
if c > 0 and def.pos.y < -25 then
|
2018-08-30 16:09:48 +02:00
|
|
|
return "cave"
|
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- Jungle sounds play during day and when around 90 jungletree trunks
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
ambience.add_set("jungle", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 200,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
|
|
|
{name = "jungle_day_1", length = 7},
|
2020-06-14 16:01:59 +02:00
|
|
|
{name = "deer", length = 7, ephemeral = true},
|
2018-08-30 16:09:48 +02:00
|
|
|
{name = "canadianloon2", length = 14},
|
|
|
|
{name = "bird1", length = 11},
|
2020-06-14 16:01:59 +02:00
|
|
|
{name = "peacock", length = 2, ephemeral = true}
|
2018-08-30 16:09:48 +02:00
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
|
|
|
nodes = {"default:jungletree"},
|
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
|
|
|
local c = (def.totals["default:jungletree"] or 0)
|
|
|
|
|
|
|
|
if def.tod > 0.2 and def.tod < 0.8 and c > 90 then
|
|
|
|
return "jungle"
|
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- Jungle sounds play during night and when around 90 jungletree trunks
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
ambience.add_set("jungle_night", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 200,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
2020-06-14 16:01:59 +02:00
|
|
|
{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}
|
2018-08-30 16:09:48 +02:00
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- jungle tree was added in last set, so doesnt need to be added in this one
|
2018-08-30 16:09:48 +02:00
|
|
|
local c = (def.totals["default:jungletree"] or 0)
|
|
|
|
|
|
|
|
if (def.tod < 0.2 or def.tod > 0.8) and c > 90 then
|
2020-06-14 14:20:55 +02:00
|
|
|
return "jungle_night"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
-- Daytime sounds play during day when around leaves and above ground
|
|
|
|
|
|
|
|
ambience.add_set("day", {
|
|
|
|
|
|
|
|
frequency = 40,
|
|
|
|
|
|
|
|
sounds = {
|
2020-06-14 16:01:59 +02:00
|
|
|
{name = "cardinal", length = 3, ephemeral = true},
|
|
|
|
{name = "craw", length = 3, ephemeral = true},
|
|
|
|
{name = "bluejay", length = 6, ephemeral = true},
|
|
|
|
{name = "robin", length = 4, ephemeral = true},
|
2020-06-14 14:20:55 +02:00
|
|
|
{name = "bird1", length = 11},
|
2020-06-14 16:01:59 +02:00
|
|
|
{name = "bird2", length = 6, ephemeral = true},
|
|
|
|
{name = "crestedlark", length = 6, ephemeral = true},
|
|
|
|
{name = "peacock", length = 2, ephemeral = true},
|
2020-06-14 14:20:55 +02:00
|
|
|
{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)
|
|
|
|
|
|
|
|
if (def.tod > 0.2 and def.tod < 0.8)
|
|
|
|
and def.pos.y > -10
|
|
|
|
and c > 5 then
|
|
|
|
return "day"
|
2018-08-30 16:09:48 +02:00
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- Nighttime sounds play at night when above ground near leaves
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
ambience.add_set("night", {
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
frequency = 40,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
2020-06-14 16:01:59 +02:00
|
|
|
{name = "hornedowl", length = 2, 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}
|
2018-08-30 16:09:48 +02:00
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- leaves were added in last set, so don't need to be added to this one
|
2018-11-02 15:00:18 +01:00
|
|
|
local c = (def.totals["default:leaves"] or 0)
|
|
|
|
+ (def.totals["default:bush_leaves"] or 0)
|
2020-05-12 16:16:37 +02:00
|
|
|
+ (def.totals["default:pine_needles"] or 0)
|
2018-11-02 15:00:18 +01:00
|
|
|
+ (def.totals["default:aspen_leaves"] or 0)
|
|
|
|
|
|
|
|
if (def.tod < 0.2 or def.tod > 0.8)
|
|
|
|
and def.pos.y > -10
|
|
|
|
and c > 5 then
|
2018-08-30 16:09:48 +02:00
|
|
|
return "night"
|
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
-- Winds play when player is above 50 y-pos or near 150+ snow blocks
|
|
|
|
|
|
|
|
ambience.add_set("high_up", {
|
2018-08-30 16:09:48 +02:00
|
|
|
|
|
|
|
frequency = 40,
|
2020-06-14 14:20:55 +02:00
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sounds = {
|
2020-06-14 14:20:55 +02:00
|
|
|
{name = "desertwind", length = 8},
|
|
|
|
{name = "wind", length = 9}
|
2018-08-30 16:09:48 +02:00
|
|
|
},
|
2020-06-14 14:20:55 +02:00
|
|
|
|
|
|
|
nodes = {"default:snowblock"},
|
|
|
|
|
2018-08-30 16:09:48 +02:00
|
|
|
sound_check = function(def)
|
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
local c = (def.totals["default:snowblock"] or 0)
|
2018-11-02 15:00:18 +01:00
|
|
|
|
2020-06-14 14:20:55 +02:00
|
|
|
if def.pos.y > 50 or c > 150 then
|
|
|
|
return "high_up"
|
2018-08-30 16:09:48 +02:00
|
|
|
end
|
2020-06-14 14:20:55 +02:00
|
|
|
end
|
2018-08-30 16:09:48 +02:00
|
|
|
})
|