Add frog ambience sound

This commit is contained in:
Wuzzy 2019-09-21 20:42:31 +02:00
parent 180790544c
commit b6367a523e
3 changed files with 30 additions and 4 deletions

View File

@ -5,6 +5,8 @@ By Kaadmy, for Pixture
Adds directional ambient sounds coming from the correct sources.
Sound license:
ambiance_birds.ogg: CC0, by syncopika(http://opengameart.org/users/syncopika)
ambiance_crickets.ogg: CC0, by syncopika(http://opengameart.org/users/syncopika)
Source license: LGPLv2.1
ambiance_birds.ogg: CC0, by syncopika <http://opengameart.org/users/syncopika>
ambiance_crickets.ogg: CC0, by syncopika <http://opengameart.org/users/syncopika>
ambiance_frog.ogg: CC0, by kaltzlbt <https://freesound.org/people/katzlbt/sounds/361117/>
Source code license: LGPLv2.1

View File

@ -37,7 +37,7 @@ ambiance.sounds["crickets"] = {
chance = 3,
file = "ambiance_crickets",
dist = 8,
nodename = "group:grass",
nodename = {"group:normal_grass", "group:dry_grass"},
can_play = function(pos)
local tod = (minetest.get_timeofday() or 1) * 2
@ -55,6 +55,25 @@ ambiance.sounds["crickets"] = {
end,
}
ambiance.sounds["frog"] = {
length = 0.5,
chance = 64,
pitch_min = -10,
pitch_max = 10,
file = "ambiance_frog",
dist = 16,
nodename = "group:swamp_grass",
can_play = function(pos)
local tod = (minetest.get_timeofday() or 1) * 2
if tod < 0.4 or tod > 1.6 then
return true
end
return false
end,
}
ambiance.sounds["flowing_water"] = {
length = 3.3,
chance = 1,
@ -121,12 +140,17 @@ if minetest.settings:get_bool("ambiance_enable") == true then
end
if ok then
local pitch = nil
if sound.pitch_min and sound.pitch_max then
pitch = 1 + 0.01 * math.random(sound.pitch_min, sound.pitch_max)
end
soundspec[name][soundname] = minetest.sound_play(
sound.file,
{
pos = sourcepos,
max_hear_distance = sound.dist,
gain = ambiance_volume,
pitch = pitch,
})
lastsound[name][soundname] = 0

Binary file not shown.