Mehr Mods hinzugefügt
This commit is contained in:
parent
92a55732cf
commit
9e345a25fb
2805 changed files with 2096013 additions and 0 deletions
28
mods/ambience/README.md
Normal file
28
mods/ambience/README.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
Ambience Redo mod for Minetest
|
||||
by TenPlus1
|
||||
|
||||
Based on Immersive Sounds .36 mod by Neuromancer and optimized to run on servers with new fire sounds added when Fire Redo mod is detected...
|
||||
|
||||
- 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.
|
||||
|
||||
Code license: MIT
|
101
mods/ambience/api.txt
Normal file
101
mods/ambience/api.txt
Normal file
|
@ -0,0 +1,101 @@
|
|||
|
||||
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
|
||||
'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("windy", {
|
||||
frequency = 500,
|
||||
nodes = {"default:sand"},
|
||||
sounds = {
|
||||
{name = "wind", length = 9, gain = 0.3},
|
||||
{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 number > 20 then
|
||||
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
|
||||
|
||||
|
||||
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.
|
||||
|
367
mods/ambience/init.lua
Normal file
367
mods/ambience/init.lua
Normal file
|
@ -0,0 +1,367 @@
|
|||
|
||||
-- global
|
||||
|
||||
ambience = {}
|
||||
|
||||
-- settings
|
||||
|
||||
local SOUNDVOLUME = 1.0
|
||||
local MUSICVOLUME = 0.6
|
||||
local MUSICINTERVAL = 60 * 20
|
||||
local play_music = core.settings:get_bool("ambience_music") ~= false
|
||||
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
|
||||
|
||||
local S = core.get_translator("ambience")
|
||||
|
||||
-- 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,
|
||||
sounds = def.sounds,
|
||||
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
|
||||
|
||||
-- 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
|
||||
}
|
||||
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)
|
||||
|
||||
-- if enabled and not already playing, play local/server music on interval check
|
||||
if play_music and playing[name] and playing[name].mvol > 0 then
|
||||
|
||||
-- increase music time interval
|
||||
playing[name].music = playing[name].music + 1
|
||||
|
||||
-- play music on interval check
|
||||
if playing[name].music > MUSICINTERVAL and playing[name].music_handler == nil then
|
||||
|
||||
playing[name].music_handler = core.sound_play("ambience_music", {
|
||||
to_player = name,
|
||||
gain = playing[name].mvol
|
||||
})
|
||||
|
||||
playing[name].music = 0 -- reset interval
|
||||
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 prop = player:get_properties()
|
||||
local eyeh = prop.eye_height or 1.47 -- eye level with fallback
|
||||
|
||||
pos.y = pos.y + eyeh -- head level
|
||||
|
||||
local nod_head = core.get_node(pos).name
|
||||
|
||||
pos.y = (pos.y - eyeh) + 0.2 -- foot level
|
||||
|
||||
local nod_feet = core.get_node(pos).name
|
||||
|
||||
pos.y = pos.y - 0.2 -- reset pos
|
||||
|
||||
-- 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)
|
||||
|
||||
-- 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
|
||||
|
||||
-- get biome data
|
||||
local bdata = core.get_biome_data(pos)
|
||||
local biome = bdata and core.get_biome_name(bdata.biome) or ""
|
||||
|
||||
-- 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()
|
||||
|
||||
if playing[pname] and playing[pname].timer > 0 then
|
||||
|
||||
playing[pname].timer = playing[pname].timer - dtime
|
||||
|
||||
if playing[pname].timer <= 0 then
|
||||
|
||||
if playing[pname].handler then
|
||||
core.sound_stop(playing[pname].handler)
|
||||
end
|
||||
|
||||
playing[pname].set = nil
|
||||
playing[pname].gain = nil
|
||||
playing[pname].handler = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- one second timer
|
||||
timer = timer + dtime ; if timer < 1 then return end ; timer = 0
|
||||
|
||||
local number, chance, ambience, handler, ok
|
||||
local tod = core.get_timeofday()
|
||||
|
||||
-- loop through players
|
||||
for _, player in pairs(players) do
|
||||
|
||||
pname = player:get_player_name()
|
||||
|
||||
local set_name, MORE_GAIN = get_ambience(player, tod, pname)
|
||||
|
||||
ok = playing[pname] -- everything starts off ok if player found
|
||||
|
||||
-- are we playing something already?
|
||||
if ok and playing[pname].handler then
|
||||
|
||||
-- stop current sound if another set active or gain changed
|
||||
if playing[pname].set ~= set_name
|
||||
or playing[pname].gain ~= MORE_GAIN then
|
||||
|
||||
--print ("-- change stop", set_name, playing[pname].handler)
|
||||
|
||||
core.sound_stop(playing[pname].handler)
|
||||
|
||||
playing[pname].set = nil
|
||||
playing[pname].gain = nil
|
||||
playing[pname].handler = nil
|
||||
playing[pname].timer = 0
|
||||
else
|
||||
ok = false -- sound set still playing, skip new sound
|
||||
end
|
||||
end
|
||||
|
||||
-- set random chance
|
||||
chance = random(1000)
|
||||
|
||||
-- if chance is lower than set frequency then select set
|
||||
if ok and set_name and chance < sound_sets[set_name].frequency then
|
||||
|
||||
number = random(#sound_sets[set_name].sounds) -- choose random sound from set
|
||||
ambience = sound_sets[set_name].sounds[number] -- grab sound information
|
||||
|
||||
-- play sound
|
||||
handler = core.sound_play(ambience.name, {
|
||||
to_player = pname,
|
||||
gain = ((ambience.gain or 0.3) + (MORE_GAIN or 0)) * playing[pname].svol,
|
||||
pitch = ambience.pitch or 1.0
|
||||
}, ambience.ephemeral)
|
||||
|
||||
--print ("playing... " .. ambience.name .. " (" .. chance .. " < "
|
||||
-- .. sound_sets[set_name].frequency .. ") @ ", MORE_GAIN, handler)
|
||||
|
||||
if handler then
|
||||
|
||||
-- set what player is currently listening to if handler found
|
||||
playing[pname].set = set_name
|
||||
playing[pname].gain = MORE_GAIN
|
||||
playing[pname].handler = handler
|
||||
playing[pname].timer = ambience.length
|
||||
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")
|
88
mods/ambience/license.txt
Normal file
88
mods/ambience/license.txt
Normal file
|
@ -0,0 +1,88 @@
|
|||
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/,
|
||||
|
||||
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/)
|
7
mods/ambience/locale/ambience.eo.tr
Normal file
7
mods/ambience/locale/ambience.eo.tr
Normal file
|
@ -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
|
7
mods/ambience/locale/ambience.es.tr
Normal file
7
mods/ambience/locale/ambience.es.tr
Normal file
|
@ -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
|
7
mods/ambience/locale/ambience.pl.tr
Normal file
7
mods/ambience/locale/ambience.pl.tr
Normal file
|
@ -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
|
7
mods/ambience/locale/template.txt
Normal file
7
mods/ambience/locale/template.txt
Normal file
|
@ -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=
|
7
mods/ambience/mod.conf
Normal file
7
mods/ambience/mod.conf
Normal file
|
@ -0,0 +1,7 @@
|
|||
name = ambience
|
||||
description = Adds realistic sound effects into your world.
|
||||
optional_depends = default, mcl_core, mclx_core
|
||||
min_minetest_version = 5.0
|
||||
release = 30923
|
||||
author = TenPlus1
|
||||
title = Ambience
|
BIN
mods/ambience/screenshot.jpg
Normal file
BIN
mods/ambience/screenshot.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 96 KiB |
5
mods/ambience/settingtypes.txt
Normal file
5
mods/ambience/settingtypes.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
# If enabled will play a random music file from ./minetest/sounds at midnight
|
||||
ambience_music (Ambience music) bool true
|
||||
|
||||
# If enabled then ambience will take over sounds when moving in water
|
||||
ambience_water_move (Ambience water movement) bool true
|
BIN
mods/ambience/sounds/bats.ogg
Normal file
BIN
mods/ambience/sounds/bats.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/beach.ogg
Normal file
BIN
mods/ambience/sounds/beach.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/beach_2.ogg
Normal file
BIN
mods/ambience/sounds/beach_2.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/bird1.ogg
Normal file
BIN
mods/ambience/sounds/bird1.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/bird2.ogg
Normal file
BIN
mods/ambience/sounds/bird2.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/bluejay.ogg
Normal file
BIN
mods/ambience/sounds/bluejay.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/canadianloon2.ogg
Normal file
BIN
mods/ambience/sounds/canadianloon2.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/cardinal.ogg
Normal file
BIN
mods/ambience/sounds/cardinal.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/coyote.ogg
Normal file
BIN
mods/ambience/sounds/coyote.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/craw.ogg
Normal file
BIN
mods/ambience/sounds/craw.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/crestedlark.ogg
Normal file
BIN
mods/ambience/sounds/crestedlark.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/cricket.ogg
Normal file
BIN
mods/ambience/sounds/cricket.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/deer.ogg
Normal file
BIN
mods/ambience/sounds/deer.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/desertwind.ogg
Normal file
BIN
mods/ambience/sounds/desertwind.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/drippingwater1.ogg
Normal file
BIN
mods/ambience/sounds/drippingwater1.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/drippingwater2.ogg
Normal file
BIN
mods/ambience/sounds/drippingwater2.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/frog.ogg
Normal file
BIN
mods/ambience/sounds/frog.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/gull.ogg
Normal file
BIN
mods/ambience/sounds/gull.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/hornedowl.ogg
Normal file
BIN
mods/ambience/sounds/hornedowl.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/icecrack.ogg
Normal file
BIN
mods/ambience/sounds/icecrack.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/jungle_day_1.ogg
Normal file
BIN
mods/ambience/sounds/jungle_day_1.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/jungle_night_1.ogg
Normal file
BIN
mods/ambience/sounds/jungle_night_1.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/jungle_night_2.ogg
Normal file
BIN
mods/ambience/sounds/jungle_night_2.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/lava.ogg
Normal file
BIN
mods/ambience/sounds/lava.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/peacock.ogg
Normal file
BIN
mods/ambience/sounds/peacock.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/river.ogg
Normal file
BIN
mods/ambience/sounds/river.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/robin.ogg
Normal file
BIN
mods/ambience/sounds/robin.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/scuba.ogg
Normal file
BIN
mods/ambience/sounds/scuba.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/seagull.ogg
Normal file
BIN
mods/ambience/sounds/seagull.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/waterfall.ogg
Normal file
BIN
mods/ambience/sounds/waterfall.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/wind.ogg
Normal file
BIN
mods/ambience/sounds/wind.ogg
Normal file
Binary file not shown.
BIN
mods/ambience/sounds/wolves.ogg
Normal file
BIN
mods/ambience/sounds/wolves.ogg
Normal file
Binary file not shown.
385
mods/ambience/soundsets.lua
Normal file
385
mods/ambience/soundsets.lua
Normal file
|
@ -0,0 +1,385 @@
|
|||
--[[
|
||||
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")
|
||||
|
||||
-- Underwater sounds play when player head is submerged
|
||||
|
||||
ambience.add_set("underwater", {
|
||||
|
||||
frequency = 1000,
|
||||
|
||||
sounds = {
|
||||
{name = "scuba", length = 8}
|
||||
},
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
local nodef = core.registered_nodes[def.head_node]
|
||||
|
||||
if nodef and nodef.groups and nodef.groups.water then
|
||||
return "underwater"
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Splashing sound plays when player walks inside water nodes (if enabled)
|
||||
|
||||
if 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 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 - found env_sounds, using for water and lava sounds.")
|
||||
end
|
||||
|
||||
-- Beach sounds play when below y-pos 6 and 150+ water source found
|
||||
|
||||
ambience.add_set("beach", {
|
||||
|
||||
frequency = 40,
|
||||
|
||||
sounds = {
|
||||
{name = "seagull", length = 4.5, ephemeral = true},
|
||||
{name = "seagull", length = 4.5, pitch = 1.2, ephemeral = true},
|
||||
{name = "beach", length = 13},
|
||||
{name = "gull", length = 1, ephemeral = true},
|
||||
{name = "beach_2", length = 6}
|
||||
},
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
local c = (def.totals["default:water_source"] or 0)
|
||||
+ (def.totals["mcl_core:water_source"] or 0)
|
||||
|
||||
if def.pos.y < 6 and def.pos.y > 0 and c > 150 then
|
||||
return "beach"
|
||||
end
|
||||
end
|
||||
})
|
||||
|
||||
-- Ice sounds play when 100 or more ice are nearby
|
||||
|
||||
ambience.add_set("ice", {
|
||||
|
||||
frequency = 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}
|
||||
},
|
||||
|
||||
nodes = {(mod_mcl and "mcl_trees:tree_jungle" or "default:jungletree")},
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
local c = (def.totals["default:jungletree"] or 0)
|
||||
+ (def.totals["mcl_trees:tree_jungle"] or 0)
|
||||
|
||||
if def.tod > 0.2 and def.tod < 0.8 and c > 79 then return "jungle" end
|
||||
end
|
||||
})
|
||||
|
||||
-- Jungle sounds play during night and when around 90 jungletree trunks
|
||||
|
||||
ambience.add_set("jungle_night", {
|
||||
|
||||
frequency = 200,
|
||||
|
||||
sounds = {
|
||||
{name = "jungle_night_1", length = 4, ephemeral = true},
|
||||
{name = "jungle_night_2", length = 4, ephemeral = true},
|
||||
{name = "deer", length = 7, ephemeral = true},
|
||||
{name = "frog", length = 1, ephemeral = true},
|
||||
{name = "frog", length = 1, pitch = 1.3, ephemeral = true}
|
||||
},
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
-- jungle tree was added in last set, so doesnt need to be added in this one
|
||||
local c = (def.totals["default:jungletree"] or 0)
|
||||
+ (def.totals["mcl_trees:tree_jungle"] or 0)
|
||||
|
||||
if (def.tod < 0.2 or def.tod > 0.8) and c > 79 then return "jungle_night" end
|
||||
end
|
||||
})
|
||||
|
||||
-- Daytime sounds play during day when around leaves and above ground
|
||||
|
||||
ambience.add_set("day", {
|
||||
|
||||
frequency = 40,
|
||||
|
||||
sounds = {
|
||||
{name = "cardinal", length = 3, ephemeral = true},
|
||||
{name = "craw", length = 3, ephemeral = true},
|
||||
{name = "bluejay", length = 6, ephemeral = true},
|
||||
{name = "robin", length = 4, ephemeral = true},
|
||||
{name = "robin", length = 4, pitch = 1.2, ephemeral = true},
|
||||
{name = "bird1", length = 11},
|
||||
{name = "bird2", length = 6, ephemeral = true},
|
||||
{name = "crestedlark", length = 6, ephemeral = true},
|
||||
{name = "crestedlark", length = 6, pitch = 1.1, ephemeral = true},
|
||||
{name = "peacock", length = 2, ephemeral = true},
|
||||
{name = "peacock", length = 2, pitch = 1.2, ephemeral = true},
|
||||
{name = "wind", length = 9}
|
||||
},
|
||||
|
||||
nodes = {"group:leaves"},
|
||||
|
||||
sound_check = function(def)
|
||||
|
||||
-- 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
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue