many worldgen mods and gonna try technic now
This commit is contained in:
1 parent
bac6ac94a3
commit
548749cb1a
4811 files changed
+163271
-1
No files matched your search
@@ -0,0 +1,47 @@
|
||||
Ambience Redo mod for Minetest
|
||||
by TenPlus1
|
||||
|
||||
Based on Immersive Sounds .36 mod by Neuromancer and optimized to run on servers with a brand new API to quickly and easily add sound sets to your world, it also has new fire sounds for use with Fire Redo mod...
|
||||
|
||||
|
||||
Four new functions are available to add and change sound sets, and two commands to adjust player volume for music and sounds (api.txt file shows detailed usage):
|
||||
|
||||
ambience.add_set(set_name, def)
|
||||
|
||||
ambience.add_to_set(set_name, sound_table)
|
||||
|
||||
ambience.get_set(set_name)
|
||||
|
||||
ambience.del_set(set_name)
|
||||
|
||||
/mvol (volume)
|
||||
/svol (volume)
|
||||
|
||||
|
||||
Changelog:
|
||||
- 0.1 - Initial release
|
||||
- 0.2 - Code change and new water sounds added
|
||||
- 0.3 - Works with Fire Redo mod to provide fire sounds
|
||||
- 0.4 - Code optimized
|
||||
- 0.5 - Changed to kilbiths smaller sound files and removed canadianloon1, adjusted timings
|
||||
- 0.6 - Using new find_nodes_in_area features to count nodes and speed up execution (thanks everamzah)
|
||||
- 0.7 - Code tweaks and added Jungle sounds for day and night time
|
||||
- 0.8 - Override default water sounds for 0.4.14 dev and above, add separate gain for each sound
|
||||
- 0.9 - Plays music files on server or local client when found at midnight, files to be named "ambience_music.1.ogg" changing number each up to 9.
|
||||
- 1.0 - Added icecrack sound when walking on snow/ice flows, also tidied code
|
||||
- 1.1 - Using newer functions, Minetest 0.4.16 and above needed to run
|
||||
- 1.2 - Added PlayerPlus compatibility, removed fire sounds, added volume changes
|
||||
- 1.3 - Added API for use with other mods, code rewrite
|
||||
- 1.4 - Re-ordered water sets to come before fire and lava, day/night sounds play when leaves around and above ground
|
||||
- 1.5 - Added 'flame_sound' and fire redo check, code tidy and tweak, added ephemeral flag for background sounds.
|
||||
- 1.6 - Finding env_sounds disables water and lava sets, added 'ambience_water_move' flag to override water walking sounds, use eye level for head node.
|
||||
- 1.7 - Music will play every 20-30 minutes if found, use '/mvol 0' to stop playing music or disable in-game.
|
||||
- 1.8 - Players can set induvidual volume for sound and music which is saved.
|
||||
- 1.9 - Tidy code, refactor music playing, add biome name to sound_check.
|
||||
- 2.0 - Add Mineclone support, add ethereal leaf check, remove minetest.after for custom timer, add Polish translation, tweak & tidy code.
|
||||
- 2.1 - Add ambience.group_total() function for easy counting of group: nodes inside a set.
|
||||
- 2.2 - Adds background sounds to sets that play looped in the background while normal sounds play on top (when conditions met), and sound chance.
|
||||
- 2.3 - Add 'ambience_music_interval' setting [default is 1200, 0 to disable]. Optimize code.
|
||||
|
||||
|
||||
Code license: MIT
|
||||
@@ -0,0 +1,136 @@
|
||||
|
||||
Ambience Lite API
|
||||
=================
|
||||
|
||||
This short guide will show you how to add sound sets into ambience mod for the
|
||||
api to use and play sounds accordingly. Please note that the order they are
|
||||
added will affect sound checks, so high priority sets first.
|
||||
|
||||
|
||||
Function Usage
|
||||
==============
|
||||
|
||||
|
||||
Adding Sound Set
|
||||
----------------
|
||||
|
||||
ambience.add_set(set_name, def)
|
||||
'set_name' contains the name of the sound set to add
|
||||
'def' contains the following:
|
||||
'frequency' how often the sound set is played (1 to 1000) higher is more
|
||||
'nodes' contains a table of nodes needed for checks
|
||||
'background' contains a table of sounds that play in the background when
|
||||
sound_check conditions are met.
|
||||
'sounds' contains a table of sounds that play on top of any background
|
||||
sounds that can stop when conditions are not met, or can be
|
||||
ephemeral for shorter sounds.
|
||||
'sound_check(def)' function to check if sounds can be played, def contains:
|
||||
'player' player userdata
|
||||
'pos' position of player
|
||||
'tod' time of day
|
||||
'totals' totals for each node e.g. def.totals["default:sand"]
|
||||
'positions' position data for every node found
|
||||
'head_node' name of node at player head level
|
||||
'feet_node' nameof node at player foot level
|
||||
'biome' name of biome at current position
|
||||
|
||||
This will let you add a set or sounds with the frequency it's used and check
|
||||
function for it to play. If ephemeral is true then no handler will be used and sound will be played in background alongside other sounds.
|
||||
|
||||
e.g.
|
||||
|
||||
ambience.add_set("village", {
|
||||
frequency = 500,
|
||||
nodes = {"mymod:village_sound_block"}, -- activates sounds when in range
|
||||
background = {
|
||||
{"name = "village_background", gain = 0.5, fade = 1.0},
|
||||
},
|
||||
sounds = {
|
||||
{name = "dogbark", gain = 0.4, ephemeral = true, chance = 7}, -- quick sound effect
|
||||
{name = "talking_villagers", gain = 0.3, chance = 3}, -- stops when out of range
|
||||
{name = "chicken", gain = 0.6, ephemeral = true, chance = 5},
|
||||
{name = "chicken", gain = 0.6, pitch = 1.2, ephemeral = true, chance = 5},
|
||||
},
|
||||
sound_check = function(def)
|
||||
local number = def.totals["mymod:village_sound_block"] or 0
|
||||
if number > 0 then
|
||||
return "village"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
ambience.add_set("windy", {
|
||||
frequency = 80,
|
||||
nodes = {"default:sand"},
|
||||
sounds = {
|
||||
{name = "wind", length = 9, gain = 0.3, fade = 1.0}, -- fade in sound
|
||||
{name = "desertwind", length = 8, gain = 0.3},
|
||||
{name = "crow", length = 3, ephemeral = true},
|
||||
},
|
||||
sound_check = function(def)
|
||||
local number = def.totals["default:sand"] or 0 -- yep, can also be nil
|
||||
if def.pos.y > 0 and number > 30 then -- above ground near plenty sand
|
||||
return "windy", 0.2 -- return set to play and optional gain volume
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
|
||||
Counting group: nodes
|
||||
---------------------
|
||||
|
||||
Instead of counting each node total for things like leaves within the sound_check function, you could use the following helper function to return their total instead e.g.
|
||||
|
||||
local number = ambience.group_totals(def.totals, "leaves") -- count all group:leaves
|
||||
|
||||
|
||||
Adding sound to existing Set
|
||||
----------------------------
|
||||
|
||||
ambience.add_to_set(set_name, sound_table)
|
||||
|
||||
e.g.
|
||||
|
||||
ambience.add_to_set("cave", {name = "monster_whispers", pitch = 1.2, length = 8})
|
||||
|
||||
|
||||
Getting Sound Set
|
||||
-----------------
|
||||
|
||||
ambience.get_set(set_name)
|
||||
|
||||
This returns a table containing all of the set information like example above.
|
||||
|
||||
e.g.
|
||||
|
||||
local myset = ambience.get_set("windy") -- returns everything inside {} above.
|
||||
|
||||
|
||||
Deleting Sound Set
|
||||
------------------
|
||||
|
||||
ambience.del_set(set_name)
|
||||
|
||||
This will remove a sound set from the list.
|
||||
|
||||
e.g.
|
||||
|
||||
ambience.del_set("windy")
|
||||
|
||||
|
||||
Additional Commands
|
||||
===================
|
||||
|
||||
Two volume commands have been added to set sound and music volume:
|
||||
|
||||
/svol (0.1 to 1.0)
|
||||
/mvol (0.1 to 1.0) -- 0 can be used to stop music curently playing
|
||||
|
||||
|
||||
Music
|
||||
=====
|
||||
|
||||
Music can be stored in the sounds folder either on server or locally and so long
|
||||
as it is named 'ambience_music.1', 'ambience_music.2' etc. then it will select
|
||||
a song randomly to play every 20 minutes.
|
||||
|
||||
@@ -0,0 +1,403 @@
|
||||
|
||||
ambience = {}
|
||||
|
||||
-- settings
|
||||
|
||||
local SOUNDVOLUME = 1.0
|
||||
local MUSICVOLUME = 0.6
|
||||
local MUSICINTERVAL = tonumber(core.settings:get("ambience_music_interval")) or (60 * 20)
|
||||
local radius = 6
|
||||
local playing = {} -- user settings, timers and current set playing
|
||||
local sound_sets = {} -- all the sounds and their settings
|
||||
local sound_set_order = {} -- needed because pairs loops randomly through tables
|
||||
local set_nodes = {} -- all the nodes needed for sets
|
||||
|
||||
-- translation and local
|
||||
|
||||
local S = core.get_translator("ambience")
|
||||
local get_id = core.get_node_raw
|
||||
local get_id_name = core.get_name_from_content_id
|
||||
local get_node = core.get_node
|
||||
|
||||
if get_id then get_node = function(pos)
|
||||
|
||||
local id, p1, p2, pos_ok = get_id(pos.x, pos.y, pos.z)
|
||||
|
||||
return {name = get_id_name(id), param1 = p1, param2 = p2, loaded = pos_ok}
|
||||
end
|
||||
end
|
||||
|
||||
-- add set to list
|
||||
|
||||
function ambience.add_set(set_name, def)
|
||||
|
||||
if not set_name or not def then return end
|
||||
|
||||
sound_sets[set_name] = {
|
||||
frequency = def.frequency or 50,
|
||||
background = def.background or {},
|
||||
sounds = def.sounds or {},
|
||||
sound_check = def.sound_check,
|
||||
nodes = def.nodes
|
||||
}
|
||||
|
||||
-- add set name to the sound_set_order table
|
||||
local can_add = true
|
||||
|
||||
for i = 1, #sound_set_order do
|
||||
|
||||
if sound_set_order[i] == set_name then can_add = false end
|
||||
end
|
||||
|
||||
if can_add then table.insert(sound_set_order, set_name) end
|
||||
|
||||
-- add any missing nodes to the set_nodes table
|
||||
if def.nodes then
|
||||
|
||||
for i = 1, #def.nodes do
|
||||
|
||||
can_add = def.nodes[i]
|
||||
|
||||
for j = 1, #set_nodes do
|
||||
|
||||
if def.nodes[i] == set_nodes[j] then can_add = false end
|
||||
end
|
||||
|
||||
if can_add then table.insert(set_nodes, can_add) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- add sound to existing set
|
||||
|
||||
function ambience.add_to_set(set_name, def)
|
||||
|
||||
if not set_name or not def or not sound_sets[set_name] then return end
|
||||
|
||||
table.insert(sound_sets[set_name].sounds, def)
|
||||
end
|
||||
|
||||
-- return set from list using name
|
||||
|
||||
function ambience.get_set(set_name)
|
||||
return sound_sets[set_name]
|
||||
end
|
||||
|
||||
-- remove set from list
|
||||
|
||||
function ambience.del_set(set_name)
|
||||
|
||||
sound_sets[set_name] = nil
|
||||
|
||||
local can_del = false
|
||||
|
||||
for i = 1, #sound_set_order do
|
||||
|
||||
if sound_set_order[i] == set_name then can_del = i end
|
||||
end
|
||||
|
||||
if can_del then table.remove(sound_set_order, can_del) end
|
||||
end
|
||||
|
||||
-- return node total belonging to a specific group:
|
||||
|
||||
function ambience.group_total(ntab, ngrp)
|
||||
|
||||
local tot = 0
|
||||
local def, grp
|
||||
|
||||
for _,n in pairs(ntab) do
|
||||
|
||||
def = core.registered_nodes[_]
|
||||
grp = def and def.groups and def.groups[ngrp]
|
||||
|
||||
if grp and grp > 0 then
|
||||
tot = tot + n
|
||||
end
|
||||
end
|
||||
|
||||
return tot
|
||||
end
|
||||
|
||||
-- setup table when player joins
|
||||
|
||||
core.register_on_joinplayer(function(player)
|
||||
|
||||
if player then
|
||||
|
||||
local name = player:get_player_name()
|
||||
local meta = player:get_meta()
|
||||
|
||||
playing[name] = {
|
||||
mvol = tonumber(meta:get_string("ambience.mvol")) or MUSICVOLUME,
|
||||
svol = tonumber(meta:get_string("ambience.svol")) or SOUNDVOLUME,
|
||||
timer = 0, music = 0, music_handler = nil, set = "nil"
|
||||
}
|
||||
end
|
||||
end)
|
||||
|
||||
-- remove table when player leaves
|
||||
|
||||
core.register_on_leaveplayer(function(player)
|
||||
if player then playing[player:get_player_name()] = nil end
|
||||
end)
|
||||
|
||||
-- plays music and selects sound set
|
||||
|
||||
local function get_ambience(player, tod, name)
|
||||
|
||||
local p = playing[name]
|
||||
|
||||
-- if enabled, play local/server music on interval check
|
||||
if MUSICINTERVAL > 0 and p and p.mvol > 0 then
|
||||
|
||||
-- increase music time interval
|
||||
p.music = p.music + 1
|
||||
|
||||
-- if not already playing, play music on interval check
|
||||
if p.music > MUSICINTERVAL and not p.music_handler then
|
||||
|
||||
p.music_handler = core.sound_play("ambience_music",
|
||||
{to_player = name, gain = p.mvol})
|
||||
|
||||
p.music = 0 -- reset interval
|
||||
|
||||
-- after 5 minutes (a normal song length) reset music timers
|
||||
elseif p.music_handler and p.music > 300 then
|
||||
|
||||
p.music = 0 ; p.music_handler = nil
|
||||
--print("--- resetting music timers")
|
||||
end
|
||||
--print("-- music timer", playing[name].music .. "/" .. MUSICINTERVAL)
|
||||
end
|
||||
|
||||
-- get foot and head level nodes at player position
|
||||
local pos = player:get_pos() ; if not pos then return end
|
||||
local eyeh = player:get_properties().eye_height or 1.47 -- eye level with fallback
|
||||
local nod_head = get_node({x = pos.x, y = pos.y + eyeh, z = pos.z}).name
|
||||
local nod_feet = get_node({x = pos.x, y = pos.y + 0.2, z = pos.z}).name
|
||||
|
||||
-- get all set nodes around player
|
||||
local ps, cn = core.find_nodes_in_area(
|
||||
{x = pos.x - radius, y = pos.y - radius, z = pos.z - radius},
|
||||
{x = pos.x + radius, y = pos.y + radius, z = pos.z + radius}, set_nodes)
|
||||
|
||||
-- get biome data
|
||||
local bdata = core.get_biome_data(pos)
|
||||
local biome = bdata and core.get_biome_name(bdata.biome) or ""
|
||||
|
||||
-- loop through sets in order and choose first that meets conditions set
|
||||
for n = 1, #sound_set_order do
|
||||
|
||||
local set = sound_sets[ sound_set_order[n] ]
|
||||
|
||||
if set and set.sound_check then
|
||||
|
||||
-- pass settings to set function for condition check
|
||||
local set_name, gain = set.sound_check({
|
||||
player = player,
|
||||
pos = pos,
|
||||
tod = tod,
|
||||
totals = cn,
|
||||
positions = ps,
|
||||
head_node = nod_head,
|
||||
feet_node = nod_feet,
|
||||
biome = biome
|
||||
})
|
||||
|
||||
-- if conditions met return set name and gain value
|
||||
if set_name then return set_name, gain end
|
||||
end
|
||||
end
|
||||
|
||||
return nil, nil
|
||||
end
|
||||
|
||||
-- players routine
|
||||
|
||||
local timer = 0
|
||||
local random = math.random
|
||||
|
||||
core.register_globalstep(function(dtime)
|
||||
|
||||
local players = core.get_connected_players()
|
||||
local pname
|
||||
|
||||
-- reduce sound timer for each player and stop/reset when needed
|
||||
for _, player in pairs(players) do
|
||||
|
||||
pname = player:get_player_name()
|
||||
|
||||
local p = playing[pname]
|
||||
|
||||
if p and p.timer and p.timer > 0 then
|
||||
|
||||
p.timer = p.timer - dtime
|
||||
|
||||
if p.timer <= 0 then
|
||||
|
||||
if p.handler then
|
||||
core.sound_stop(p.handler)
|
||||
end
|
||||
|
||||
p.set = nil ; p.gain = nil ; p.handler = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- one second timer
|
||||
timer = timer + dtime ; if timer < 1 then return end ; timer = 0
|
||||
|
||||
local tod = core.get_timeofday()
|
||||
|
||||
-- loop through players
|
||||
for _, player in pairs(players) do
|
||||
|
||||
pname = player:get_player_name()
|
||||
|
||||
local p = playing[pname]
|
||||
local set_name, MORE_GAIN = get_ambience(player, tod, pname)
|
||||
local set_def = sound_sets[set_name]
|
||||
local ok = p and true -- everything starts off ok if player found
|
||||
|
||||
-- are we playing any available background sounds?
|
||||
if ok and not p.bg and set_def and #set_def.background > 0 then
|
||||
|
||||
-- choose a random sound from the background set
|
||||
local bg_num = random(#set_def.background)
|
||||
local bg_amb = set_def.background[bg_num]
|
||||
|
||||
-- only play sound if set differs from last one played
|
||||
if set_name ~= p.bg_set then
|
||||
|
||||
p.bg = core.sound_play(bg_amb.name, {
|
||||
to_player = pname,
|
||||
gain = (bg_amb.gain or 0.3) * p.svol,
|
||||
pitch = bg_amb.pitch, fade = bg_amb.fade, loop = true
|
||||
})
|
||||
|
||||
--print("-- bg start", p.bg, set_name)
|
||||
|
||||
p.bg_set = set_name
|
||||
end
|
||||
|
||||
elseif ok and p.bg and set_name ~= p.bg_set then
|
||||
|
||||
--print("-- bg stop", p.bg, set_name, p.bg_set)
|
||||
|
||||
core.sound_stop(p.bg)
|
||||
|
||||
p.bg = nil ; p.bg_set = nil
|
||||
end
|
||||
|
||||
if ok and p.handler then -- are we playing something already?
|
||||
|
||||
-- stop current sound if another set active or gain changed
|
||||
if p.set ~= set_name or p.gain ~= MORE_GAIN then
|
||||
|
||||
--print ("-- change stop", set_name, p.handler)
|
||||
|
||||
core.sound_stop(p.handler)
|
||||
|
||||
p.set = nil ; p.gain = nil ; p.handler = nil ; p.timer = 0
|
||||
else
|
||||
ok = false -- sound set still playing, skip new sound
|
||||
end
|
||||
end
|
||||
|
||||
local chance = random(1000)
|
||||
|
||||
-- if chance is lower than set frequency then use set
|
||||
if ok and set_name and chance < set_def.frequency
|
||||
and set_def.sounds and #set_def.sounds > 0 then
|
||||
|
||||
local amb = set_def.sounds[random(#set_def.sounds)] -- choose random set
|
||||
|
||||
-- selected sound chance of playing from a set
|
||||
if random((amb.chance or 1)) == 1 then
|
||||
|
||||
-- play sound
|
||||
p.handler = core.sound_play(amb.name, {
|
||||
to_player = pname,
|
||||
gain = ((amb.gain or 0.3) + (MORE_GAIN or 0)) * p.svol,
|
||||
pitch = amb.pitch or 1.0, fade = amb.fade
|
||||
}, amb.ephemeral)
|
||||
|
||||
--print ("playing... " .. amb.name .. " (" .. chance .. " < "
|
||||
-- .. p.frequency .. ") @ ", MORE_GAIN, p.handler)
|
||||
end
|
||||
|
||||
-- save what player is currently listening to if handler found
|
||||
if p.handler then
|
||||
p.set = set_name ; p.gain = MORE_GAIN ; p.timer = (amb.length or 5)
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- sound volume command
|
||||
|
||||
core.register_chatcommand("svol", {
|
||||
params = S("<svol>"),
|
||||
description = S("set sound volume (0.1 to 1.0)"),
|
||||
privs = {},
|
||||
|
||||
func = function(name, param)
|
||||
|
||||
local svol = tonumber(param) or playing[name].svol
|
||||
|
||||
if svol < 0.1 then svol = 0.1 end
|
||||
if svol > 1.0 then svol = 1.0 end
|
||||
|
||||
local player = core.get_player_by_name(name)
|
||||
local meta = player:get_meta()
|
||||
|
||||
meta:set_string("ambience.svol", svol)
|
||||
|
||||
playing[name].svol = svol
|
||||
|
||||
return true, S("Sound volume set to @1", svol)
|
||||
end
|
||||
})
|
||||
|
||||
-- music volume command (0 stops music)
|
||||
|
||||
core.register_chatcommand("mvol", {
|
||||
params = S("<mvol>"),
|
||||
description = S("set music volume (0.1 to 1.0, 0 to stop music)"),
|
||||
privs = {},
|
||||
|
||||
func = function(name, param)
|
||||
|
||||
local mvol = tonumber(param) or playing[name].mvol
|
||||
|
||||
-- stop music currently playing by setting volume to 0
|
||||
if mvol == 0 and playing[name].music_handler then
|
||||
|
||||
core.sound_stop(playing[name].music_handler)
|
||||
|
||||
playing[name].music_handler = nil
|
||||
|
||||
core.chat_send_player(name, S("Music stopped!"))
|
||||
end
|
||||
|
||||
if mvol < 0 then mvol = 0 end
|
||||
if mvol > 1.0 then mvol = 1.0 end
|
||||
|
||||
local player = core.get_player_by_name(name)
|
||||
local meta = player:get_meta()
|
||||
|
||||
meta:set_string("ambience.mvol", mvol)
|
||||
|
||||
playing[name].mvol = mvol
|
||||
|
||||
return true, S("Music volume set to @1", mvol)
|
||||
end
|
||||
})
|
||||
|
||||
-- load default sound sets
|
||||
|
||||
dofile(core.get_modpath("ambience") .. "/soundsets.lua")
|
||||
|
||||
|
||||
print("[MOD] Ambience Lite loaded")
|
||||
@@ -0,0 +1,95 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022 TenPlus1
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
Sound licenses:
|
||||
|
||||
--Nightime Sound, Recorded by Mike Koenig, License: Attribution 3.0 http://soundbible.com/951-Nightime.html
|
||||
|
||||
--Crickets At Night Sound, License: Attribution 3.0 | Recorded by Mike Koenig |http://soundbible.com/365-Crickets-At-Night.html
|
||||
|
||||
--Medium Pack Of Wolves Howling, License: Public Domain | Recorded by fws.gov, http://soundbible.com/277-Medium-Pack-Of-Wolves-Howling.html
|
||||
|
||||
--Horned Owl Sound, License: Attribution 3.0 | Recorded by Mike Koenig , http://soundbible.com/1851-Horned-Owl.html
|
||||
|
||||
--Bats In Cave Sound, License: CC0 | Recorded by SaloSensei , https://freesound.org/people/SaloSensei/sounds/616219/
|
||||
|
||||
--Spooky Water Drops Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/380-Spooky-Water-Drops.html
|
||||
|
||||
-- Single Water Droplet Sound, License: Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/384-Single-Water-Droplet.html
|
||||
|
||||
--HollowWind, Black Boe, Creative Commons 0 License, http://www.freesound.org/people/Black%20Boe/sounds/22331/
|
||||
|
||||
--drippingwater*.ogg sounds: CC0, Dripping Water Mod, by kddekadenz, http://minetest.net/forum/viewtopic.php?id=1688
|
||||
|
||||
--best cardinal bird: License: Attribution 3.0 | Recorded by PsychoBird, http://soundbible.com/1515-Best-Cardinal-Bird.html
|
||||
|
||||
--birdsongnl: the Attribution License, HerbertBoland, http://www.freesound.org/people/HerbertBoland/sounds/28312/ (end)
|
||||
|
||||
--robin2: Attribution License, reinsamba, http://www.freesound.org/people/reinsamba/sounds/32479/ (end)
|
||||
|
||||
--Craw.WAV, Attribution License, inchadney, http://www.freesound.org/people/inchadney/sounds/52450/
|
||||
|
||||
--bluejay.wav, Creative Commons 0 License, UncleSigmund, http://www.freesound.org/people/UncleSigmund/sounds/42382/
|
||||
|
||||
--scuba1*.ogg- digifishmusic, Attribution License, http://www.freesound.org/people/digifishmusic/sounds/45521/
|
||||
|
||||
--dolphin_screaming - Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/161691/
|
||||
|
||||
ComboWind uses:
|
||||
--wind-in-the-trees -Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/16995/
|
||||
--drygrassInWind- Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/146436/
|
||||
|
||||
--Splash: Attribution 3.0 | Recorded by BlastwaveFx.com, http://soundbible.com/546-Fish-Splashing.html
|
||||
|
||||
--small_waterfall Attribution License, volivieri, http://www.freesound.org/people/volivieri/sounds/38390/
|
||||
|
||||
--Lake_Waves_2*, Attribution License, Benboncan, http://www.freesound.org/people/Benboncan/sounds/67884/
|
||||
|
||||
--earth01a, Creative Commons 0 License., Halion , http://www.freesound.org/people/Halion/sounds/17785
|
||||
|
||||
--fiji_beach, Creative Commons 0 License, c97059890, http://www.freesound.org/people/c97059890/sounds/21754/
|
||||
|
||||
--seagull, Attribution 3.0 License., hazure, http://www.freesound.org/people/hazure/sounds/23707/,
|
||||
|
||||
--seagull_2, DonnyDB -- https://freesound.org/s/765399/ -- License: Attribution NonCommercial 4.0
|
||||
desert:
|
||||
coyote2, Attribution License, rogerforeman, http://www.freesound.org/people/rogerforeman/sounds/68068/
|
||||
http://www.freesound.org/people/Proxima4/sounds/104319/
|
||||
Desert Monolith.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104319/
|
||||
Rattlesnake Rattle, Public Domain, fws.gov, http://soundbible.com/237-Rattlesnake-Rattle.html
|
||||
|
||||
flying:
|
||||
crystal_airlines: Attribution License, suonho, http://www.freesound.org/people/suonho/sounds/56364/
|
||||
|
||||
desert wind:
|
||||
Desert Simple.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104320/
|
||||
|
||||
http://www.freesfx.co.uk/soundeffects/forests-jungles/
|
||||
|
||||
icecrack.ogg by ecfike, Creative Commons 0 license (https://freesound.org/people/ecfike/sounds/177212/)
|
||||
|
||||
big_splash.ogg by gubodup, Creative Commons 0 License (https://freesound.org/people/qubodup/sounds/442773/)
|
||||
|
||||
wooden_frog, wooden frog e.WAV by ERH -- https://freesound.org/s/34512/ -- License: Attribution 4.0
|
||||
|
||||
screenshot.jpg created using https://www.textstudio.com/ image by swvrsy (cc0)
|
||||
@@ -0,0 +1,7 @@
|
||||
# textdomain: ambience
|
||||
<svol>=<slaŭtec>
|
||||
set sound volume (0.1 to 1.0)=agordi sonlaŭtecon (0.1 ĝis 1.0)
|
||||
Sound volume set to @1=Sonlaŭteco agordita al @1
|
||||
<mvol>=<mlaŭtec>
|
||||
set music volume (0.1 to 1.0, 0 to stop music)=agordi muziklaŭtecon (0.1 ĝis 1.0; malŝalti muzikon per 0)
|
||||
Music volume set to @1=Muziklaŭteco agordita al @1
|
||||
@@ -0,0 +1,7 @@
|
||||
# textdomain: ambience
|
||||
<svol>=<volumen de sonido>
|
||||
set sound volume (0.1 to 1.0)=establecer volumen de sonido (0.1 a 1.0)
|
||||
Sound volume set to @1=Volumen de sonido establecido a @1
|
||||
<mvol>=<volumen de música>
|
||||
set music volume (0.1 to 1.0, 0 to stop music)=establecer volumen de música (0.1 a 1.0, 0 para detener la música)
|
||||
Music volume set to @1=Volumen de música establecido a @1
|
||||
@@ -0,0 +1,7 @@
|
||||
# textdomain: ambience
|
||||
<svol>=<sgłośność>
|
||||
set sound volume (0.1 to 1.0)=ustaw głośność dźwięku (0.1 do 1.0)
|
||||
Sound volume set to @1=Głośność dźwięku ustawiona na @1
|
||||
<mvol>=<mgłośność>
|
||||
set music volume (0.1 to 1.0, 0 to stop music)=ustaw głośność muzyki (0.1 do 1.0, 0 aby zatrzymać muzykę)
|
||||
Music volume set to @1=Głośność muzyki ustawiona na @1
|
||||
@@ -0,0 +1,7 @@
|
||||
# textdomain: ambience
|
||||
<svol>=
|
||||
set sound volume (0.1 to 1.0)=
|
||||
Sound volume set to @1=
|
||||
<mvol>=
|
||||
set music volume (0.1 to 1.0, 0 to stop music)=
|
||||
Music volume set to @1=
|
||||
@@ -0,0 +1,4 @@
|
||||
name = ambience
|
||||
description = Adds realistic sound effects into your world.
|
||||
optional_depends = default, mcl_core, mclx_core
|
||||
min_minetest_version = 5.0
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 119 KiB |
@@ -0,0 +1,5 @@
|
||||
ambience_music_interval (Ambience music interval [0 to disable]) int 1200
|
||||
|
||||
ambience_water_move (Ambience water movement) bool true
|
||||
|
||||
ambience_water_splash (Big splash when jumping in water) bool false
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
|
||||
Royalty-Free to Use (https://pixabay.com/sound-effects/film-special-effects-0005-crystal-lamp-with-swing-front-107459/)
|
||||
caverealms_crystal.ogg
|
||||
|
||||
Royalty Free to Use (https://pixabay.com/sound-effects/film-special-effects-deep-whoosh-bass-impact-effect-04-407108/)
|
||||
caverealms_deep_whoosh.ogg
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,510 @@
|
||||
--[[
|
||||
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 = core.get_modpath("default")
|
||||
local mod_mcl = core.get_modpath("mcl_core")
|
||||
|
||||
-- Big Splash jumping in water
|
||||
|
||||
if core.settings:get_bool("ambience_water_splash") == true then
|
||||
|
||||
local players = {}
|
||||
|
||||
core.register_on_joinplayer(function(player)
|
||||
players[player:get_player_name()] = {in_water = nil, old_pos = -31000}
|
||||
end)
|
||||
|
||||
core.register_on_leaveplayer(function(player)
|
||||
players[player:get_player_name()] = nil
|
||||
end)
|
||||
|
||||
ambience.add_set("big_splash", {
|
||||
|
||||
frequency = 1000,
|
||||
|
||||
sounds = {
|
||||
{name = "big_splash", gain = 0.3, length = 4, ephemeral = true},
|
||||
{name = "big_splash", gain = 0.3, length = 4, ephemeral = true, pitch = 0.9},
|
||||
{name = "big_splash", gain = 0.3, length = 4, ephemeral = true, pitch = 1.1}
|
||||
},
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
local hdef = core.registered_nodes[def.head_node]
|
||||
local fdef = core.registered_nodes[def.feet_node]
|
||||
local name = def.player:get_player_name()
|
||||
|
||||
if hdef and hdef.groups.water and fdef and fdef.groups.water then
|
||||
|
||||
local diff = players[name].old_pos - def.pos.y
|
||||
|
||||
if not players[name].in_water and diff > 1 then
|
||||
|
||||
players[name].in_water = 2
|
||||
|
||||
return "big_splash"
|
||||
end
|
||||
|
||||
players[name].in_water = 2
|
||||
else
|
||||
if fdef and fdef.groups.water then
|
||||
players[name].in_water = 1
|
||||
else
|
||||
players[name].in_water = nil
|
||||
end
|
||||
end
|
||||
|
||||
players[name].old_pos = def.pos.y
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
-- Underwater sounds play when player head is submerged
|
||||
|
||||
ambience.add_set("underwater", {
|
||||
|
||||
frequency = 1000,
|
||||
|
||||
-- This is an example of how it could be used as a background sound also
|
||||
-- background = {
|
||||
-- {name = "scuba", length = 8},
|
||||
-- {name = "scuba", pitch = 1.2, length = 8}
|
||||
-- },
|
||||
|
||||
sounds = {
|
||||
{name = "scuba", length = 8, loop = true}
|
||||
},
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
local nodef = core.registered_nodes[def.head_node]
|
||||
|
||||
if nodef and nodef.groups.water then
|
||||
return "underwater"
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- add new sound to above set
|
||||
|
||||
ambience.add_to_set("underwater", {name = "scuba", pitch = 1.2, length = 8, loop = true})
|
||||
|
||||
-- Splashing sound plays when player walks inside water nodes (if enabled)
|
||||
|
||||
if core.settings:get_bool("ambience_water_move") ~= false then
|
||||
|
||||
-- override default water sounds
|
||||
|
||||
if mod_def then
|
||||
core.override_item("default:water_source", { sounds = {} })
|
||||
core.override_item("default:water_flowing", { sounds = {} })
|
||||
core.override_item("default:river_water_source", { sounds = {} })
|
||||
core.override_item("default:river_water_flowing", { sounds = {} })
|
||||
elseif mod_mcl then
|
||||
core.override_item("mcl_core:water_source", { sounds = {} })
|
||||
core.override_item("mcl_core:water_flowing", { sounds = {} })
|
||||
core.override_item("mclx_core:river_water_source", { sounds = {} })
|
||||
core.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 = core.registered_nodes[def.feet_node]
|
||||
|
||||
if nodef 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 core.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 - Using env_sounds for water and lava sounds.")
|
||||
end
|
||||
|
||||
-- Beach sounds play when pos above 0 and below 6 and 100+ water source found
|
||||
|
||||
ambience.add_set("beach", {
|
||||
|
||||
frequency = 40,
|
||||
|
||||
background = {
|
||||
{name = "beach", length = 13},
|
||||
},
|
||||
|
||||
sounds = {
|
||||
{name = "seagull", length = 4.5, ephemeral = true, chance = 2},
|
||||
{name = "seagull", length = 4.5, pitch = 1.2, ephemeral = true, chance = 2},
|
||||
--{name = "beach", length = 13},
|
||||
{name = "gull", length = 1, ephemeral = true, chance = 2},
|
||||
{name = "seagull_2", length = 4, ephemeral = true, chance = 2}
|
||||
},
|
||||
|
||||
nodes = {"group:water"},
|
||||
|
||||
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 > 0 and def.pos.y < 6 and c > 100 then
|
||||
return "beach"
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Ice sounds play when 100 or more ice are nearby
|
||||
|
||||
ambience.add_set("ice", {
|
||||
|
||||
frequency = 80,
|
||||
|
||||
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 > 400 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},
|
||||
{name = "wooden_frog", length = 2, gain = 0.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},
|
||||
{name = "wooden_frog", length = 2, gain = 0.2, 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)
|
||||
|
||||
-- use handy function to count all nodes in group:leaves
|
||||
local c = ambience.group_total(def.totals, "leaves")
|
||||
|
||||
if (def.tod > 0.2 and def.tod < 0.8) and def.pos.y > 0 and c > 50 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},
|
||||
{name = "wind", length = 9}
|
||||
},
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
-- use handy function to count all nodes in group:leaves
|
||||
local c = ambience.group_total(def.totals, "leaves")
|
||||
|
||||
if (def.tod < 0.2 or def.tod > 0.8) and def.pos.y > 0 and c > 50 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
|
||||
})
|
||||
|
||||
-- caverealms sounds
|
||||
|
||||
if core.get_modpath("caverealms") then
|
||||
|
||||
-- salt crystal biome
|
||||
|
||||
ambience.add_set("caverealms_crystal", {
|
||||
|
||||
frequency = 50,
|
||||
|
||||
sounds = {
|
||||
{name = "caverealms_crystal", length = 3, ephemeral = true},
|
||||
{name = "caverealms_crystal", length = 3, pitch = 0.9, ephemeral = true},
|
||||
{name = "caverealms_crystal", length = 3, pitch = 1.2, ephemeral = true},
|
||||
},
|
||||
|
||||
nodes = ({"caverealms:stone_with_salt"}),
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
local c = (def.totals["caverealms:stone_with_salt"] or 0)
|
||||
|
||||
if c > 250 then return "caverealms_crystal" end
|
||||
end
|
||||
})
|
||||
|
||||
-- moss, algae, lichen area rumble
|
||||
|
||||
ambience.add_set("caverealms_rumble", {
|
||||
|
||||
frequency = 50,
|
||||
|
||||
sounds = {
|
||||
{name = "caverealms_deep_whoosh", length = 3, ephemeral = true},
|
||||
{name = "caverealms_deep_whoosh", length = 3, pitch = 0.6, ephemeral = true},
|
||||
{name = "caverealms_deep_whoosh", length = 3, pitch = 0.8, ephemeral = true},
|
||||
},
|
||||
|
||||
nodes = ({"caverealms:stone_with_moss", "caverealms:stone_with_algae",
|
||||
"caverealms:stone_with_lichen"}),
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
local c = (def.totals["caverealms:stone_with_moss"] or 0) +
|
||||
(def.totals["caverealms:stone_with_algae"] or 0) +
|
||||
(def.totals["caverealms:stone_with_lichen"] or 0)
|
||||
|
||||
if def.pos.y < -50 and c > 150 then return "caverealms_rumble" end
|
||||
end
|
||||
})
|
||||
end
|
||||
Reference in new issue
Block a user