mirror of
https://codeberg.org/tenplus1/ambience.git
synced 2025-01-11 10:30:17 +01:00
Tweaked code, added jungle sounds
This commit is contained in:
parent
222e7d8f12
commit
6d553f96e4
@ -8,3 +8,4 @@ Based on Immersive Sounds .36 mod by Neuromancer and optimized to run on servers
|
|||||||
0.4 - Code optimized
|
0.4 - Code optimized
|
||||||
0.5 - Changed to kilbiths smaller sound files and removed canadianloon1, adjusted timings
|
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.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
|
||||||
|
49
init.lua
49
init.lua
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
--= Ambience lite by TenPlus1 (1st April 2016)
|
--= Ambience lite by TenPlus1 (6th June 2016)
|
||||||
|
|
||||||
local max_frequency_all = 1000 -- larger number means more frequent sounds (100-2000)
|
local max_frequency_all = 1000 -- larger number means more frequent sounds (100-2000)
|
||||||
local SOUNDVOLUME = 1
|
local SOUNDVOLUME = 1
|
||||||
@ -8,6 +8,7 @@ local ambiences
|
|||||||
local played_on_start = false
|
local played_on_start = false
|
||||||
|
|
||||||
-- sound sets
|
-- sound sets
|
||||||
|
|
||||||
local night = {
|
local night = {
|
||||||
handler = {}, frequency = 40,
|
handler = {}, frequency = 40,
|
||||||
{name = "hornedowl", length = 2},
|
{name = "hornedowl", length = 2},
|
||||||
@ -46,7 +47,8 @@ local beach = {
|
|||||||
handler = {}, frequency = 40,
|
handler = {}, frequency = 40,
|
||||||
{name = "seagull", length = 4.5},
|
{name = "seagull", length = 4.5},
|
||||||
{name = "beach", length = 13},
|
{name = "beach", length = 13},
|
||||||
{name = "gull", length = 1}
|
{name = "gull", length = 1},
|
||||||
|
{name = "beach_2", length = 6},
|
||||||
}
|
}
|
||||||
|
|
||||||
local desert = {
|
local desert = {
|
||||||
@ -86,14 +88,20 @@ local largefire = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
local jungle = {
|
local jungle = {
|
||||||
handler = {}, frequency = 60,
|
handler = {}, frequency = 200,
|
||||||
{name = "jungle", length = 4},
|
{name = "jungle_day_1", length = 7},
|
||||||
{name = "deer", length = 7},
|
{name = "deer", length = 7},
|
||||||
{name = "canadianloon2", length = 14},
|
{name = "canadianloon2", length = 14},
|
||||||
{name = "bird1", length = 11},
|
{name = "bird1", length = 11},
|
||||||
{name = "bird2", length = 6},
|
|
||||||
{name = "peacock", length = 2},
|
{name = "peacock", length = 2},
|
||||||
{name = "bluejay", length = 6},
|
}
|
||||||
|
|
||||||
|
local jungle_night = {
|
||||||
|
handler = {}, frequency = 200,
|
||||||
|
{name = "jungle_night_1", length = 4},
|
||||||
|
{name = "jungle_night_2", length = 4},
|
||||||
|
{name = "deer", length = 7},
|
||||||
|
{name = "frog", length = 1},
|
||||||
}
|
}
|
||||||
|
|
||||||
local radius = 6
|
local radius = 6
|
||||||
@ -104,7 +112,7 @@ local num_fire, num_lava, num_water_flowing, num_water_source,
|
|||||||
local get_ambience = function(player)
|
local get_ambience = function(player)
|
||||||
|
|
||||||
-- who and where am I?
|
-- who and where am I?
|
||||||
local player_name = player:get_player_name()
|
--local player_name = player:get_player_name()
|
||||||
local pos = player:getpos()
|
local pos = player:getpos()
|
||||||
|
|
||||||
-- what is around me?
|
-- what is around me?
|
||||||
@ -118,11 +126,13 @@ local get_ambience = function(player)
|
|||||||
|
|
||||||
--= START Ambiance
|
--= START Ambiance
|
||||||
|
|
||||||
if minetest.get_item_group(nod_head, "water") > 0 then
|
if minetest.registered_nodes[nod_head]
|
||||||
|
and minetest.registered_nodes[nod_head].groups.water then
|
||||||
return {underwater = underwater}
|
return {underwater = underwater}
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_item_group(nod_feet, "water") > 0 then
|
if minetest.registered_nodes[nod_feet]
|
||||||
|
and minetest.registered_nodes[nod_feet].groups.water then
|
||||||
return {splash = splash}
|
return {splash = splash}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -203,6 +213,11 @@ print (
|
|||||||
|
|
||||||
return {day = day}
|
return {day = day}
|
||||||
else
|
else
|
||||||
|
|
||||||
|
if num_jungletree > 100 then
|
||||||
|
return {jungle_night = jungle_night}
|
||||||
|
end
|
||||||
|
|
||||||
return {night = night}
|
return {night = night}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -215,9 +230,10 @@ local play_sound = function(player_name, list, number)
|
|||||||
|
|
||||||
if list.handler[player_name] == nil then
|
if list.handler[player_name] == nil then
|
||||||
|
|
||||||
local gain = volume * SOUNDVOLUME
|
local handler = minetest.sound_play(list[number].name, {
|
||||||
local handler = minetest.sound_play(list[number].name,
|
to_player = player_name,
|
||||||
{to_player = player_name, gain = gain})
|
gain = volume * SOUNDVOLUME
|
||||||
|
})
|
||||||
|
|
||||||
if handler then
|
if handler then
|
||||||
|
|
||||||
@ -272,6 +288,7 @@ local still_playing = function(still_playing, player_name)
|
|||||||
if not still_playing.smallfire then stop_sound(smallfire, player_name) end
|
if not still_playing.smallfire then stop_sound(smallfire, player_name) end
|
||||||
if not still_playing.largefire then stop_sound(largefire, player_name) end
|
if not still_playing.largefire then stop_sound(largefire, player_name) end
|
||||||
if not still_playing.jungle then stop_sound(jungle, player_name) end
|
if not still_playing.jungle then stop_sound(jungle, player_name) end
|
||||||
|
if not still_playing.jungle_night then stop_sound(jungle_night, player_name) end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- player routine
|
-- player routine
|
||||||
@ -283,13 +300,15 @@ minetest.register_globalstep(function(dtime)
|
|||||||
if timer < 1 then return end
|
if timer < 1 then return end
|
||||||
timer = 0
|
timer = 0
|
||||||
|
|
||||||
for _,player in pairs(minetest.get_connected_players()) do
|
local players = minetest.get_connected_players()
|
||||||
|
|
||||||
local player_name = player:get_player_name()
|
for n = 1, #players do
|
||||||
|
|
||||||
|
local player_name = players[n]:get_player_name()
|
||||||
|
|
||||||
--local t1 = os.clock()
|
--local t1 = os.clock()
|
||||||
|
|
||||||
ambiences = get_ambience(player)
|
ambiences = get_ambience(players[n])
|
||||||
|
|
||||||
--print(string.format("elapsed time: %.4f\n", os.clock() - t1))
|
--print(string.format("elapsed time: %.4f\n", os.clock() - t1))
|
||||||
|
|
||||||
|
@ -1,20 +1,3 @@
|
|||||||
--------------Music Lic:
|
|
||||||
Amethystium:
|
|
||||||
--Avalon
|
|
||||||
--Ethereal
|
|
||||||
--Faraway
|
|
||||||
--Strangely Beautiful
|
|
||||||
|
|
||||||
"I can't give you a formal license (legal paperwork) for it, but as long as it's non-commercial I can give you my personal blessing and guarantee that you won't get in trouble for using it :) If that's enough just feel free to use any of my tracks. Please credit the music properly though, and include a link to www.amethystium.com and www.am.mu (it's the same site right now, but the latter will be a label/music store site soon).
|
|
||||||
Best regards,
|
|
||||||
Øystein Ramfjord"
|
|
||||||
|
|
||||||
Jordach:
|
|
||||||
--dark_ambiance
|
|
||||||
--eastern_feeling
|
|
||||||
These sounds are used for the Mod for Minetest; Ambiance.
|
|
||||||
The included sounds are http://creativecommons.org/licenses/by-nc-sa/3.0/
|
|
||||||
Not Used:--mtest
|
|
||||||
|
|
||||||
-----------Sound Lic:
|
-----------Sound Lic:
|
||||||
--Nightime Sound, Recorded by Mike Koenig, License: Attribution 3.0 http://soundbible.com/951-Nightime.html
|
--Nightime Sound, Recorded by Mike Koenig, License: Attribution 3.0 http://soundbible.com/951-Nightime.html
|
||||||
@ -115,4 +98,6 @@ http://www.jamendo.com/en/track/904012/dance-of-magical-flowers
|
|||||||
http://www.jamendo.com/en/track/904013/magic-of-the-seventh-world
|
http://www.jamendo.com/en/track/904013/magic-of-the-seventh-world
|
||||||
http://www.jamendo.com/en/track/904016/in-search-of-the-soul
|
http://www.jamendo.com/en/track/904016/in-search-of-the-soul
|
||||||
|
|
||||||
|
http://www.freesfx.co.uk/soundeffects/forests-jungles/
|
||||||
|
|
||||||
zero-project
|
zero-project
|
||||||
|
BIN
sounds/beach_2.ogg
Normal file
BIN
sounds/beach_2.ogg
Normal file
Binary file not shown.
Binary file not shown.
BIN
sounds/jungle_day_1.ogg
Normal file
BIN
sounds/jungle_day_1.ogg
Normal file
Binary file not shown.
BIN
sounds/jungle_night_1.ogg
Normal file
BIN
sounds/jungle_night_1.ogg
Normal file
Binary file not shown.
BIN
sounds/jungle_night_2.ogg
Normal file
BIN
sounds/jungle_night_2.ogg
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user