Compare commits
32 Commits
nalc-1.2.0
...
561f7c51a2
Author | SHA1 | Date | |
---|---|---|---|
561f7c51a2 | |||
faa5f9e104 | |||
0a4ad83209 | |||
0e092543e3 | |||
e83afa9961 | |||
c5437a4b3d | |||
120bcf9bd3 | |||
7227fdcb2c | |||
30580a2155 | |||
34408000c0 | |||
7ed67f386b | |||
885fb784cb | |||
e404aa968d | |||
67d87b7001 | |||
040f39e388 | |||
aee454d74c | |||
483d35a635 | |||
5d3c6d4a44 | |||
aa597c7ad8 | |||
c743d3160a | |||
9eb6bb4343 | |||
ba797c4d39 | |||
92464d39c3 | |||
aac7a5ae5d | |||
8745b17e75 | |||
d59549ecd1 | |||
77a1f2000c | |||
559e0414ab | |||
6ac7a6f608 | |||
61176e5bf0 | |||
98968a54cd | |||
fc5dc803a3 |
@ -1,390 +0,0 @@
|
|||||||
--------------------------------------------------------------------------------------------------------
|
|
||||||
--Ambiance Configuration for version .14
|
|
||||||
|
|
||||||
local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000.
|
|
||||||
|
|
||||||
--for frequencies below use a number between 0 and max_frequency_all
|
|
||||||
--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds
|
|
||||||
local night_frequency = 20 --owls, wolves
|
|
||||||
local night_volume = 0.9
|
|
||||||
local night_frequent_frequency = 150 --crickets
|
|
||||||
local night_frequent_volume = 0.9
|
|
||||||
local day_frequency = 100 --crow, bluejay, cardinal
|
|
||||||
local day_volume = 0.9
|
|
||||||
local day_frequent_frequency = 1000 --crow, bluejay, cardinal
|
|
||||||
local day_frequent_volume = 0.18
|
|
||||||
local cave_frequency = 10 --bats
|
|
||||||
local cave_volume = 1.0
|
|
||||||
local cave_frequent_frequency = 70 --drops of water dripping
|
|
||||||
local cave_frequent_volume = 1.0
|
|
||||||
local water_frequent_frequency = 1000 --water sounds
|
|
||||||
local water_frequent_volume = 1.0
|
|
||||||
local music_frequency = 7 --music (suggestion: keep this one low like around 6)
|
|
||||||
local music_volume = 0.3
|
|
||||||
--End of Config
|
|
||||||
----------------------------------------------------------------------------------------------------
|
|
||||||
local played_on_start = false
|
|
||||||
local night = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequency,
|
|
||||||
{name="horned_owl", length=3, gain=night_volume},
|
|
||||||
{name="Wolves_Howling", length=11, gain=night_volume},
|
|
||||||
{name="ComboWind", length=17, gain=night_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local night_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequent_frequency,
|
|
||||||
{name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequency,
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_volume},
|
|
||||||
{name="craw", length=3, gain=day_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequent_frequency,
|
|
||||||
{name="robin2", length=16, gain=day_frequent_volume},
|
|
||||||
{name="birdsongnl", length=13, gain=day_frequent_volume},
|
|
||||||
{name="bird", length=30, gain=day_frequent_volume},
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_frequent_volume},
|
|
||||||
{name="craw", length=3, gain=day_frequent_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_frequent_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_frequent_volume*3}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local cave = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequency,
|
|
||||||
{name="Bats_in_Cave", length=5, gain=cave_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequent_frequency,
|
|
||||||
{name="drippingwater_drip_a", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_b", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_c", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="Single_Water_Droplet", length=3, gain=cave_frequent_volume},
|
|
||||||
{name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 0,--dolphins dont fit into small lakes
|
|
||||||
{name="dolphins", length=6},
|
|
||||||
{name="dolphins_screaming", length=16.5}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = water_frequent_frequency,
|
|
||||||
on_stop = "drowning_gasp",
|
|
||||||
on_start = "Splash",
|
|
||||||
{name="scuba1bubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here.
|
|
||||||
{name="scuba1calm2", length=8.5, gain=water_frequent_volume},
|
|
||||||
{name="scuba1interestingbubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local flowing_water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=14, gain=.4}
|
|
||||||
}
|
|
||||||
local flowing_water2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=11, gain=.3}
|
|
||||||
}
|
|
||||||
|
|
||||||
local lava = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=20}
|
|
||||||
}
|
|
||||||
local lava2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=15}
|
|
||||||
}
|
|
||||||
|
|
||||||
local play_music = minetest.setting_getbool("music") or false
|
|
||||||
local music = {
|
|
||||||
handler = {},
|
|
||||||
frequency = music_frequency,
|
|
||||||
{name="mtest", length=4*60+33, gain=music_volume},
|
|
||||||
{name="echos", length=2*60+26, gain=music_volume},
|
|
||||||
{name="FoamOfTheSea", length=1*60+50, gain=music_volume},
|
|
||||||
{name="eastern_feeling", length=3*60+51, gain=music_volume},
|
|
||||||
{name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume},
|
|
||||||
{name="dark_ambiance", length=44, gain=music_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local is_daytime = function()
|
|
||||||
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[old
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
local search_p = {x=0, y=0, z=0}
|
|
||||||
local nodes_found = 0
|
|
||||||
for p_x=(pos.x-search_distance), (pos.x+search_distance) do
|
|
||||||
for p_y=(pos.y-search_distance), (pos.y+search_distance) do
|
|
||||||
for p_z=(pos.z-search_distance), (pos.z+search_distance) do
|
|
||||||
local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z})
|
|
||||||
if search_n.name == node_name then
|
|
||||||
nodes_found = nodes_found + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nodes_found
|
|
||||||
--minetest.chat_send_all("Range: " .. tostring(search_distance) .. " | Found (" .. node_name .. ": " .. nodes_found .. ")")
|
|
||||||
end --]]
|
|
||||||
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
|
|
||||||
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
return #nodes
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local get_ambience = function(player)
|
|
||||||
local pos = player:getpos()
|
|
||||||
pos.y = pos.y+1.0
|
|
||||||
local nodename = minetest.env:get_node(pos).name
|
|
||||||
if string.find(nodename, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {water=water, water_frequent=water_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {water=water, water_frequent=water_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then
|
|
||||||
if music then
|
|
||||||
return {lava=lava, lava2=lava2, music=music}
|
|
||||||
else
|
|
||||||
return {lava=lava}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nodes_in_range(pos, 7, "default:water_flowing")>5 then
|
|
||||||
if music then
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music}
|
|
||||||
else
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if player:getpos().y < 0 then
|
|
||||||
if music then
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if is_daytime() then
|
|
||||||
if music then
|
|
||||||
return {day=day, day_frequent=day_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {day=day, day_frequent=day_frequent}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if music then
|
|
||||||
return {night=night, night_frequent=night_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {night=night, night_frequent=night_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- start playing the sound, set the handler and delete the handler after sound is played
|
|
||||||
local play_sound = function(player, list, number)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if list.handler[player_name] == nil then
|
|
||||||
local gain = 1.0
|
|
||||||
if list[number].gain ~= nil then
|
|
||||||
gain = list[number].gain
|
|
||||||
end
|
|
||||||
local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain})
|
|
||||||
if handler ~= nil then
|
|
||||||
list.handler[player_name] = handler
|
|
||||||
minetest.after(list[number].length, function(args)
|
|
||||||
local list = args[1]
|
|
||||||
local player_name = args[2]
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end, {list, player_name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- stops all sounds that are not in still_playing
|
|
||||||
local stop_sound = function(still_playing, player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if still_playing.cave == nil then
|
|
||||||
local list = cave
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.cave_frequent == nil then
|
|
||||||
local list = cave_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.night == nil then
|
|
||||||
local list = night
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.night_frequent == nil then
|
|
||||||
local list = night_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day == nil then
|
|
||||||
local list = day
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day_frequent == nil then
|
|
||||||
local list = day_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.music == nil then
|
|
||||||
local list = music
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water == nil then
|
|
||||||
local list = flowing_water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water2 == nil then
|
|
||||||
local list = flowing_water2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava == nil then
|
|
||||||
local list = lava
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava2 == nil then
|
|
||||||
local list = lava2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water == nil then
|
|
||||||
local list = water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water_frequent == nil then
|
|
||||||
local list = water_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
played_on_start = false
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
timer = timer+dtime
|
|
||||||
if timer < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
timer = 0
|
|
||||||
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
|
||||||
local ambiences = get_ambience(player)
|
|
||||||
stop_sound(ambiences, player)
|
|
||||||
for _,ambience in pairs(ambiences) do
|
|
||||||
if math.random(1, 1000) <= ambience.frequency then
|
|
||||||
if ambience.on_start ~= nil and played_on_start == false then
|
|
||||||
played_on_start = true
|
|
||||||
minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
play_sound(player, ambience, math.random(1, #ambience))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
@ -1,439 +0,0 @@
|
|||||||
--------------------------------------------------------------------------------------------------------
|
|
||||||
--Ambiance Configuration for version .16
|
|
||||||
|
|
||||||
local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000.
|
|
||||||
|
|
||||||
--for frequencies below use a number between 0 and max_frequency_all
|
|
||||||
--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds
|
|
||||||
local night_frequency = 20 --owls, wolves
|
|
||||||
local night_volume = 0.9
|
|
||||||
local night_frequent_frequency = 150 --crickets
|
|
||||||
local night_frequent_volume = 0.9
|
|
||||||
local day_frequency = 100 --crow, bluejay, cardinal
|
|
||||||
local day_volume = 0.9
|
|
||||||
local day_frequent_frequency = 1000 --crow, bluejay, cardinal
|
|
||||||
local day_frequent_volume = 0.18
|
|
||||||
local cave_frequency = 10 --bats
|
|
||||||
local cave_volume = 1.0
|
|
||||||
local cave_frequent_frequency = 70 --drops of water dripping
|
|
||||||
local cave_frequent_volume = 1.0
|
|
||||||
local beach_frequency = 20 --seagulls
|
|
||||||
local beach_volume = 1.0
|
|
||||||
local beach_frequent_frequency = 1000 --waves
|
|
||||||
local beach_frequent_volume = 1.0
|
|
||||||
local water_frequent_frequency = 1000 --water sounds
|
|
||||||
local water_frequent_volume = 1.0
|
|
||||||
local music_frequency = 7 --music (suggestion: keep this one low like around 6)
|
|
||||||
local music_volume = 0.3
|
|
||||||
--End of Config
|
|
||||||
----------------------------------------------------------------------------------------------------
|
|
||||||
local played_on_start = false
|
|
||||||
local night = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequency,
|
|
||||||
{name="horned_owl", length=3, gain=night_volume},
|
|
||||||
{name="Wolves_Howling", length=11, gain=night_volume},
|
|
||||||
{name="ComboWind", length=17, gain=night_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local night_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequent_frequency,
|
|
||||||
{name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequency,
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_volume},
|
|
||||||
{name="craw", length=3, gain=day_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequent_frequency,
|
|
||||||
{name="robin2", length=16, gain=day_frequent_volume},
|
|
||||||
{name="birdsongnl", length=13, gain=day_frequent_volume},
|
|
||||||
{name="bird", length=30, gain=day_frequent_volume},
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_frequent_volume},
|
|
||||||
{name="craw", length=3, gain=day_frequent_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_frequent_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_frequent_volume*3}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local cave = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequency,
|
|
||||||
{name="Bats_in_Cave", length=5, gain=cave_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequent_frequency,
|
|
||||||
{name="drippingwater_drip_a", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_b", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_c", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="Single_Water_Droplet", length=3, gain=cave_frequent_volume},
|
|
||||||
{name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequency,
|
|
||||||
{name="seagull", length=4.5, gain=beach_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequent_frequency,
|
|
||||||
{name="fiji_beach", length=43.5, gain=beach_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 0,--dolphins dont fit into small lakes
|
|
||||||
{name="dolphins", length=6},
|
|
||||||
{name="dolphins_screaming", length=16.5}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = water_frequent_frequency,
|
|
||||||
on_stop = "drowning_gasp",
|
|
||||||
on_start = "Splash",
|
|
||||||
{name="scuba1bubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here.
|
|
||||||
{name="scuba1calm2", length=8.5, gain=water_frequent_volume},
|
|
||||||
{name="scuba1interestingbubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local flowing_water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=14, gain=.4}
|
|
||||||
}
|
|
||||||
local flowing_water2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=11, gain=.3}
|
|
||||||
}
|
|
||||||
|
|
||||||
local lava = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=20}
|
|
||||||
}
|
|
||||||
local lava2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=15}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local play_music = minetest.setting_getbool("music") or false
|
|
||||||
local music = {
|
|
||||||
handler = {},
|
|
||||||
frequency = music_frequency,
|
|
||||||
{name="mtest", length=4*60+33, gain=music_volume},
|
|
||||||
{name="echos", length=2*60+26, gain=music_volume},
|
|
||||||
{name="FoamOfTheSea", length=1*60+50, gain=music_volume},
|
|
||||||
{name="eastern_feeling", length=3*60+51, gain=music_volume},
|
|
||||||
{name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume},
|
|
||||||
{name="dark_ambiance", length=44, gain=music_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local is_daytime = function()
|
|
||||||
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[old
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
local search_p = {x=0, y=0, z=0}
|
|
||||||
local nodes_found = 0
|
|
||||||
for p_x=(pos.x-search_distance), (pos.x+search_distance) do
|
|
||||||
for p_y=(pos.y-search_distance), (pos.y+search_distance) do
|
|
||||||
for p_z=(pos.z-search_distance), (pos.z+search_distance) do
|
|
||||||
local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z})
|
|
||||||
if search_n.name == node_name then
|
|
||||||
nodes_found = nodes_found + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nodes_found
|
|
||||||
--minetest.chat_send_all("Range: " .. tostring(search_distance) .. " | Found (" .. node_name .. ": " .. nodes_found .. ")")
|
|
||||||
end --]]
|
|
||||||
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
|
|
||||||
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
return #nodes
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local get_ambience = function(player)
|
|
||||||
local pos = player:getpos()
|
|
||||||
pos.y = pos.y+1.0
|
|
||||||
local nodename = minetest.env:get_node(pos).name
|
|
||||||
if string.find(nodename, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {water=water, water_frequent=water_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {water=water, water_frequent=water_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then
|
|
||||||
if music then
|
|
||||||
return {lava=lava, lava2=lava2, music=music}
|
|
||||||
else
|
|
||||||
return {lava=lava}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nodes_in_range(pos, 7, "default:water_flowing")>5 then
|
|
||||||
if music then
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music}
|
|
||||||
else
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pos.y = pos.y-2
|
|
||||||
nodename = minetest.env:get_node(pos).name
|
|
||||||
--minetest.chat_send_all("Found " .. nodename .. pos.y )
|
|
||||||
if string.find(nodename, "default:sand") and pos.y < 5 then
|
|
||||||
if music then
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if player:getpos().y < 0 then
|
|
||||||
if music then
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if is_daytime() then
|
|
||||||
if music then
|
|
||||||
return {day=day, day_frequent=day_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {day=day, day_frequent=day_frequent}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if music then
|
|
||||||
return {night=night, night_frequent=night_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {night=night, night_frequent=night_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- start playing the sound, set the handler and delete the handler after sound is played
|
|
||||||
local play_sound = function(player, list, number)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if list.handler[player_name] == nil then
|
|
||||||
local gain = 1.0
|
|
||||||
if list[number].gain ~= nil then
|
|
||||||
gain = list[number].gain
|
|
||||||
end
|
|
||||||
local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain})
|
|
||||||
if handler ~= nil then
|
|
||||||
list.handler[player_name] = handler
|
|
||||||
minetest.after(list[number].length, function(args)
|
|
||||||
local list = args[1]
|
|
||||||
local player_name = args[2]
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end, {list, player_name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- stops all sounds that are not in still_playing
|
|
||||||
local stop_sound = function(still_playing, player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if still_playing.cave == nil then
|
|
||||||
local list = cave
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.cave_frequent == nil then
|
|
||||||
local list = cave_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.beach == nil then
|
|
||||||
local list = beach
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.beach_frequent == nil then
|
|
||||||
local list = beach_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if still_playing.night == nil then
|
|
||||||
local list = night
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.night_frequent == nil then
|
|
||||||
local list = night_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day == nil then
|
|
||||||
local list = day
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day_frequent == nil then
|
|
||||||
local list = day_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.music == nil then
|
|
||||||
local list = music
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water == nil then
|
|
||||||
local list = flowing_water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water2 == nil then
|
|
||||||
local list = flowing_water2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava == nil then
|
|
||||||
local list = lava
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava2 == nil then
|
|
||||||
local list = lava2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water == nil then
|
|
||||||
local list = water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water_frequent == nil then
|
|
||||||
local list = water_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
played_on_start = false
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
timer = timer+dtime
|
|
||||||
if timer < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
timer = 0
|
|
||||||
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
|
||||||
local ambiences = get_ambience(player)
|
|
||||||
stop_sound(ambiences, player)
|
|
||||||
for _,ambience in pairs(ambiences) do
|
|
||||||
if math.random(1, 1000) <= ambience.frequency then
|
|
||||||
if ambience.on_start ~= nil and played_on_start == false then
|
|
||||||
played_on_start = true
|
|
||||||
minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
play_sound(player, ambience, math.random(1, #ambience))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
@ -1 +0,0 @@
|
|||||||
default
|
|
@ -1,692 +0,0 @@
|
|||||||
--------------------------------------------------------------------------------------------------------
|
|
||||||
--Ambience Configuration for version .34
|
|
||||||
--Added Faraway & Ethereal by Amethystium
|
|
||||||
|
|
||||||
--Working on:
|
|
||||||
--removing magic leap when not enough air under feet.
|
|
||||||
|
|
||||||
|
|
||||||
--find out why wind stops while flying
|
|
||||||
--add an extra node near feet to handle treading water as a special case, and don't have to use node under feet. which gets
|
|
||||||
--invoked when staning on a ledge near water.
|
|
||||||
--reduce redundant code (stopplay and add ambience to list)
|
|
||||||
|
|
||||||
local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000.
|
|
||||||
|
|
||||||
--for frequencies below use a number between 0 and max_frequency_all
|
|
||||||
--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds
|
|
||||||
local night_frequency = 20 --owls, wolves
|
|
||||||
local night_volume = 0.9
|
|
||||||
local night_frequent_frequency = 150 --crickets
|
|
||||||
local night_frequent_volume = 0.9
|
|
||||||
local day_frequency = 80 --crow, bluejay, cardinal
|
|
||||||
local day_volume = 0.9
|
|
||||||
local day_frequent_frequency = 250 --crow, bluejay, cardinal
|
|
||||||
local day_frequent_volume = 0.18
|
|
||||||
local cave_frequency = 10 --bats
|
|
||||||
local cave_volume = 1.0
|
|
||||||
local cave_frequent_frequency = 70 --drops of water dripping
|
|
||||||
local cave_frequent_volume = 1.0
|
|
||||||
local beach_frequency = 20 --seagulls
|
|
||||||
local beach_volume = 1.0
|
|
||||||
local beach_frequent_frequency = 1000 --waves
|
|
||||||
local beach_frequent_volume = 1.0
|
|
||||||
local water_frequent_frequency = 1000 --water sounds
|
|
||||||
local water_frequent_volume = 1.0
|
|
||||||
local desert_frequency = 20 --coyote
|
|
||||||
local desert_volume = 1.0
|
|
||||||
local desert_frequent_frequency = 700 --desertwind
|
|
||||||
local desert_frequent_volume = 1.0
|
|
||||||
local swimming_frequent_frequency = 1000 --swimming splashes
|
|
||||||
local swimming_frequent_volume = 1.0
|
|
||||||
local water_surface_volume = 1.0 -- sloshing water
|
|
||||||
local lava_volume = 1.0 --lava
|
|
||||||
local flowing_water_volume = .4 --waterfall
|
|
||||||
local splashing_water_volume = 1
|
|
||||||
local music_frequency = 7 --music (suggestion: keep this one low like around 6)
|
|
||||||
local music_volume = 0.3
|
|
||||||
|
|
||||||
--End of Config
|
|
||||||
----------------------------------------------------------------------------------------------------
|
|
||||||
local ambiences
|
|
||||||
local counter=0--*****************
|
|
||||||
local SOUNDVOLUME = 1
|
|
||||||
local MUSICVOLUME = 1
|
|
||||||
local sound_vol = 1
|
|
||||||
local volume = {}
|
|
||||||
local last_x_pos = 0
|
|
||||||
local last_y_pos = 0
|
|
||||||
local last_z_pos = 0
|
|
||||||
local node_under_feet
|
|
||||||
local node_at_upper_body
|
|
||||||
local node_at_lower_body
|
|
||||||
local node_3_under_feet
|
|
||||||
local played_on_start = false
|
|
||||||
local world_path = minetest.get_worldpath()
|
|
||||||
|
|
||||||
local function load_volumes()
|
|
||||||
local file, err = io.open(world_path.."/ambience_volumes", "r")
|
|
||||||
if err then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
for line in file:lines() do
|
|
||||||
local config_line = string.split(line, ":")
|
|
||||||
volume[config_line[1]] = {music=config_line[2],sound=config_line[3]}
|
|
||||||
end
|
|
||||||
file:close()
|
|
||||||
end
|
|
||||||
|
|
||||||
load_volumes()
|
|
||||||
|
|
||||||
local night = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequency,
|
|
||||||
{name="horned_owl", length=3, gain=night_volume},
|
|
||||||
{name="Wolves_Howling", length=11, gain=night_volume},
|
|
||||||
{name="ComboWind", length=17, gain=night_volume},
|
|
||||||
{name="deer", length=8, gain=night_volume*2},
|
|
||||||
{name="frog", length=1, gain=night_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local night_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequent_frequency,
|
|
||||||
{name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequency,
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_volume},
|
|
||||||
{name="craw", length=3, gain=day_volume},
|
|
||||||
{name="bluejay", length=7, gain=day_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_volume},
|
|
||||||
-- {name="canadianloon2", length=15, gain=day_volume-0.7},
|
|
||||||
{name="peacock", length=3, gain=day_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequent_frequency,
|
|
||||||
{name="robin2", length=16, gain=day_frequent_volume},
|
|
||||||
{name="birdsongnl", length=13, gain=day_frequent_volume},
|
|
||||||
{name="bird", length=30, gain=day_frequent_volume},
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_frequent_volume},
|
|
||||||
{name="craw", length=3, gain=day_frequent_volume},
|
|
||||||
{name="bluejay", length=7, gain=day_frequent_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_frequent_volume*3}
|
|
||||||
}
|
|
||||||
local swimming_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequent_frequency,
|
|
||||||
{name="water_swimming_splashing_breath", length=11.5, gain=swimming_frequent_volume},
|
|
||||||
{name="water_swimming_splashing", length=9, gain=swimming_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequency,
|
|
||||||
{name="Bats_in_Cave", length=5, gain=cave_volume*0.5}
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequent_frequency,
|
|
||||||
{name="drippingwater_drip_a", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_b", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_c", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="Single_Water_Droplet", length=3, gain=cave_frequent_volume},
|
|
||||||
{name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequency,
|
|
||||||
{name="seagull", length=4.5, gain=beach_volume},
|
|
||||||
{name="gull", length=2, gain=beach_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequent_frequency,
|
|
||||||
{name="fiji_beach", length=43.5, gain=beach_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local desert = {
|
|
||||||
handler = {},
|
|
||||||
frequency = desert_frequency,
|
|
||||||
{name="coyote2", length=2.5, gain=desert_volume},
|
|
||||||
{name="RattleSnake", length=8, gain=desert_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local desert_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = desert_frequent_frequency,
|
|
||||||
{name="DesertMonolithMed", length=34.5, gain=desert_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local flying = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
on_start = "nothing_yet",
|
|
||||||
on_stop = "nothing_yet",
|
|
||||||
{name="ComboWind", length=17, gain=1}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 0,--dolphins dont fit into small lakes
|
|
||||||
{name="dolphins", length=6, gain=1},
|
|
||||||
{name="dolphins_screaming", length=16.5, gain=1}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = water_frequent_frequency,
|
|
||||||
on_stop = "drowning_gasp",
|
|
||||||
--on_start = "Splash",
|
|
||||||
{name="scuba1bubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1calm", length=10, gain=water_frequent_volume}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here.
|
|
||||||
{name="scuba1calm2", length=8.5, gain=water_frequent_volume},
|
|
||||||
{name="scuba1interestingbubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_surface = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
on_stop = "Splash",
|
|
||||||
on_start = "Splash",
|
|
||||||
{name="lake_waves_2_calm", length=9.5, gain=water_surface_volume},
|
|
||||||
{name="lake_waves_2_variety", length=13.1, gain=water_surface_volume}
|
|
||||||
}
|
|
||||||
local splashing_water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="Splash", length=1.22, gain=splashing_water_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local flowing_water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=14, gain=flowing_water_volume}
|
|
||||||
}
|
|
||||||
local flowing_water2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=11, gain=flowing_water_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local lava = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=20, gain=lava_volume}
|
|
||||||
}
|
|
||||||
local lava2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=15, gain=lava_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local play_music = minetest.setting_getbool("music") or false
|
|
||||||
local music = {
|
|
||||||
handler = {},
|
|
||||||
frequency = music_frequency,
|
|
||||||
is_music=true,
|
|
||||||
{name="StrangelyBeautifulShort", length=3*60+.5, gain=music_volume*.7},
|
|
||||||
{name="AvalonShort", length=2*60+58, gain=music_volume*1.4},
|
|
||||||
--{name="mtest", length=4*60+33, gain=music_volume},
|
|
||||||
--{name="echos", length=2*60+26, gain=music_volume},
|
|
||||||
--{name="FoamOfTheSea", length=1*60+50, gain=music_volume},
|
|
||||||
{name="eastern_feeling", length=3*60+51, gain=music_volume},
|
|
||||||
--{name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume},
|
|
||||||
{name="EtherealShort", length=3*60+4, gain=music_volume*.7},
|
|
||||||
{name="FarawayShort", length=3*60+5, gain=music_volume*.7},
|
|
||||||
{name="dark_ambiance", length=44, gain=music_volume},
|
|
||||||
{name="Ambivalent", length=2*60+31, gain=music_volume*1.4},
|
|
||||||
{name="anonnp4014", length=2*60+31, gain=music_volume*1.6},
|
|
||||||
{name="bensound_deepblue", length=4*60+49, gain=music_volume},
|
|
||||||
{name="bensound_ofeliasdream", length=4*60+59, gain=music_volume},
|
|
||||||
{name="bensound_slowmotion", length=3*60+27, gain=music_volume},
|
|
||||||
{name="rainymemory", length=2*60+8, gain=music_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local ambienceList = {
|
|
||||||
night=night,
|
|
||||||
night_frequent=night_frequent,
|
|
||||||
day=day,
|
|
||||||
day_frequent=day_frequent,
|
|
||||||
swimming_frequent=swimming_frequent,
|
|
||||||
cave=cave,
|
|
||||||
cave_frequent=cave_frequent,
|
|
||||||
beach=beach,
|
|
||||||
beach_frequent=beach_frequent,
|
|
||||||
desert=desert,
|
|
||||||
desert_frequent=desert_frequent,
|
|
||||||
flying=flying,
|
|
||||||
water=water,
|
|
||||||
water_frequent=water_frequent,
|
|
||||||
water_surface=water_surface,
|
|
||||||
splashing_water=splashing_water,
|
|
||||||
flowing_water=flowing_water,
|
|
||||||
flowing_water2=flowing_water2,
|
|
||||||
lava=lava,
|
|
||||||
lava2=lava2,
|
|
||||||
music=music,
|
|
||||||
}
|
|
||||||
|
|
||||||
local is_daytime = function()
|
|
||||||
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
|
|
||||||
end
|
|
||||||
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
local minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
|
|
||||||
local maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
|
|
||||||
local nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
--minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
return #nodes
|
|
||||||
end
|
|
||||||
|
|
||||||
local nodes_in_coords = function(minp, maxp, node_name)
|
|
||||||
local nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
--minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
return #nodes
|
|
||||||
end
|
|
||||||
|
|
||||||
local atleast_nodes_in_grid = function(pos, search_distance, height, node_name, threshold)
|
|
||||||
local counter = counter +1
|
|
||||||
-- minetest.chat_send_all("counter: (" .. counter .. ")")
|
|
||||||
local minp = {x=pos.x-search_distance,y=height, z=pos.z+20}
|
|
||||||
local maxp = {x=pos.x+search_distance,y=height, z=pos.z+20}
|
|
||||||
local nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("z+Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
if #nodes >= threshold then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
local totalnodes = #nodes
|
|
||||||
minp = {x=pos.x-search_distance,y=height, z=pos.z-20}
|
|
||||||
maxp = {x=pos.x+search_distance,y=height, z=pos.z-20}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("z-Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
if #nodes >= threshold then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
totalnodes = totalnodes + #nodes
|
|
||||||
maxp = {x=pos.x+20,y=height, z=pos.z+search_distance}
|
|
||||||
minp = {x=pos.x+20,y=height, z=pos.z-search_distance}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
if #nodes >= threshold then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
totalnodes = totalnodes + #nodes
|
|
||||||
maxp = {x=pos.x-20,y=height, z=pos.z+search_distance}
|
|
||||||
minp = {x=pos.x-20,y=height, z=pos.z-search_distance}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
if #nodes >= threshold then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
totalnodes = totalnodes + #nodes
|
|
||||||
-- minetest.chat_send_all("Found total(" .. totalnodes .. ")")
|
|
||||||
if totalnodes >= threshold*2 then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local get_immediate_nodes = function(pos)
|
|
||||||
pos.y = pos.y-1
|
|
||||||
node_under_feet = minetest.env:get_node(pos).name
|
|
||||||
pos.y = pos.y-3
|
|
||||||
node_3_under_feet = minetest.env:get_node(pos).name
|
|
||||||
pos.y = pos.y+3
|
|
||||||
pos.y = pos.y+2.2
|
|
||||||
node_at_upper_body = minetest.env:get_node(pos).name
|
|
||||||
pos.y = pos.y-1.19
|
|
||||||
node_at_lower_body = minetest.env:get_node(pos).name
|
|
||||||
pos.y = pos.y+0.99
|
|
||||||
--minetest.chat_send_all("node_under_feet(" .. nodename .. ")")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local get_ambience = function(player)
|
|
||||||
local player_is_climbing = false
|
|
||||||
local player_is_descending = false
|
|
||||||
local player_is_moving_horiz = false
|
|
||||||
local standing_in_water = false
|
|
||||||
local pos = player:getpos()
|
|
||||||
get_immediate_nodes(pos)
|
|
||||||
|
|
||||||
if last_x_pos ~=pos.x or last_z_pos ~=pos.z then
|
|
||||||
player_is_moving_horiz = true
|
|
||||||
end
|
|
||||||
if pos.y > last_y_pos+.5 then
|
|
||||||
player_is_climbing = true
|
|
||||||
end
|
|
||||||
if pos.y < last_y_pos-.5 then
|
|
||||||
player_is_descending = true
|
|
||||||
end
|
|
||||||
|
|
||||||
last_x_pos =pos.x
|
|
||||||
last_z_pos =pos.z
|
|
||||||
last_y_pos =pos.y
|
|
||||||
|
|
||||||
if string.find(node_at_upper_body, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {water=water, water_frequent=water_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {water=water, water_frequent=water_frequent}
|
|
||||||
end
|
|
||||||
elseif node_at_upper_body == "air" then
|
|
||||||
if string.find(node_at_lower_body, "default:water") or string.find(node_under_feet, "default:water") then
|
|
||||||
--minetest.chat_send_all("bottom counted as water")
|
|
||||||
--we found air at upperbody, and water at lower body. Now there are 4 possibilities:
|
|
||||||
--Key: under feet, moving or not
|
|
||||||
--swimming w, m swimming
|
|
||||||
--walking in water nw, m splashing
|
|
||||||
--treading water w, nm sloshing
|
|
||||||
--standing in water nw, nm beach trumps, then sloshing
|
|
||||||
if player_is_moving_horiz then
|
|
||||||
if string.find(node_under_feet, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {swimming_frequent=swimming_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {swimming_frequent}
|
|
||||||
end
|
|
||||||
else --didn't find water under feet: walking in water
|
|
||||||
if music then
|
|
||||||
return {splashing_water=splashing_water, music=music}
|
|
||||||
else
|
|
||||||
return {splashing_water}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else--player is not moving: treading water
|
|
||||||
if string.find(node_under_feet, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {water_surface=water_surface, music=music}
|
|
||||||
else
|
|
||||||
return {water_surface}
|
|
||||||
end
|
|
||||||
else --didn't find water under feet
|
|
||||||
standing_in_water = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- minetest.chat_send_all("----------")
|
|
||||||
-- if not player_is_moving_horiz then
|
|
||||||
-- minetest.chat_send_all("not moving horiz")
|
|
||||||
-- else
|
|
||||||
-- minetest.chat_send_all("moving horiz")
|
|
||||||
-- end
|
|
||||||
-- minetest.chat_send_all("nub:" ..node_at_upper_body)
|
|
||||||
-- minetest.chat_send_all("nlb:" ..node_at_lower_body)
|
|
||||||
-- minetest.chat_send_all("nuf:" ..node_under_feet)
|
|
||||||
-- minetest.chat_send_all("----------")
|
|
||||||
|
|
||||||
|
|
||||||
-- if player_is_moving_horiz then
|
|
||||||
-- minetest.chat_send_all("playermoving")
|
|
||||||
-- end
|
|
||||||
-- if player_is_climbing then
|
|
||||||
-- minetest.chat_send_all("player Climbing")
|
|
||||||
-- end
|
|
||||||
-- minetest.chat_send_all("nub:" ..node_at_upper_body)
|
|
||||||
-- minetest.chat_send_all("nlb:" ..node_at_lower_body)
|
|
||||||
-- minetest.chat_send_all("nuf:" ..node_under_feet)
|
|
||||||
-- minetest.chat_send_all("n3uf:" ..node_3_under_feet)
|
|
||||||
--
|
|
||||||
--local air_or_ignore = {air=true,ignore=true}
|
|
||||||
-- minp = {x=pos.x-3,y=pos.y-4, z=pos.z-3}
|
|
||||||
-- maxp = {x=pos.x+3,y=pos.y-1, z=pos.z+3}
|
|
||||||
--local air_under_player = nodes_in_coords(minp, maxp, "air")
|
|
||||||
--local ignore_under_player = nodes_in_coords(minp, maxp, "ignore")
|
|
||||||
--local air_plus_ignore_under = air_under_player + ignore_under_player
|
|
||||||
-- minetest.chat_send_all("airUnder:" ..air_under_player)
|
|
||||||
-- minetest.chat_send_all("ignoreUnder:" ..ignore_under_player)
|
|
||||||
-- minetest.chat_send_all("a+i:" ..air_plus_ignore_under)
|
|
||||||
-- minetest.chat_send_all("counter: (" .. counter .. "-----------------)")
|
|
||||||
--minetest.chat_send_all(air_or_ignore[node_under_feet])
|
|
||||||
-- if (player_is_moving_horiz or player_is_climbing) and air_or_ignore[node_at_upper_body] and air_or_ignore[node_at_lower_body]
|
|
||||||
-- and air_or_ignore[node_under_feet] and air_plus_ignore_under == 196 and not player_is_descending then
|
|
||||||
--minetest.chat_send_all("flying!!!!")
|
|
||||||
-- if music then
|
|
||||||
-- return {flying=flying, music=music}
|
|
||||||
-- else
|
|
||||||
--- return {flying}
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
--minetest.chat_send_all("not flying!!!!")
|
|
||||||
|
|
||||||
if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then
|
|
||||||
if music then
|
|
||||||
return {lava=lava, lava2=lava2, music=music}
|
|
||||||
else
|
|
||||||
return {lava=lava}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nodes_in_range(pos, 6, "default:water_flowing")>45 then
|
|
||||||
if music then
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music}
|
|
||||||
else
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--if we are near sea level and there is lots of water around the area
|
|
||||||
if pos.y < 7 and pos.y >0 and atleast_nodes_in_grid(pos, 60, 1, "default:water_source", 51 ) then
|
|
||||||
if music then
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if standing_in_water then
|
|
||||||
if music then
|
|
||||||
return {water_surface=water_surface, music=music}
|
|
||||||
else
|
|
||||||
return {water_surface}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local desert_in_range = (nodes_in_range(pos, 6, "default:desert_sand")+nodes_in_range(pos, 6, "default:desert_stone"))
|
|
||||||
--minetest.chat_send_all("desertcount: " .. desert_in_range .. ",".. pos.y )
|
|
||||||
if desert_in_range >250 then
|
|
||||||
if music then
|
|
||||||
return {desert=desert, desert_frequent=desert_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {desert=desert, desert_frequent=desert_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- pos.y = pos.y-2
|
|
||||||
-- nodename = minetest.env:get_node(pos).name
|
|
||||||
-- minetest.chat_send_all("Found " .. nodename .. pos.y )
|
|
||||||
|
|
||||||
|
|
||||||
if player:getpos().y < 0 then
|
|
||||||
if music then
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if is_daytime() then
|
|
||||||
if music then
|
|
||||||
return {day=day, day_frequent=day_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {day=day, day_frequent=day_frequent}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if music then
|
|
||||||
return {night=night, night_frequent=night_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {night=night, night_frequent=night_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- start playing the sound, set the handler and delete the handler after sound is played
|
|
||||||
local play_sound = function(player, list, number, is_music)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if list.handler[player_name] == nil then
|
|
||||||
local gain = 1.0
|
|
||||||
if list[number].gain ~= nil then
|
|
||||||
if is_music then
|
|
||||||
gain = list[number].gain*volume[player_name].music
|
|
||||||
--minetest.chat_send_all("gain music: " .. gain )
|
|
||||||
else
|
|
||||||
gain = list[number].gain*volume[player_name].sound
|
|
||||||
--minetest.chat_send_all("gain sound: " .. gain )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain})
|
|
||||||
if handler ~= nil then
|
|
||||||
list.handler[player_name] = handler
|
|
||||||
minetest.after(list[number].length, function(args)
|
|
||||||
local list = args[1]
|
|
||||||
local player_name = args[2]
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end, {list, player_name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- stops all sounds that are not in still_playing
|
|
||||||
local stop_sound = function(still_playing, player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
for key,value in pairs(ambienceList) do
|
|
||||||
if still_playing[key] == nil then
|
|
||||||
if value.handler[player_name] ~= nil then
|
|
||||||
if value.on_stop ~= nil then
|
|
||||||
minetest.sound_play(value.on_stop, {to_player=player_name,gain=volume[player_name].sound})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(value.handler[player_name])
|
|
||||||
value.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
timer = timer+dtime
|
|
||||||
if timer < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
timer = 0
|
|
||||||
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
|
||||||
ambiences = get_ambience(player)
|
|
||||||
stop_sound(ambiences, player)
|
|
||||||
for _,ambience in pairs(ambiences) do
|
|
||||||
if math.random(1, 1000) <= ambience.frequency then
|
|
||||||
-- if(played_on_start) then
|
|
||||||
-- -- minetest.chat_send_all("playedOnStart " )
|
|
||||||
-- else
|
|
||||||
-- -- minetest.chat_send_all("FALSEplayedOnStart " )
|
|
||||||
-- end
|
|
||||||
if ambience.on_start ~= nil and played_on_start == false then
|
|
||||||
played_on_start = true
|
|
||||||
minetest.sound_play(ambience.on_start, {to_player=player:get_player_name(),gain=SOUNDVOLUME})
|
|
||||||
end
|
|
||||||
-- minetest.chat_send_all("ambience: " ..ambience )
|
|
||||||
-- if ambience.on_start ~= nil and played_on_start_flying == false then
|
|
||||||
-- played_on_start_flying = true
|
|
||||||
-- minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
|
|
||||||
-- end
|
|
||||||
local is_music =false
|
|
||||||
if ambience.is_music ~= nil then
|
|
||||||
is_music = true
|
|
||||||
end
|
|
||||||
play_sound(player, ambience, math.random(1, #ambience),is_music)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_on_joinplayer(
|
|
||||||
function(player)
|
|
||||||
if volume[player:get_player_name()] == nil then
|
|
||||||
volume[player:get_player_name()] = {music=MUSICVOLUME, sound=SOUNDVOLUME}
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_chatcommand(
|
|
||||||
"volume",
|
|
||||||
{
|
|
||||||
description = "View sliders to set sound a music volume",
|
|
||||||
func = function(name,param)
|
|
||||||
minetest.show_formspec(
|
|
||||||
name,
|
|
||||||
"ambience:volume",
|
|
||||||
"size[6,3.5]" ..
|
|
||||||
"label[0,0.5;Music]" ..
|
|
||||||
"scrollbar[0,1;5.8,0.4;horizontal;music;" .. volume[name].music * 1000 .. "]" ..
|
|
||||||
"label[0,1.5;Sound]" ..
|
|
||||||
"scrollbar[0,2;5.8,0.4;horizontal;sound;" .. volume[name].sound * 1000 .. "]" ..
|
|
||||||
"button_exit[2,2.8;2,0.8;quit;Done]"
|
|
||||||
)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_on_player_receive_fields(
|
|
||||||
function(player, formname, fields)
|
|
||||||
if formname ~= "ambience:volume" then
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
minetest.log(dump(fields))
|
|
||||||
if fields.quit ~= "true" then
|
|
||||||
volume[player:get_player_name()].music = tonumber(string.split(fields.music,":")[2]) / 1000
|
|
||||||
volume[player:get_player_name()].sound = tonumber(string.split(fields.sound,":")[2]) / 1000
|
|
||||||
end
|
|
||||||
if fields.quit then
|
|
||||||
local file, err = io.open(world_path.."/ambience_volumes", "w")
|
|
||||||
if not err then
|
|
||||||
for item in pairs(volume) do
|
|
||||||
file:write(item..":"..volume[item].music..":"..volume[item].sound.."\n")
|
|
||||||
end
|
|
||||||
file:close()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return true
|
|
||||||
end)
|
|
||||||
|
|
||||||
minetest.register_chatcommand(
|
|
||||||
"svol",
|
|
||||||
{
|
|
||||||
params = "<svol>",
|
|
||||||
description = "set volume of sounds, default 1 normal volume.",
|
|
||||||
privs = {server=true},
|
|
||||||
func = function(name, param)
|
|
||||||
SOUNDVOLUME = param
|
|
||||||
-- local player = minetest.env:get_player_by_name(name)
|
|
||||||
-- ambiences = get_ambience(player)
|
|
||||||
-- stop_sound({}, player)
|
|
||||||
minetest.chat_send_player(name, "Sound volume set.")
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.register_chatcommand(
|
|
||||||
"mvol",
|
|
||||||
{
|
|
||||||
params = "<mvol>",
|
|
||||||
description = "set volume of music, default 1 normal volume.",
|
|
||||||
privs = {server=true},
|
|
||||||
func = function(name, param)
|
|
||||||
MUSICVOLUME = param
|
|
||||||
-- local player = minetest.env:get_player_by_name(name)
|
|
||||||
-- stop_sound({}, player)
|
|
||||||
-- ambiences = get_ambience(player)
|
|
||||||
minetest.chat_send_player(name, "Music volume set.")
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.log("action", "[ambience] loaded.")
|
|
@ -1,287 +0,0 @@
|
|||||||
local night = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 10,
|
|
||||||
{name="horned_owl", length=3},
|
|
||||||
{name="Wolves_Howling", length=11},
|
|
||||||
{name="ComboWind", length=17},
|
|
||||||
}
|
|
||||||
|
|
||||||
local night_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 25,
|
|
||||||
{name="Crickets_At_NightCombo", length=69},
|
|
||||||
}
|
|
||||||
|
|
||||||
local day = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 5,
|
|
||||||
{name="Best Cardinal Bird", length=4},
|
|
||||||
{name="craw", length=3},
|
|
||||||
{name="bluejay", length=18},
|
|
||||||
{name="ComboWind", length=17},
|
|
||||||
}
|
|
||||||
|
|
||||||
local day_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 25,
|
|
||||||
{name="robin2", length=16},
|
|
||||||
{name="birdsongnl", length=12.5},
|
|
||||||
{name="bird", length=30},
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 5,
|
|
||||||
{name="Bats_in_Cave", length=5},
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 100,
|
|
||||||
{name="drippingwater_drip_a", length=2},
|
|
||||||
{name="drippingwater_drip_b", length=2},
|
|
||||||
{name="drippingwater_drip_c", length=2},
|
|
||||||
{name="Single_Water_Droplet", length=3},
|
|
||||||
{name="Spooky_Water_Drops", length=7},
|
|
||||||
}
|
|
||||||
|
|
||||||
local water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 0,--dolphins dont fit into small lakes
|
|
||||||
{name="dolphins", length=6},
|
|
||||||
{name="dolphins_screaming", length=16.5},
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 100,
|
|
||||||
on_stop = "drowning_gasp",
|
|
||||||
{name="scuba1bubbles", length=11},
|
|
||||||
{name="scuba1calm", length=10},
|
|
||||||
{name="scuba1calm2", length=8.5},
|
|
||||||
{name="scuba1interestingbubbles", length=11},
|
|
||||||
{name="scuba1tubulentbubbles", length=10.5},
|
|
||||||
}
|
|
||||||
|
|
||||||
local splash = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 100,
|
|
||||||
{name="Splash", length=1.5},
|
|
||||||
}
|
|
||||||
|
|
||||||
local play_music = minetest.setting_getbool("music") or false
|
|
||||||
local music = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1,
|
|
||||||
{name="mtest", length=4*60+33, gain=0.3},
|
|
||||||
{name="music_1", length=1*60+52, gain=0.3},
|
|
||||||
{name="ambiance", length=19, gain=0.3},
|
|
||||||
{name="dark_ambiance", length=46, gain=0.3},
|
|
||||||
{name="eastern_feeling", length=3*60+51, gain=0.3},
|
|
||||||
{name="echos", length=2*60+26, gain=0.3},
|
|
||||||
{name="FoamOfTheSea", length=1*60+50, gain=0.3},
|
|
||||||
}
|
|
||||||
|
|
||||||
local is_daytime = function()
|
|
||||||
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
|
|
||||||
end
|
|
||||||
|
|
||||||
local get_ambience = function(player)
|
|
||||||
local table = {}
|
|
||||||
|
|
||||||
local play_water = false
|
|
||||||
local play_splash = false
|
|
||||||
local play_day = false
|
|
||||||
local play_cave = false
|
|
||||||
local play_night = false
|
|
||||||
|
|
||||||
local pos = player:getpos()
|
|
||||||
pos.y = pos.y+1.5
|
|
||||||
local nodename = minetest.env:get_node(pos).name
|
|
||||||
if string.find(nodename, "default:water") then
|
|
||||||
play_water = true
|
|
||||||
elseif nodename == "air" then
|
|
||||||
pos.y = pos.y-1.5
|
|
||||||
local nodename = minetest.env:get_node(pos).name
|
|
||||||
if string.find(nodename, "default:water") then
|
|
||||||
play_splash = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if player:getpos().y < 0 then
|
|
||||||
play_cave = true
|
|
||||||
elseif is_daytime() then
|
|
||||||
play_day = true
|
|
||||||
else
|
|
||||||
play_night = true
|
|
||||||
end
|
|
||||||
|
|
||||||
if play_music then
|
|
||||||
table.music = music
|
|
||||||
end
|
|
||||||
if play_water then
|
|
||||||
table.water = water
|
|
||||||
table.water_frequent = water_frequent
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
if play_splash then
|
|
||||||
table.splash = splash
|
|
||||||
end
|
|
||||||
if play_day then
|
|
||||||
table.day = day
|
|
||||||
table.day_frequent = day_frequent
|
|
||||||
elseif play_night then
|
|
||||||
table.night = night
|
|
||||||
table.night_frequent = night_frequent
|
|
||||||
elseif play_cave then
|
|
||||||
table.cave = cave
|
|
||||||
table.cave_frequent = cave_frequent
|
|
||||||
end
|
|
||||||
return table
|
|
||||||
end
|
|
||||||
|
|
||||||
-- start playing the sound, set the handler and delete the handler after sound is played
|
|
||||||
local play_sound = function(player, list, number)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if list.handler[player_name] == nil then
|
|
||||||
local gain = 1.0
|
|
||||||
if list[number].gain ~= nil then
|
|
||||||
gain = list[number].gain
|
|
||||||
end
|
|
||||||
local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain})
|
|
||||||
if handler ~= nil then
|
|
||||||
list.handler[player_name] = handler
|
|
||||||
minetest.after(list[number].length, function(args)
|
|
||||||
local list = args[1]
|
|
||||||
local player_name = args[2]
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end, {list, player_name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- stops all sounds that are not in still_playing
|
|
||||||
local stop_sound = function(still_playing, player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if still_playing.cave == nil then
|
|
||||||
local list = cave
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.cave_frequent == nil then
|
|
||||||
local list = cave_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.night == nil then
|
|
||||||
local list = night
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.night_frequent == nil then
|
|
||||||
local list = night_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day == nil then
|
|
||||||
local list = day
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day_frequent == nil then
|
|
||||||
local list = day_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.music == nil then
|
|
||||||
local list = music
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water == nil then
|
|
||||||
local list = water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water_frequent == nil then
|
|
||||||
local list = water_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.splash == nil then
|
|
||||||
local list = splash
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
timer = timer+dtime
|
|
||||||
if timer < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
timer = 0
|
|
||||||
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
|
||||||
local ambiences = get_ambience(player)
|
|
||||||
stop_sound(ambiences, player)
|
|
||||||
for _,ambience in pairs(ambiences) do
|
|
||||||
if math.random(1, 100) <= ambience.frequency then
|
|
||||||
play_sound(player, ambience, math.random(1, #ambience))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
@ -1,439 +0,0 @@
|
|||||||
--------------------------------------------------------------------------------------------------------
|
|
||||||
--Ambiance Configuration for version .16
|
|
||||||
|
|
||||||
local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000.
|
|
||||||
|
|
||||||
--for frequencies below use a number between 0 and max_frequency_all
|
|
||||||
--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds
|
|
||||||
local night_frequency = 20 --owls, wolves
|
|
||||||
local night_volume = 0.9
|
|
||||||
local night_frequent_frequency = 150 --crickets
|
|
||||||
local night_frequent_volume = 0.9
|
|
||||||
local day_frequency = 100 --crow, bluejay, cardinal
|
|
||||||
local day_volume = 0.9
|
|
||||||
local day_frequent_frequency = 1000 --crow, bluejay, cardinal
|
|
||||||
local day_frequent_volume = 0.18
|
|
||||||
local cave_frequency = 10 --bats
|
|
||||||
local cave_volume = 1.0
|
|
||||||
local cave_frequent_frequency = 70 --drops of water dripping
|
|
||||||
local cave_frequent_volume = 1.0
|
|
||||||
local beach_frequency = 20 --seagulls
|
|
||||||
local beach_volume = 1.0
|
|
||||||
local beach_frequent_frequency = 1000 --waves
|
|
||||||
local beach_frequent_volume = 1.0
|
|
||||||
local water_frequent_frequency = 1000 --water sounds
|
|
||||||
local water_frequent_volume = 1.0
|
|
||||||
local music_frequency = 7 --music (suggestion: keep this one low like around 6)
|
|
||||||
local music_volume = 0.3
|
|
||||||
--End of Config
|
|
||||||
----------------------------------------------------------------------------------------------------
|
|
||||||
local played_on_start = false
|
|
||||||
local night = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequency,
|
|
||||||
{name="horned_owl", length=3, gain=night_volume},
|
|
||||||
{name="Wolves_Howling", length=11, gain=night_volume},
|
|
||||||
{name="ComboWind", length=17, gain=night_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local night_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequent_frequency,
|
|
||||||
{name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequency,
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_volume},
|
|
||||||
{name="craw", length=3, gain=day_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequent_frequency,
|
|
||||||
{name="robin2", length=16, gain=day_frequent_volume},
|
|
||||||
{name="birdsongnl", length=13, gain=day_frequent_volume},
|
|
||||||
{name="bird", length=30, gain=day_frequent_volume},
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_frequent_volume},
|
|
||||||
{name="craw", length=3, gain=day_frequent_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_frequent_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_frequent_volume*3}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local cave = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequency,
|
|
||||||
{name="Bats_in_Cave", length=5, gain=cave_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequent_frequency,
|
|
||||||
{name="drippingwater_drip_a", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_b", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_c", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="Single_Water_Droplet", length=3, gain=cave_frequent_volume},
|
|
||||||
{name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequency,
|
|
||||||
{name="seagull", length=4.5, gain=beach_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequent_frequency,
|
|
||||||
{name="fiji_beach", length=43.5, gain=beach_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 0,--dolphins dont fit into small lakes
|
|
||||||
{name="dolphins", length=6},
|
|
||||||
{name="dolphins_screaming", length=16.5}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = water_frequent_frequency,
|
|
||||||
on_stop = "drowning_gasp",
|
|
||||||
on_start = "Splash",
|
|
||||||
{name="scuba1bubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here.
|
|
||||||
{name="scuba1calm2", length=8.5, gain=water_frequent_volume},
|
|
||||||
{name="scuba1interestingbubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local flowing_water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=14, gain=.4}
|
|
||||||
}
|
|
||||||
local flowing_water2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=11, gain=.3}
|
|
||||||
}
|
|
||||||
|
|
||||||
local lava = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=20}
|
|
||||||
}
|
|
||||||
local lava2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=15}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local play_music = minetest.setting_getbool("music") or false
|
|
||||||
local music = {
|
|
||||||
handler = {},
|
|
||||||
frequency = music_frequency,
|
|
||||||
{name="mtest", length=4*60+33, gain=music_volume},
|
|
||||||
{name="echos", length=2*60+26, gain=music_volume},
|
|
||||||
{name="FoamOfTheSea", length=1*60+50, gain=music_volume},
|
|
||||||
{name="eastern_feeling", length=3*60+51, gain=music_volume},
|
|
||||||
{name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume},
|
|
||||||
{name="dark_ambiance", length=44, gain=music_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local is_daytime = function()
|
|
||||||
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[old
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
local search_p = {x=0, y=0, z=0}
|
|
||||||
local nodes_found = 0
|
|
||||||
for p_x=(pos.x-search_distance), (pos.x+search_distance) do
|
|
||||||
for p_y=(pos.y-search_distance), (pos.y+search_distance) do
|
|
||||||
for p_z=(pos.z-search_distance), (pos.z+search_distance) do
|
|
||||||
local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z})
|
|
||||||
if search_n.name == node_name then
|
|
||||||
nodes_found = nodes_found + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nodes_found
|
|
||||||
--minetest.chat_send_all("Range: " .. tostring(search_distance) .. " | Found (" .. node_name .. ": " .. nodes_found .. ")")
|
|
||||||
end --]]
|
|
||||||
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
|
|
||||||
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
return #nodes
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local get_ambience = function(player)
|
|
||||||
local pos = player:getpos()
|
|
||||||
pos.y = pos.y+1.0
|
|
||||||
local nodename = minetest.env:get_node(pos).name
|
|
||||||
if string.find(nodename, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {water=water, water_frequent=water_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {water=water, water_frequent=water_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then
|
|
||||||
if music then
|
|
||||||
return {lava=lava, lava2=lava2, music=music}
|
|
||||||
else
|
|
||||||
return {lava=lava}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nodes_in_range(pos, 7, "default:water_flowing")>5 then
|
|
||||||
if music then
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music}
|
|
||||||
else
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pos.y = pos.y-2
|
|
||||||
nodename = minetest.env:get_node(pos).name
|
|
||||||
--minetest.chat_send_all("Found " .. nodename .. pos.y )
|
|
||||||
if string.find(nodename, "default:sand") and pos.y < 5 then
|
|
||||||
if music then
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if player:getpos().y < 0 then
|
|
||||||
if music then
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if is_daytime() then
|
|
||||||
if music then
|
|
||||||
return {day=day, day_frequent=day_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {day=day, day_frequent=day_frequent}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if music then
|
|
||||||
return {night=night, night_frequent=night_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {night=night, night_frequent=night_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- start playing the sound, set the handler and delete the handler after sound is played
|
|
||||||
local play_sound = function(player, list, number)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if list.handler[player_name] == nil then
|
|
||||||
local gain = 1.0
|
|
||||||
if list[number].gain ~= nil then
|
|
||||||
gain = list[number].gain
|
|
||||||
end
|
|
||||||
local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain})
|
|
||||||
if handler ~= nil then
|
|
||||||
list.handler[player_name] = handler
|
|
||||||
minetest.after(list[number].length, function(args)
|
|
||||||
local list = args[1]
|
|
||||||
local player_name = args[2]
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end, {list, player_name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- stops all sounds that are not in still_playing
|
|
||||||
local stop_sound = function(still_playing, player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if still_playing.cave == nil then
|
|
||||||
local list = cave
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.cave_frequent == nil then
|
|
||||||
local list = cave_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.beach == nil then
|
|
||||||
local list = beach
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.beach_frequent == nil then
|
|
||||||
local list = beach_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if still_playing.night == nil then
|
|
||||||
local list = night
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.night_frequent == nil then
|
|
||||||
local list = night_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day == nil then
|
|
||||||
local list = day
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day_frequent == nil then
|
|
||||||
local list = day_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.music == nil then
|
|
||||||
local list = music
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water == nil then
|
|
||||||
local list = flowing_water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water2 == nil then
|
|
||||||
local list = flowing_water2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava == nil then
|
|
||||||
local list = lava
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava2 == nil then
|
|
||||||
local list = lava2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water == nil then
|
|
||||||
local list = water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water_frequent == nil then
|
|
||||||
local list = water_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
played_on_start = false
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
timer = timer+dtime
|
|
||||||
if timer < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
timer = 0
|
|
||||||
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
|
||||||
local ambiences = get_ambience(player)
|
|
||||||
stop_sound(ambiences, player)
|
|
||||||
for _,ambience in pairs(ambiences) do
|
|
||||||
if math.random(1, 1000) <= ambience.frequency then
|
|
||||||
if ambience.on_start ~= nil and played_on_start == false then
|
|
||||||
played_on_start = true
|
|
||||||
minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
play_sound(player, ambience, math.random(1, #ambience))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
@ -1,474 +0,0 @@
|
|||||||
--------------------------------------------------------------------------------------------------------
|
|
||||||
--Ambiance Configuration for version .17
|
|
||||||
|
|
||||||
local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000.
|
|
||||||
|
|
||||||
--for frequencies below use a number between 0 and max_frequency_all
|
|
||||||
--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds
|
|
||||||
local night_frequency = 20 --owls, wolves
|
|
||||||
local night_volume = 0.9
|
|
||||||
local night_frequent_frequency = 150 --crickets
|
|
||||||
local night_frequent_volume = 0.9
|
|
||||||
local day_frequency = 100 --crow, bluejay, cardinal
|
|
||||||
local day_volume = 0.9
|
|
||||||
local day_frequent_frequency = 1000 --crow, bluejay, cardinal
|
|
||||||
local day_frequent_volume = 0.18
|
|
||||||
local cave_frequency = 10 --bats
|
|
||||||
local cave_volume = 1.0
|
|
||||||
local cave_frequent_frequency = 70 --drops of water dripping
|
|
||||||
local cave_frequent_volume = 1.0
|
|
||||||
local beach_frequency = 20 --seagulls
|
|
||||||
local beach_volume = 1.0
|
|
||||||
local beach_frequent_frequency = 1000 --waves
|
|
||||||
local beach_frequent_volume = 1.0
|
|
||||||
local water_frequent_frequency = 1000 --water sounds
|
|
||||||
local water_frequent_volume = 1.0
|
|
||||||
local music_frequency = 0 --music (suggestion: keep this one low like around 6)
|
|
||||||
local music_volume = 0.3
|
|
||||||
--End of Config
|
|
||||||
----------------------------------------------------------------------------------------------------
|
|
||||||
local played_on_start = false
|
|
||||||
local night = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequency,
|
|
||||||
{name="horned_owl", length=3, gain=night_volume},
|
|
||||||
{name="Wolves_Howling", length=11, gain=night_volume},
|
|
||||||
{name="ComboWind", length=17, gain=night_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local night_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequent_frequency,
|
|
||||||
{name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequency,
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_volume},
|
|
||||||
{name="craw", length=3, gain=day_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequent_frequency,
|
|
||||||
{name="robin2", length=16, gain=day_frequent_volume},
|
|
||||||
{name="birdsongnl", length=13, gain=day_frequent_volume},
|
|
||||||
{name="bird", length=30, gain=day_frequent_volume},
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_frequent_volume},
|
|
||||||
{name="craw", length=3, gain=day_frequent_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_frequent_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_frequent_volume*3}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local cave = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequency,
|
|
||||||
{name="Bats_in_Cave", length=5, gain=cave_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequent_frequency,
|
|
||||||
{name="drippingwater_drip_a", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_b", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_c", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="Single_Water_Droplet", length=3, gain=cave_frequent_volume},
|
|
||||||
{name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequency,
|
|
||||||
{name="seagull", length=4.5, gain=beach_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequent_frequency,
|
|
||||||
{name="fiji_beach", length=43.5, gain=beach_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 0,--dolphins dont fit into small lakes
|
|
||||||
{name="dolphins", length=6},
|
|
||||||
{name="dolphins_screaming", length=16.5}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = water_frequent_frequency,
|
|
||||||
on_stop = "drowning_gasp",
|
|
||||||
on_start = "Splash",
|
|
||||||
{name="scuba1bubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here.
|
|
||||||
{name="scuba1calm2", length=8.5, gain=water_frequent_volume},
|
|
||||||
{name="scuba1interestingbubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_surface = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 10,
|
|
||||||
on_start = "Splash",
|
|
||||||
{name="lake_waves_2_calm", length=9.5},
|
|
||||||
{name="lake_waves_2_variety", length=13.1}
|
|
||||||
}
|
|
||||||
|
|
||||||
local flowing_water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=14, gain=.4}
|
|
||||||
}
|
|
||||||
local flowing_water2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=11, gain=.3}
|
|
||||||
}
|
|
||||||
|
|
||||||
local lava = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=20}
|
|
||||||
}
|
|
||||||
local lava2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=15}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local play_music = minetest.setting_getbool("music") or false
|
|
||||||
local music = {
|
|
||||||
handler = {},
|
|
||||||
frequency = music_frequency,
|
|
||||||
{name="mtest", length=4*60+33, gain=music_volume},
|
|
||||||
{name="echos", length=2*60+26, gain=music_volume},
|
|
||||||
{name="FoamOfTheSea", length=1*60+50, gain=music_volume},
|
|
||||||
{name="eastern_feeling", length=3*60+51, gain=music_volume},
|
|
||||||
{name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume},
|
|
||||||
{name="dark_ambiance", length=44, gain=music_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local is_daytime = function()
|
|
||||||
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
|
|
||||||
end
|
|
||||||
|
|
||||||
--[[old
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
local search_p = {x=0, y=0, z=0}
|
|
||||||
local nodes_found = 0
|
|
||||||
for p_x=(pos.x-search_distance), (pos.x+search_distance) do
|
|
||||||
for p_y=(pos.y-search_distance), (pos.y+search_distance) do
|
|
||||||
for p_z=(pos.z-search_distance), (pos.z+search_distance) do
|
|
||||||
local search_n = minetest.env:get_node({x=p_x, y=p_y, z=p_z})
|
|
||||||
if search_n.name == node_name then
|
|
||||||
nodes_found = nodes_found + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return nodes_found
|
|
||||||
--minetest.chat_send_all("Range: " .. tostring(search_distance) .. " | Found (" .. node_name .. ": " .. nodes_found .. ")")
|
|
||||||
end --]]
|
|
||||||
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
|
|
||||||
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
return #nodes
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local get_ambience = function(player)
|
|
||||||
local pos = player:getpos()
|
|
||||||
pos.y = pos.y+1.0
|
|
||||||
local nodename = minetest.env:get_node(pos).name
|
|
||||||
if string.find(nodename, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {water=water, water_frequent=water_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {water=water, water_frequent=water_frequent}
|
|
||||||
end
|
|
||||||
elseif nodename == "air" then
|
|
||||||
pos.y = pos.y-1.5
|
|
||||||
local nodename = minetest.env:get_node(pos).name
|
|
||||||
pos.y = pos.y+1.5
|
|
||||||
if string.find(nodename, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {water_surface=water_surface, music=music}
|
|
||||||
else
|
|
||||||
return {water_surface}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then
|
|
||||||
if music then
|
|
||||||
return {lava=lava, lava2=lava2, music=music}
|
|
||||||
else
|
|
||||||
return {lava=lava}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nodes_in_range(pos, 7, "default:water_flowing")>5 then
|
|
||||||
if music then
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music}
|
|
||||||
else
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
pos.y = pos.y-2
|
|
||||||
nodename = minetest.env:get_node(pos).name
|
|
||||||
--minetest.chat_send_all("Found " .. nodename .. pos.y )
|
|
||||||
if string.find(nodename, "default:sand") and pos.y < 5 then
|
|
||||||
if music then
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if player:getpos().y < 0 then
|
|
||||||
if music then
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if is_daytime() then
|
|
||||||
if music then
|
|
||||||
return {day=day, day_frequent=day_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {day=day, day_frequent=day_frequent}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if music then
|
|
||||||
return {night=night, night_frequent=night_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {night=night, night_frequent=night_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- start playing the sound, set the handler and delete the handler after sound is played
|
|
||||||
local play_sound = function(player, list, number)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if list.handler[player_name] == nil then
|
|
||||||
local gain = 1.0
|
|
||||||
if list[number].gain ~= nil then
|
|
||||||
gain = list[number].gain
|
|
||||||
end
|
|
||||||
local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain})
|
|
||||||
if handler ~= nil then
|
|
||||||
list.handler[player_name] = handler
|
|
||||||
minetest.after(list[number].length, function(args)
|
|
||||||
local list = args[1]
|
|
||||||
local player_name = args[2]
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end, {list, player_name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- stops all sounds that are not in still_playing
|
|
||||||
local stop_sound = function(still_playing, player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if still_playing.cave == nil then
|
|
||||||
local list = cave
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.cave_frequent == nil then
|
|
||||||
local list = cave_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.beach == nil then
|
|
||||||
local list = beach
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.beach_frequent == nil then
|
|
||||||
local list = beach_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if still_playing.night == nil then
|
|
||||||
local list = night
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.night_frequent == nil then
|
|
||||||
local list = night_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day == nil then
|
|
||||||
local list = day
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day_frequent == nil then
|
|
||||||
local list = day_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.music == nil then
|
|
||||||
local list = music
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water == nil then
|
|
||||||
local list = flowing_water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water2 == nil then
|
|
||||||
local list = flowing_water2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava == nil then
|
|
||||||
local list = lava
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava2 == nil then
|
|
||||||
local list = lava2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water == nil then
|
|
||||||
local list = water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water_surface == nil then
|
|
||||||
local list = water_surface
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
played_on_start = false
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water_frequent == nil then
|
|
||||||
local list = water_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
minetest.chat_send_all("list.on_stop " .. list.on_stop )
|
|
||||||
-- played_on_start = false
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
timer = timer+dtime
|
|
||||||
if timer < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
timer = 0
|
|
||||||
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
|
||||||
local ambiences = get_ambience(player)
|
|
||||||
stop_sound(ambiences, player)
|
|
||||||
for _,ambience in pairs(ambiences) do
|
|
||||||
if math.random(1, 1000) <= ambience.frequency then
|
|
||||||
if ambience.on_start ~= nil and played_on_start == false then
|
|
||||||
played_on_start = true
|
|
||||||
minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
play_sound(player, ambience, math.random(1, #ambience))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
@ -1,722 +0,0 @@
|
|||||||
--------------------------------------------------------------------------------------------------------
|
|
||||||
--Ambiance Configuration for version .29
|
|
||||||
--working on Flying
|
|
||||||
--PROB: wind stops short even though it says we are still flying and don't hear the start sound.
|
|
||||||
--really BIG prob, it ruins water meaning you hear beach while treading water. (find out if still hear it in .28) because
|
|
||||||
--it is fairly rare in .29
|
|
||||||
--need a separate onstart variable for flying
|
|
||||||
|
|
||||||
|
|
||||||
local max_frequency_all = 1000 --the larger you make this number the lest frequent ALL sounds will happen recommended values between 100-2000.
|
|
||||||
|
|
||||||
--for frequencies below use a number between 0 and max_frequency_all
|
|
||||||
--for volumes below, use a number between 0.0 and 1, the larger the number the louder the sounds
|
|
||||||
local night_frequency = 20 --owls, wolves
|
|
||||||
local night_volume = 0.9
|
|
||||||
local night_frequent_frequency = 150 --crickets
|
|
||||||
local night_frequent_volume = 0.9
|
|
||||||
local day_frequency = 100 --crow, bluejay, cardinal
|
|
||||||
local day_volume = 0.9
|
|
||||||
local day_frequent_frequency = 1000 --crow, bluejay, cardinal
|
|
||||||
local day_frequent_volume = 0.18
|
|
||||||
local cave_frequency = 10 --bats
|
|
||||||
local cave_volume = 1.0
|
|
||||||
local cave_frequent_frequency = 70 --drops of water dripping
|
|
||||||
local cave_frequent_volume = 1.0
|
|
||||||
local beach_frequency = 20 --seagulls
|
|
||||||
local beach_volume = 1.0
|
|
||||||
local beach_frequent_frequency = 1000 --waves
|
|
||||||
local beach_frequent_volume = 1.0
|
|
||||||
local water_frequent_frequency = 1000 --water sounds
|
|
||||||
local water_frequent_volume = 1.0
|
|
||||||
local desert_frequency = 20 --coyote
|
|
||||||
local desert_volume = 1.0
|
|
||||||
local desert_frequent_frequency = 700 --desertwind
|
|
||||||
local desert_frequent_volume = 1.0
|
|
||||||
local swimming_frequent_frequency = 1000 --swimming splashes
|
|
||||||
local swimming_frequent_volume = 1.0
|
|
||||||
local music_frequency = 0 --music (suggestion: keep this one low like around 6)
|
|
||||||
local music_volume = 0.3
|
|
||||||
--End of Config
|
|
||||||
----------------------------------------------------------------------------------------------------
|
|
||||||
local counter=0--*****************
|
|
||||||
local last_x_pos = 0
|
|
||||||
local last_y_pos = 0
|
|
||||||
local last_z_pos = 0
|
|
||||||
local node_under_feet
|
|
||||||
local node_at_upper_body
|
|
||||||
local node_at_lower_body
|
|
||||||
local node_3_under_feet
|
|
||||||
|
|
||||||
local played_on_start = false
|
|
||||||
local played_on_start_flying = false
|
|
||||||
|
|
||||||
local night = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequency,
|
|
||||||
{name="horned_owl", length=3, gain=night_volume},
|
|
||||||
{name="Wolves_Howling", length=11, gain=night_volume},
|
|
||||||
{name="ComboWind", length=17, gain=night_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local night_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = night_frequent_frequency,
|
|
||||||
{name="Crickets_At_NightCombo", length=69, gain=night_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequency,
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_volume},
|
|
||||||
{name="craw", length=3, gain=day_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local day_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequent_frequency,
|
|
||||||
{name="robin2", length=16, gain=day_frequent_volume},
|
|
||||||
{name="birdsongnl", length=13, gain=day_frequent_volume},
|
|
||||||
{name="bird", length=30, gain=day_frequent_volume},
|
|
||||||
{name="Best Cardinal Bird", length=4, gain=day_frequent_volume},
|
|
||||||
{name="craw", length=3, gain=day_frequent_volume},
|
|
||||||
{name="bluejay", length=18, gain=day_frequent_volume},
|
|
||||||
{name="ComboWind", length=17, gain=day_frequent_volume*3}
|
|
||||||
}
|
|
||||||
local swimming_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = day_frequent_frequency,
|
|
||||||
{name="water_swimming_splashing_breath", length=11.5, gain=swimming_frequent_volume},
|
|
||||||
{name="water_swimming_splashing", length=9, gain=swimming_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequency,
|
|
||||||
{name="Bats_in_Cave", length=5, gain=cave_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local cave_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = cave_frequent_frequency,
|
|
||||||
{name="drippingwater_drip_a", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_b", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="drippingwater_drip_c", length=2, gain=cave_frequent_volume},
|
|
||||||
{name="Single_Water_Droplet", length=3, gain=cave_frequent_volume},
|
|
||||||
{name="Spooky_Water_Drops", length=7, gain=cave_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequency,
|
|
||||||
{name="seagull", length=4.5, gain=beach_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local beach_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = beach_frequent_frequency,
|
|
||||||
{name="fiji_beach", length=43.5, gain=beach_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local desert = {
|
|
||||||
handler = {},
|
|
||||||
frequency = desert_frequency,
|
|
||||||
{name="coyote2", length=2.5, gain=desert_volume},
|
|
||||||
{name="RattleSnake", length=8, gain=desert_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local desert_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = desert_frequent_frequency,
|
|
||||||
{name="DesertMonolithMed", length=34.5, gain=desert_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local flying = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
on_start = "crystal_airlines",
|
|
||||||
on_stop = "nothing_yet",
|
|
||||||
{name="ComboWind", length=17, gain=1}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 0,--dolphins dont fit into small lakes
|
|
||||||
{name="dolphins", length=6},
|
|
||||||
{name="dolphins_screaming", length=16.5}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_frequent = {
|
|
||||||
handler = {},
|
|
||||||
frequency = water_frequent_frequency,
|
|
||||||
on_stop = "drowning_gasp",
|
|
||||||
--on_start = "Splash",
|
|
||||||
{name="scuba1bubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1calm", length=10}, --not sure why but sometimes I get errors when setting gain=water_frequent_volume here.
|
|
||||||
{name="scuba1calm2", length=8.5, gain=water_frequent_volume},
|
|
||||||
{name="scuba1interestingbubbles", length=11, gain=water_frequent_volume},
|
|
||||||
{name="scuba1tubulentbubbles", length=10.5, gain=water_frequent_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local water_surface = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
on_stop = "Splash",
|
|
||||||
on_start = "Splash",
|
|
||||||
{name="lake_waves_2_calm", length=9.5},
|
|
||||||
{name="lake_waves_2_variety", length=13.1}
|
|
||||||
}
|
|
||||||
local splashing_water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="Splash", length=1.22, gain=1}
|
|
||||||
}
|
|
||||||
|
|
||||||
local flowing_water = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=14, gain=.4}
|
|
||||||
}
|
|
||||||
local flowing_water2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="small_waterfall", length=11, gain=.3}
|
|
||||||
}
|
|
||||||
|
|
||||||
local lava = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=20}
|
|
||||||
}
|
|
||||||
local lava2 = {
|
|
||||||
handler = {},
|
|
||||||
frequency = 1000,
|
|
||||||
{name="earth01a", length=15}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
local play_music = minetest.setting_getbool("music") or false
|
|
||||||
local music = {
|
|
||||||
handler = {},
|
|
||||||
frequency = music_frequency,
|
|
||||||
{name="mtest", length=4*60+33, gain=music_volume},
|
|
||||||
{name="echos", length=2*60+26, gain=music_volume},
|
|
||||||
{name="FoamOfTheSea", length=1*60+50, gain=music_volume},
|
|
||||||
{name="eastern_feeling", length=3*60+51, gain=music_volume},
|
|
||||||
{name="Mass_Effect_Uncharted_Worlds", length=2*60+29, gain=music_volume},
|
|
||||||
{name="dark_ambiance", length=44, gain=music_volume}
|
|
||||||
}
|
|
||||||
|
|
||||||
local is_daytime = function()
|
|
||||||
return (minetest.env:get_timeofday() > 0.2 and minetest.env:get_timeofday() < 0.8)
|
|
||||||
end
|
|
||||||
|
|
||||||
local nodes_in_range = function(pos, search_distance, node_name)
|
|
||||||
minp = {x=pos.x-search_distance,y=pos.y-search_distance, z=pos.z-search_distance}
|
|
||||||
maxp = {x=pos.x+search_distance,y=pos.y+search_distance, z=pos.z+search_distance}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
--minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
return #nodes
|
|
||||||
end
|
|
||||||
|
|
||||||
local nodes_in_coords = function(minp, maxp, node_name)
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
--minetest.chat_send_all("Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
return #nodes
|
|
||||||
end
|
|
||||||
|
|
||||||
local atleast_nodes_in_grid = function(pos, search_distance, height, node_name, threshold)
|
|
||||||
-- counter = counter +1
|
|
||||||
-- minetest.chat_send_all("counter: (" .. counter .. ")")
|
|
||||||
minp = {x=pos.x-search_distance,y=height, z=pos.z+20}
|
|
||||||
maxp = {x=pos.x+search_distance,y=height, z=pos.z+20}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("z+Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
if #nodes >= threshold then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
totalnodes = #nodes
|
|
||||||
minp = {x=pos.x-search_distance,y=height, z=pos.z-20}
|
|
||||||
maxp = {x=pos.x+search_distance,y=height, z=pos.z-20}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("z-Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
if #nodes >= threshold then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
totalnodes = totalnodes + #nodes
|
|
||||||
maxp = {x=pos.x+20,y=height, z=pos.z+search_distance}
|
|
||||||
minp = {x=pos.x+20,y=height, z=pos.z-search_distance}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
if #nodes >= threshold then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
totalnodes = totalnodes + #nodes
|
|
||||||
maxp = {x=pos.x-20,y=height, z=pos.z+search_distance}
|
|
||||||
minp = {x=pos.x-20,y=height, z=pos.z-search_distance}
|
|
||||||
nodes = minetest.env:find_nodes_in_area(minp, maxp, node_name)
|
|
||||||
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
|
|
||||||
if #nodes >= threshold then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
totalnodes = totalnodes + #nodes
|
|
||||||
-- minetest.chat_send_all("Found total(" .. totalnodes .. ")")
|
|
||||||
if totalnodes >= threshold*2 then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
return false
|
|
||||||
end
|
|
||||||
|
|
||||||
local get_immediate_nodes = function(pos)
|
|
||||||
pos.y = pos.y-1
|
|
||||||
node_under_feet = minetest.env:get_node(pos).name
|
|
||||||
pos.y = pos.y-3
|
|
||||||
node_3_under_feet = minetest.env:get_node(pos).name
|
|
||||||
pos.y = pos.y+3
|
|
||||||
pos.y = pos.y+2.2
|
|
||||||
node_at_upper_body = minetest.env:get_node(pos).name
|
|
||||||
pos.y = pos.y-1.19
|
|
||||||
node_at_lower_body = minetest.env:get_node(pos).name
|
|
||||||
pos.y = pos.y+0.99 --1.6
|
|
||||||
--minetest.chat_send_all("node_under_feet(" .. nodename .. ")")
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
local get_ambience = function(player)
|
|
||||||
local player_is_climbing = false
|
|
||||||
local player_is_descending = false
|
|
||||||
local player_is_moving_horiz = false
|
|
||||||
local standing_in_water = false
|
|
||||||
local pos = player:getpos()
|
|
||||||
get_immediate_nodes(pos)
|
|
||||||
|
|
||||||
if last_x_pos ~=pos.x or last_z_pos ~=pos.z then
|
|
||||||
player_is_moving_horiz = true
|
|
||||||
end
|
|
||||||
if pos.y > last_y_pos+.5 then
|
|
||||||
player_is_climbing = true
|
|
||||||
end
|
|
||||||
if pos.y < last_y_pos-.5 then
|
|
||||||
player_is_descending = true
|
|
||||||
end
|
|
||||||
|
|
||||||
last_x_pos =pos.x
|
|
||||||
last_z_pos =pos.z
|
|
||||||
last_y_pos =pos.y
|
|
||||||
|
|
||||||
if string.find(node_at_upper_body, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {water=water, water_frequent=water_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {water=water, water_frequent=water_frequent}
|
|
||||||
end
|
|
||||||
elseif node_at_upper_body == "air" then
|
|
||||||
if string.find(node_at_lower_body, "default:water") then
|
|
||||||
--minetest.chat_send_all("bottom counted as water")
|
|
||||||
--we found air at upperbody, and water at lower body. Now there are 4 possibilities:
|
|
||||||
--Key: under feet, moving or not
|
|
||||||
--swimming w, m swimming
|
|
||||||
--walking in water nw, m splashing
|
|
||||||
--treading water w, nm sloshing
|
|
||||||
--standing in water nw, nm beach trumps, then sloshing
|
|
||||||
if player_is_moving_horiz then
|
|
||||||
if string.find(node_under_feet, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {swimming_frequent=swimming_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {swimming_frequent}
|
|
||||||
end
|
|
||||||
else --didn't find water under feet: walking in water
|
|
||||||
if music then
|
|
||||||
return {splashing_water=splashing_water, music=music}
|
|
||||||
else
|
|
||||||
return {splashing_water}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
else--player is not moving
|
|
||||||
if string.find(node_under_feet, "default:water") then
|
|
||||||
if music then
|
|
||||||
return {water_surface=water_surface, music=music}
|
|
||||||
else
|
|
||||||
return {water_surface}
|
|
||||||
end
|
|
||||||
else --didn't find water under feet
|
|
||||||
standing_in_water = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if player_is_moving_horiz then
|
|
||||||
minetest.chat_send_all("playermoving")
|
|
||||||
end
|
|
||||||
if player_is_climbing then
|
|
||||||
minetest.chat_send_all("player Climbing")
|
|
||||||
end
|
|
||||||
minetest.chat_send_all("nub:" ..node_at_upper_body)
|
|
||||||
minetest.chat_send_all("nlb:" ..node_at_lower_body)
|
|
||||||
minetest.chat_send_all("nuf:" ..node_under_feet)
|
|
||||||
minetest.chat_send_all("n3uf:" ..node_3_under_feet)
|
|
||||||
|
|
||||||
local air_or_ignore = {air=true,ignore=true}
|
|
||||||
--minetest.chat_send_all(air_or_ignore[node_under_feet])
|
|
||||||
if (player_is_moving_horiz or player_is_climbing) and air_or_ignore[node_at_upper_body] and air_or_ignore[node_at_lower_body]
|
|
||||||
and air_or_ignore[node_under_feet] and air_or_ignore[node_3_under_feet] and not player_is_descending then
|
|
||||||
minetest.chat_send_all("flying!!!!")
|
|
||||||
if music then
|
|
||||||
return {flying=flying, music=music}
|
|
||||||
else
|
|
||||||
return {flying}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
minetest.chat_send_all("not flying!!!!")
|
|
||||||
|
|
||||||
if nodes_in_range(pos, 7, "default:lava_flowing")>5 or nodes_in_range(pos, 7, "default:lava_source")>5 then
|
|
||||||
if music then
|
|
||||||
return {lava=lava, lava2=lava2, music=music}
|
|
||||||
else
|
|
||||||
return {lava=lava}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if nodes_in_range(pos, 6, "default:water_flowing")>45 then
|
|
||||||
if music then
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2, music=music}
|
|
||||||
else
|
|
||||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
--if we are near sea level and there is lots of water around the area
|
|
||||||
if pos.y < 7 and pos.y >0 and atleast_nodes_in_grid(pos, 60, 1, "default:water_source", 51 ) then
|
|
||||||
if music then
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {beach=beach, beach_frequent=beach_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if standing_in_water then
|
|
||||||
if music then
|
|
||||||
return {water_surface=water_surface, music=music}
|
|
||||||
else
|
|
||||||
return {water_surface}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
desert_in_range = (nodes_in_range(pos, 6, "default:desert_sand")+nodes_in_range(pos, 6, "default:desert_stone"))
|
|
||||||
--minetest.chat_send_all("desertcount: " .. desert_in_range .. ",".. pos.y )
|
|
||||||
if desert_in_range >250 then
|
|
||||||
if music then
|
|
||||||
return {desert=desert, desert_frequent=desert_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {desert=desert, desert_frequent=desert_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
pos.y = pos.y-2
|
|
||||||
nodename = minetest.env:get_node(pos).name
|
|
||||||
-- minetest.chat_send_all("Found " .. nodename .. pos.y )
|
|
||||||
|
|
||||||
|
|
||||||
if player:getpos().y < 0 then
|
|
||||||
if music then
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {cave=cave, cave_frequent=cave_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if is_daytime() then
|
|
||||||
if music then
|
|
||||||
return {day=day, day_frequent=day_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {day=day, day_frequent=day_frequent}
|
|
||||||
end
|
|
||||||
else
|
|
||||||
if music then
|
|
||||||
return {night=night, night_frequent=night_frequent, music=music}
|
|
||||||
else
|
|
||||||
return {night=night, night_frequent=night_frequent}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- start playing the sound, set the handler and delete the handler after sound is played
|
|
||||||
local play_sound = function(player, list, number)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if list.handler[player_name] == nil then
|
|
||||||
local gain = 1.0
|
|
||||||
if list[number].gain ~= nil then
|
|
||||||
gain = list[number].gain
|
|
||||||
end
|
|
||||||
local handler = minetest.sound_play(list[number].name, {to_player=player_name, gain=gain})
|
|
||||||
if handler ~= nil then
|
|
||||||
list.handler[player_name] = handler
|
|
||||||
minetest.after(list[number].length, function(args)
|
|
||||||
local list = args[1]
|
|
||||||
local player_name = args[2]
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end, {list, player_name})
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- stops all sounds that are not in still_playing
|
|
||||||
local stop_sound = function(still_playing, player)
|
|
||||||
local player_name = player:get_player_name()
|
|
||||||
if still_playing.cave == nil then
|
|
||||||
local list = cave
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.cave_frequent == nil then
|
|
||||||
local list = cave_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.swimming_frequent == nil then
|
|
||||||
local list = swimming_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.beach == nil then
|
|
||||||
local list = beach
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.beach_frequent == nil then
|
|
||||||
local list = beach_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.desert == nil then
|
|
||||||
local list = desert
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.desert_frequent == nil then
|
|
||||||
local list = desert_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.night == nil then
|
|
||||||
local list = night
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.night_frequent == nil then
|
|
||||||
local list = night_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day == nil then
|
|
||||||
local list = day
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.day_frequent == nil then
|
|
||||||
local list = day_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.music == nil then
|
|
||||||
local list = music
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water == nil then
|
|
||||||
local list = flowing_water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flowing_water2 == nil then
|
|
||||||
local list = flowing_water2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava == nil then
|
|
||||||
local list = lava
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.lava2 == nil then
|
|
||||||
local list = lava2
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water == nil then
|
|
||||||
local list = water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water_surface == nil then
|
|
||||||
local list = water_surface
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
played_on_start = false
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.water_frequent == nil then
|
|
||||||
local list = water_frequent
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
-- minetest.chat_send_all("list.on_stop " .. list.on_stop )
|
|
||||||
played_on_start = false
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.flying == nil then
|
|
||||||
--minetest.chat_send_all("begin stop flying " )
|
|
||||||
local list = flying
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
-- minetest.chat_send_all("handler flying " )
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
-- minetest.chat_send_all("onstop flying" )
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
played_on_start = false
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if still_playing.splashing_water == nil then
|
|
||||||
local list = splashing_water
|
|
||||||
if list.handler[player_name] ~= nil then
|
|
||||||
if list.on_stop ~= nil then
|
|
||||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.sound_stop(list.handler[player_name])
|
|
||||||
list.handler[player_name] = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
local timer = 0
|
|
||||||
minetest.register_globalstep(function(dtime)
|
|
||||||
timer = timer+dtime
|
|
||||||
if timer < 1 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
timer = 0
|
|
||||||
|
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
|
||||||
local ambiences = get_ambience(player)
|
|
||||||
stop_sound(ambiences, player)
|
|
||||||
for _,ambience in pairs(ambiences) do
|
|
||||||
if math.random(1, 1000) <= ambience.frequency then
|
|
||||||
if(played_on_start) then
|
|
||||||
-- minetest.chat_send_all("playedOnStart " )
|
|
||||||
else
|
|
||||||
-- minetest.chat_send_all("FALSEplayedOnStart " )
|
|
||||||
end
|
|
||||||
if ambience.on_start ~= nil and played_on_start == false then
|
|
||||||
played_on_start = true
|
|
||||||
minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
|
|
||||||
end
|
|
||||||
minetest.chat_send_all("ambience: " ..ambience )
|
|
||||||
-- if ambience.on_start ~= nil and played_on_start_flying == false then
|
|
||||||
-- played_on_start_flying = true
|
|
||||||
-- minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
|
|
||||||
-- end
|
|
||||||
play_sound(player, ambience, math.random(1, #ambience))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
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.
@ -1,115 +0,0 @@
|
|||||||
--------------Music Lic:
|
|
||||||
Amethystium:
|
|
||||||
--Avalon
|
|
||||||
--Ethereal
|
|
||||||
--Faraway
|
|
||||||
--Strangely Beautiful
|
|
||||||
Used with kind permission from <20>ystein Ramfjord / AM.mu Records
|
|
||||||
|
|
||||||
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:
|
|
||||||
--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: Attr-Noncommercial 3.0 | Recorded by Mike Koenig , http://soundbible.com/1939-Bats-In-Cave.html
|
|
||||||
|
|
||||||
--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/
|
|
||||||
|
|
||||||
--Underwater Pool - Attribution 3.0 | Recorded by Mike Koenig, http://soundbible.com/1660-Underwater-Pool.html
|
|
||||||
|
|
||||||
--dolphin_screaming - Creative Commons 0 License, felix.blume, http://www.freesound.org/people/felix.blume/sounds/161691/
|
|
||||||
|
|
||||||
--dolphins - Attribution Noncommercial License, acclivity, http://www.freesound.org/people/acclivity/sounds/13691/
|
|
||||||
|
|
||||||
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/
|
|
||||||
|
|
||||||
--water_swimming_splashing*, Attribution Noncommercial License, Robinhood76, http://www.freesound.org/people/Robinhood76/sounds/79657/
|
|
||||||
|
|
||||||
--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 Noncommercial 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/
|
|
||||||
|
|
||||||
----------------Not used yet:
|
|
||||||
desert:
|
|
||||||
Desert Simple.wav, Creative Commons 0 License, Proxima4, http://www.freesound.org/people/Proxima4/sounds/104320/
|
|
||||||
|
|
||||||
313hummer (Jordan Craige)
|
|
||||||
--echos http://soundcloud.com/jordan-craige/echos-1
|
|
||||||
Creative Commons Attribution license (reuse allowed) Attribution 3.0 Unported (CC BY 3.0)
|
|
||||||
Not Used:--FoamOfTheSea http://soundcloud.com/jordan-craige/foam-of-the-sea
|
|
||||||
|
|
||||||
xi-intersection:
|
|
||||||
http://soundcloud.com/xi-intersection/mass-effect-uncharted-worlds Creative Commons License
|
|
||||||
--not used:
|
|
||||||
http://soundcloud.com/xi-intersection/donkey-kong-country-2-flight
|
|
||||||
http://soundcloud.com/kogyo/kogyo-skalar-m1
|
|
||||||
|
|
||||||
lava:
|
|
||||||
http://www.freesound.org/people/Halion/sounds/17785/ (almost as good cc) (combine with rocks falling?)
|
|
||||||
http://www.freesound.org/people/pushtobreak/sounds/17823/ (attrib non cc really good)
|
|
||||||
http://www.freesound.org/people/klankbeeld/sounds/123970/ (horror rhythm)
|
|
||||||
Rockfall in mine.wav http://www.freesound.org/people/Benboncan/sounds/60085/
|
|
||||||
|
|
||||||
|
|
||||||
http://www.freesound.org/people/snotch/sounds/96175/ (mud volcano)
|
|
||||||
|
|
||||||
--natural night sounds in Boquete.wav, Attribution License, laurent, http://www.freesound.org/people/laurent/sounds/15851/
|
|
||||||
http://www.freesound.org/people/Dynamicell/sounds/17553/
|
|
||||||
http://www.freesound.org/people/juskiddink/sounds/78955/ aspen tree in wind
|
|
||||||
http://www.freesound.org/people/Benboncan/sounds/69761/ wind in hedge birds animals
|
|
||||||
|
|
||||||
|
|
||||||
ButterflyTea:
|
|
||||||
Creative Commons : Attribution-Noncommercial-Share Alike 3.0
|
|
||||||
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/904016/in-search-of-the-soul
|
|
||||||
|
|
||||||
zero-project
|
|
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.
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.
@ -1,11 +0,0 @@
|
|||||||
To Do:
|
|
||||||
|
|
||||||
-add random_volume parameter to night normal, day normal, & cave normal sounds to create feeling of distance.
|
|
||||||
|
|
||||||
m-get constant birds more quiet during the day
|
|
||||||
m-bats seem way too frequent now?
|
|
||||||
m-when playing multiplayer seems to increase frequency of music & normal sounds to the point where they are obnoxious
|
|
||||||
m-which songs should go with which environments? Dark songs in caves or night, light sounds during day.
|
|
||||||
m-may be drowning out some of the normal sound effects like walking on stone.
|
|
||||||
l-what about other weird bubble
|
|
||||||
l-put in wind/ wind in trees during day and night
|
|
@ -15,7 +15,8 @@ minetest.register_craftitem(":bushes:youngtree", {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
abstract_bushes.grow_youngtree_node2(pointed_thing.under, 4)
|
-- abstract_bushes.grow_youngtree_node2(pointed_thing.under, 4)
|
||||||
|
abstract_bushes.grow_youngtree2(pointed_thing.under)
|
||||||
stack:set_count(stack:get_count() - 1)
|
stack:set_count(stack:get_count() - 1)
|
||||||
return stack
|
return stack
|
||||||
end,
|
end,
|
||||||
|
@ -20,7 +20,7 @@ minetest.register_on_leaveplayer(function(player)
|
|||||||
minetest.sound_play("player_leave", {gain = 1})
|
minetest.sound_play("player_leave", {gain = 1})
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if minetest.setting_getbool("log_mods") then
|
if minetest.settings:get_bool("log_mods") then
|
||||||
-- Highlight the default mod in the mod loading logs:
|
-- Highlight the default mod in the mod loading logs:
|
||||||
minetest.log("action", "Carbone: * [default] loaded.")
|
minetest.log("action", "Carbone: * [default] loaded.")
|
||||||
end
|
end
|
||||||
|
@ -1 +0,0 @@
|
|||||||
interact
|
|
@ -8,11 +8,11 @@ local IRC = [[
|
|||||||
2) Il ne sera tolere aucune forme de violation des lois en vigueur dans les pays de residence des participants, ainsi que ceux des hebergeurs des serveurs.
|
2) Il ne sera tolere aucune forme de violation des lois en vigueur dans les pays de residence des participants, ainsi que ceux des hebergeurs des serveurs.
|
||||||
3) Il ne sera tolere aucune sorte d'insulte, de provocation gratuite, d'incitation a la haine, au meurtre, au suicide, ou toute autre forme d'atteinte au respect mutuel des utilisateurs de l'IRC.
|
3) Il ne sera tolere aucune sorte d'insulte, de provocation gratuite, d'incitation a la haine, au meurtre, au suicide, ou toute autre forme d'atteinte au respect mutuel des utilisateurs de l'IRC.
|
||||||
4) Il ne sera tolere aucune forme de flood ainsi que de spam. Rappelez-vous qu'il est preferable d'utiliser un site de televersion de texte (aussi nomme "pastebin"), tel que "pastebin.ubuntu.com" a chaque fois que vous desirez transmettre du code ou un long texte.
|
4) Il ne sera tolere aucune forme de flood ainsi que de spam. Rappelez-vous qu'il est preferable d'utiliser un site de televersion de texte (aussi nomme "pastebin"), tel que "pastebin.ubuntu.com" a chaque fois que vous desirez transmettre du code ou un long texte.
|
||||||
Le flood est l'action de saturer le chat de messages repetitifs, inutiles, y compris les join/part, grossiers, sans aucun rapport avec la conversation et au detriment des participants
|
Le flood est l'action de saturer le chat de messages repetitifs, inutiles, y compris les join/part, grossiers, sans aucun rapport avec la conversation et au detriment des participants.
|
||||||
Le spam est l'action de faire de la publicite pour quelque chose que ce soit sans l'accord d'un ayant droit ou d'un operateur de canal.
|
Le spam est l'action de faire de la publicite pour quelque chose que ce soit sans l'accord d'un ayant droit ou d'un operateur de canal.
|
||||||
5) Il ne sera tolere aucun pseudonyme a caractere sexuel, haineux, contenant des termes ou propos indesirables sur le salon.
|
5) Il ne sera tolere aucun pseudonyme a caractere sexuel, haineux, contenant des termes ou propos indesirables sur le salon.
|
||||||
6) Il ne sera tolere aucune forme d'harcelement moral ou a caractere sexuel, y compris par messages prives.
|
6) Il ne sera tolere aucune forme d'harcelement moral ou a caractere sexuel, y compris par messages prives.
|
||||||
7) Il ne sera tolere aucun type de discrimination contre quelque participant que ce soit, ni aucune forme d'insulte envers les operateurs, semi-operateurs et administrateurs d'InchraNet.
|
7) Il ne sera tolere aucun type de discrimination contre quelque participant que ce soit, ni aucune forme d'insulte envers les operateurs, semi-operateurs et administrateurs de Sys4Node.
|
||||||
|
|
||||||
Voici les sanctions prevues pour les infractions aux regles ci-dessus.
|
Voici les sanctions prevues pour les infractions aux regles ci-dessus.
|
||||||
|
|
||||||
@ -33,8 +33,8 @@ Voici les sanctions prevues pour les infractions aux regles ci-dessus.
|
|||||||
|
|
||||||
- Infraction niveau OBSIDIAN :
|
- Infraction niveau OBSIDIAN :
|
||||||
- Recidive d'infraction niveau mese : Kick + Ban 1 mois + devoice 2 semaines
|
- Recidive d'infraction niveau mese : Kick + Ban 1 mois + devoice 2 semaines
|
||||||
- Violation des lois en vigueur : Kick + Ban definitif + Gline si accord des IrcOP d'InchraNet
|
- Violation des lois en vigueur : Kick + Ban definitif + Gline si accord des IrcOP de Sys4Node
|
||||||
- Violation des regles d'InchraNet : Kick + Ban definitif + Gline ou sanction defnie par l'equipe d'InchraNet
|
- Violation des regles de Sys4Node : Kick + Ban definitif + Gline ou sanction defnie par l'equipe de Sys4Node
|
||||||
|
|
||||||
|
|
||||||
Autres regles de bienseances :
|
Autres regles de bienseances :
|
||||||
|
4
misc/mod.conf
Normal file
4
misc/mod.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name = misc
|
||||||
|
title = NALC misc
|
||||||
|
description = Add various things from MFF
|
||||||
|
depends = interact, bushes
|
@ -1,3 +0,0 @@
|
|||||||
nalc_lib
|
|
||||||
nalc_technic
|
|
||||||
awards
|
|
@ -13,6 +13,8 @@
|
|||||||
*award_gold_master (Gold Master - dig 1000 default:stone_with_gold)--> 1 Super Quarry
|
*award_gold_master (Gold Master - dig 1000 default:stone_with_gold)--> 1 Super Quarry
|
||||||
]]--
|
]]--
|
||||||
|
|
||||||
|
local S = minetest.get_translator("nalc_awards")
|
||||||
|
|
||||||
if minetest.get_modpath("awards") then
|
if minetest.get_modpath("awards") then
|
||||||
|
|
||||||
-- Check if a player object is valid for awards.
|
-- Check if a player object is valid for awards.
|
||||||
@ -22,20 +24,20 @@ if minetest.get_modpath("awards") then
|
|||||||
|
|
||||||
-- Redéfinition de la description d'awards existant
|
-- Redéfinition de la description d'awards existant
|
||||||
local award = awards.registered_awards["award_mine3"]
|
local award = awards.registered_awards["award_mine3"]
|
||||||
award.description = award.description.." (Unlock the craft of 1 Quarry)"
|
award.description = award.description.. S(" (Unlock the craft of 1 Quarry)")
|
||||||
|
|
||||||
award = awards.registered_awards["award_mine4"]
|
award = awards.registered_awards["award_mine4"]
|
||||||
award.description = award.description.." (Unlock the craft of 1 Super Quarry)"
|
award.description = award.description.. S(" (Unlock the craft of 1 Super Quarry)")
|
||||||
|
|
||||||
award = awards.registered_awards["award_youre_a_copper"]
|
award = awards.registered_awards["award_youre_a_copper"]
|
||||||
award.description = award.description.." (Unlock the craft of 1 Super Quarry)"
|
award.description = award.description.. S(" (Unlock the craft of 1 Super Quarry)")
|
||||||
|
|
||||||
-- Définitions de nouveaux awards --
|
-- Définitions de nouveaux awards --
|
||||||
-- Iron Lady
|
-- Iron Lady
|
||||||
awards.register_award(
|
awards.register_award(
|
||||||
"award_iron_miner", {
|
"award_iron_miner", {
|
||||||
title = "The Iron Lady",
|
title = S("The Iron Lady"),
|
||||||
description = "Dig 100 iron ores. (Unlock the craft of 2 Quarry)",
|
description = S("Dig 100 iron ores. (Unlock the craft of 2 Quarry)"),
|
||||||
icon = "default_iron_lump.png^awards_level1.png",
|
icon = "default_iron_lump.png^awards_level1.png",
|
||||||
background = "awards_bg_mining.png",
|
background = "awards_bg_mining.png",
|
||||||
difficulty = 0.03,
|
difficulty = 0.03,
|
||||||
@ -49,8 +51,8 @@ if minetest.get_modpath("awards") then
|
|||||||
-- Iron Man
|
-- Iron Man
|
||||||
awards.register_award(
|
awards.register_award(
|
||||||
"award_iron_master", {
|
"award_iron_master", {
|
||||||
title = "The Iron Man",
|
title = S("The Iron Man"),
|
||||||
description = "Dig 1,000 iron ores. (Unlock the craft of 1 Super Quarry)",
|
description = S("Dig 1,000 iron ores. (Unlock the craft of 1 Super Quarry)"),
|
||||||
icon = "default_iron_lump.png^awards_level2.png",
|
icon = "default_iron_lump.png^awards_level2.png",
|
||||||
background = "awards_bg_mining.png",
|
background = "awards_bg_mining.png",
|
||||||
difficulty = 0.04,
|
difficulty = 0.04,
|
||||||
@ -64,8 +66,8 @@ if minetest.get_modpath("awards") then
|
|||||||
-- Copper Trooper
|
-- Copper Trooper
|
||||||
awards.register_award(
|
awards.register_award(
|
||||||
"award_copper_miner", {
|
"award_copper_miner", {
|
||||||
title = "Copper Trooper",
|
title = S("Copper Trooper"),
|
||||||
description = "Dig 100 copper ores. (Unlock the craft of 4 Quarry)",
|
description = S("Dig 100 copper ores. (Unlock the craft of 4 Quarry)"),
|
||||||
icon = "default_copper_lump.png^awards_level1.png",
|
icon = "default_copper_lump.png^awards_level1.png",
|
||||||
background = "awards_bg_mining.png",
|
background = "awards_bg_mining.png",
|
||||||
difficulty = 0.19,
|
difficulty = 0.19,
|
||||||
@ -79,8 +81,8 @@ if minetest.get_modpath("awards") then
|
|||||||
-- Gold Digger
|
-- Gold Digger
|
||||||
awards.register_award(
|
awards.register_award(
|
||||||
"award_gold_miner", {
|
"award_gold_miner", {
|
||||||
title = "Gold Digger",
|
title = S("Gold Digger"),
|
||||||
description = "Dig 100 gold ores. (Unlock the craft of 5 Quarry)",
|
description = S("Dig 100 gold ores. (Unlock the craft of 5 Quarry)"),
|
||||||
icon = "default_gold_lump.png^awards_level3.png",
|
icon = "default_gold_lump.png^awards_level3.png",
|
||||||
background = "awards_bg_mining.png",
|
background = "awards_bg_mining.png",
|
||||||
difficulty = 0.91,
|
difficulty = 0.91,
|
||||||
@ -94,8 +96,8 @@ if minetest.get_modpath("awards") then
|
|||||||
-- The Golden Age
|
-- The Golden Age
|
||||||
awards.register_award(
|
awards.register_award(
|
||||||
"award_gold_master", {
|
"award_gold_master", {
|
||||||
title = "The Golden Age",
|
title = S("The Golden Age"),
|
||||||
description = "Dig 1,000 gold ores. (Unlock the craft of 1 Super Quarry)",
|
description = S("Dig 1,000 gold ores. (Unlock the craft of 1 Super Quarry)"),
|
||||||
icon = "default_gold_lump.png^awards_level4.png",
|
icon = "default_gold_lump.png^awards_level4.png",
|
||||||
background = "awards_bg_mining.png",
|
background = "awards_bg_mining.png",
|
||||||
difficulty = 0.92,
|
difficulty = 0.92,
|
||||||
@ -110,7 +112,7 @@ if minetest.get_modpath("awards") then
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:waste",
|
":nalc:waste",
|
||||||
{
|
{
|
||||||
description = "Waste",
|
description = S("Waste"),
|
||||||
tiles = {"waste.png"},
|
tiles = {"waste.png"},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
groups = {crumbly=2, flammable=2},
|
groups = {crumbly=2, flammable=2},
|
||||||
@ -165,7 +167,7 @@ if minetest.get_modpath("awards") then
|
|||||||
if levels then
|
if levels then
|
||||||
local items_crafted = data.craft[itemname] or 0
|
local items_crafted = data.craft[itemname] or 0
|
||||||
if not authorized_craft(items_crafted, levels, data.unlocked) then
|
if not authorized_craft(items_crafted, levels, data.unlocked) then
|
||||||
minetest.chat_send_player(playern, "Vous n'avez pas assez d'expérience pour fabriquer cet article ! À la place, vous obtenez un bloc de déchets. / You don't have enough experience to make this item! Instead, you get a block of waste.")
|
minetest.chat_send_player(playern, S("You don't have enough experience to make this item! Instead, you get a block of waste."))
|
||||||
return ItemStack("nalc:waste")
|
return ItemStack("nalc:waste")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
16
nalc_awards/locale/nalc_awards.fr.tr
Normal file
16
nalc_awards/locale/nalc_awards.fr.tr
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# textdomain: nalc_awards
|
||||||
|
|
||||||
|
(Unlock the craft of 1 Quarry)= (Débloque la fabrication de 1 Quarry)
|
||||||
|
(Unlock the craft of 1 Super Quarry)= (Débloque la fabrication de 1 Super Quarry)
|
||||||
|
The Iron Lady=La Dame de Fer
|
||||||
|
Dig 100 iron ores. (Unlock the craft of 2 Quarry)=Creusez 100 minerais de fer. (Débloque la fabrication de 2 Quarry)
|
||||||
|
The Iron Man=L'Homme de Fer
|
||||||
|
Dig 1,000 iron ores. (Unlock the craft of 1 Super Quarry)=Creusez 1 000 minerais de fer. (Débloque la fabrication de 1 Super Quarry)
|
||||||
|
Copper Trooper=Soldat de cuivre
|
||||||
|
Dig 100 copper ores. (Unlock the craft of 4 Quarry)=Creusez 100 minerais de cuivre. (Débloque la fabrication de 4 Quarry)
|
||||||
|
Gold Digger=Chercheur d'or
|
||||||
|
Dig 100 gold ores. (Unlock the craft of 5 Quarry)=Creusez 100 minerais d'or. (Débloque la fabrication de 5 Quarry)
|
||||||
|
The Golden Age=L'âge d'or
|
||||||
|
Dig 1,000 gold ores. (Unlock the craft of 1 Super Quarry)=Creusez 1 000 minerais d'or. (Débloque la fabrication de 1 Super Quarry)
|
||||||
|
Waste=Déchets
|
||||||
|
You don't have enough experience to make this item! Instead, you get a block of waste.=Vous n'avez pas assez d'expérience pour fabriquer cet article ! À la place, vous obtenez un bloc de déchets.
|
18
nalc_awards/locale/template.txt
Normal file
18
nalc_awards/locale/template.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# textdomain: awards
|
||||||
|
|
||||||
|
(Unlock the craft of 1 Quarry)=
|
||||||
|
(Unlock the craft of 1 Super Quarry)=
|
||||||
|
The Iron Lady=
|
||||||
|
Dig 100 iron ores. (Unlock the craft of 2 Quarry)=
|
||||||
|
The Iron Man=
|
||||||
|
Dig 1,000 iron ores. (Unlock the craft of 1 Super Quarry)=
|
||||||
|
Copper Trooper=
|
||||||
|
Dig 100 copper ores. (Unlock the craft of 4 Quarry)=
|
||||||
|
Gold Digger=
|
||||||
|
Dig 100 gold ores. (Unlock the craft of 5 Quarry)=
|
||||||
|
The Golden Age=
|
||||||
|
Dig 1,000 gold ores. (Unlock the craft of 1 Super Quarry)=
|
||||||
|
Waste=
|
||||||
|
You don't have enough experience to make this item! Instead, you get a block of waste.=
|
||||||
|
|
||||||
|
|
4
nalc_awards/mod.conf
Normal file
4
nalc_awards/mod.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name = nalc_awards
|
||||||
|
title = NALC Awards
|
||||||
|
description = Add NALC awards
|
||||||
|
depends = nalc_lib,nalc_technic,awards
|
@ -1 +0,0 @@
|
|||||||
beds
|
|
@ -1,9 +1,31 @@
|
|||||||
|
|
||||||
|
local S = minetest.get_translator("nalc_beds")
|
||||||
|
--overidde craft recipe of the default beds
|
||||||
|
minetest.clear_craft({ output = "beds:bed_bottom" })
|
||||||
|
minetest.clear_craft({ output = "beds:fancy_bed_bottom" })
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "beds:fancy_bed",
|
||||||
|
recipe = {
|
||||||
|
{"", "", "group:stick"},
|
||||||
|
{"wool:red", "wool:red", "wool:white"},
|
||||||
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "beds:bed",
|
||||||
|
recipe = {
|
||||||
|
{"wool:red", "wool:red", "wool:white"},
|
||||||
|
{"group:wood", "group:wood", "group:wood"},
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
for _, colour in pairs({"white", "black", "blue", "green"}) do
|
for _, colour in pairs({"white", "black", "blue", "green"}) do
|
||||||
-- fancy shaped bed
|
-- fancy shaped bed
|
||||||
beds.register_bed(
|
beds.register_bed(
|
||||||
"nalc_beds:fancy_bed_" .. colour,
|
"nalc_beds:fancy_bed_" .. colour,
|
||||||
{
|
{
|
||||||
description = "Fancy Bed (" .. colour .. ")",
|
description = S("Fancy Bed (@1)", S(colour)),
|
||||||
inventory_image = "beds_bed_fancy_" .. colour .. ".png",
|
inventory_image = "beds_bed_fancy_" .. colour .. ".png",
|
||||||
wield_image = "beds_bed_fancy_" .. colour .. ".png",
|
wield_image = "beds_bed_fancy_" .. colour .. ".png",
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -60,7 +82,7 @@ for _, colour in pairs({"white", "black", "blue", "green"}) do
|
|||||||
beds.register_bed(
|
beds.register_bed(
|
||||||
"nalc_beds:bed_" .. colour,
|
"nalc_beds:bed_" .. colour,
|
||||||
{
|
{
|
||||||
description = "Simple Bed (" .. colour .. ")",
|
description = S("Simple Bed (@1)", S(colour)),
|
||||||
inventory_image = "beds_bed_" .. colour .. ".png",
|
inventory_image = "beds_bed_" .. colour .. ".png",
|
||||||
wield_image = "beds_bed_" .. colour .. ".png",
|
wield_image = "beds_bed_" .. colour .. ".png",
|
||||||
tiles = {
|
tiles = {
|
||||||
|
8
nalc_beds/locale/nalc_beds.fr.tr
Normal file
8
nalc_beds/locale/nalc_beds.fr.tr
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# textdomain: nalc_beds
|
||||||
|
|
||||||
|
Fancy Bed (@1)=Lit chic (@1)
|
||||||
|
Simple Bed (@1)=Lit simple (@1)
|
||||||
|
white=blanc
|
||||||
|
black=noir
|
||||||
|
blue=bleu
|
||||||
|
green=vert
|
10
nalc_beds/locale/template.txt
Normal file
10
nalc_beds/locale/template.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# textdomain: nalc_beds
|
||||||
|
|
||||||
|
Fancy Bed (@1)=
|
||||||
|
Simple Bed (@1)=
|
||||||
|
white=
|
||||||
|
black=
|
||||||
|
blue=
|
||||||
|
green=
|
||||||
|
|
||||||
|
|
4
nalc_beds/mod.conf
Normal file
4
nalc_beds/mod.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name = nalc_beds
|
||||||
|
title = NALC Beds
|
||||||
|
description = Add new colored beds
|
||||||
|
depends = beds
|
@ -1 +0,0 @@
|
|||||||
boats
|
|
@ -1,3 +1,4 @@
|
|||||||
|
local S = minetest.get_translator("nalc_boats")
|
||||||
--
|
--
|
||||||
-- Helper functions
|
-- Helper functions
|
||||||
--
|
--
|
||||||
@ -232,7 +233,7 @@ local register_boat = function(parameters)
|
|||||||
minetest.register_craftitem(
|
minetest.register_craftitem(
|
||||||
"nalc_boats:"..parameters.name,
|
"nalc_boats:"..parameters.name,
|
||||||
{
|
{
|
||||||
description = parameters.description or "Boat",
|
description = parameters.description or S("Boat"),
|
||||||
inventory_image = "boats_"..parameters.name .. "_inventory.png",
|
inventory_image = "boats_"..parameters.name .. "_inventory.png",
|
||||||
wield_image = "boats_"..parameters.name.."_wield.png",
|
wield_image = "boats_"..parameters.name.."_wield.png",
|
||||||
wield_scale = {x = 2, y = 2, z = 1},
|
wield_scale = {x = 2, y = 2, z = 1},
|
||||||
@ -281,7 +282,7 @@ register_boat(
|
|||||||
down = 0.18,
|
down = 0.18,
|
||||||
rotate = 1
|
rotate = 1
|
||||||
},
|
},
|
||||||
description = "Race boat"
|
description = S("Race boat")
|
||||||
})
|
})
|
||||||
|
|
||||||
register_boat(
|
register_boat(
|
||||||
@ -292,7 +293,7 @@ register_boat(
|
|||||||
down = 0.25,
|
down = 0.25,
|
||||||
rotate = 4
|
rotate = 4
|
||||||
},
|
},
|
||||||
description = "Expert race boat"
|
description = S("Expert race boat")
|
||||||
})
|
})
|
||||||
|
|
||||||
register_boat(
|
register_boat(
|
||||||
@ -303,7 +304,7 @@ register_boat(
|
|||||||
down = 0.24,
|
down = 0.24,
|
||||||
rotate = 4
|
rotate = 4
|
||||||
},
|
},
|
||||||
description = "Water boat"
|
description = S("Water boat")
|
||||||
})
|
})
|
||||||
|
|
||||||
register_boat(
|
register_boat(
|
||||||
@ -314,7 +315,7 @@ register_boat(
|
|||||||
down = 0.1,
|
down = 0.1,
|
||||||
rotate = 8
|
rotate = 8
|
||||||
},
|
},
|
||||||
description = "Moon boat"
|
description = S("Moon boat")
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft(
|
minetest.register_craft(
|
||||||
|
7
nalc_boats/locale/nalc_boats.fr.tr
Normal file
7
nalc_boats/locale/nalc_boats.fr.tr
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# textdomain: nalc_boats
|
||||||
|
|
||||||
|
Boat=Bateau
|
||||||
|
Race boat=Bateau de course
|
||||||
|
Expert race boat=Bateau de course expert
|
||||||
|
Water boat=Bateau à eau
|
||||||
|
Moon boat=Bateau lunaire
|
7
nalc_boats/locale/template.txt
Normal file
7
nalc_boats/locale/template.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# textdomain: nalc_boats
|
||||||
|
|
||||||
|
Boat=
|
||||||
|
Race boat=
|
||||||
|
Expert race boat=
|
||||||
|
Water boat=
|
||||||
|
Moon boat=
|
4
nalc_boats/mod.conf
Normal file
4
nalc_boats/mod.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name = nalc_boats
|
||||||
|
title = NALC Boats
|
||||||
|
description = Add new boats
|
||||||
|
depends = boats
|
@ -1,2 +0,0 @@
|
|||||||
nalc_default
|
|
||||||
bucket
|
|
@ -1,9 +1,11 @@
|
|||||||
|
local S = minetest.get_translator("nalc_bucket")
|
||||||
|
|
||||||
bucket.register_liquid(
|
bucket.register_liquid(
|
||||||
"nalc:acid_source",
|
"nalc:acid_source",
|
||||||
"nalc:acid_flowing",
|
"nalc:acid_flowing",
|
||||||
"nalc_bucket:bucket_acid",
|
"nalc_bucket:bucket_acid",
|
||||||
"bucket_acid.png",
|
"bucket_acid.png",
|
||||||
"Acid Bucket",
|
S("Acid Bucket"),
|
||||||
{not_in_creative_inventory = 1}
|
{not_in_creative_inventory = 1}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,7 +14,7 @@ bucket.register_liquid(
|
|||||||
"nalc:sand_flowing",
|
"nalc:sand_flowing",
|
||||||
"nalc_bucket:bucket_sand",
|
"nalc_bucket:bucket_sand",
|
||||||
"bucket_sand.png",
|
"bucket_sand.png",
|
||||||
"Sand Bucket",
|
S("Sand Bucket"),
|
||||||
{not_in_creative_inventory = 1}
|
{not_in_creative_inventory = 1}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
4
nalc_bucket/locale/nalc_bucket.fr.tr
Normal file
4
nalc_bucket/locale/nalc_bucket.fr.tr
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# textdomain: nalc_bucket
|
||||||
|
|
||||||
|
Acid Bucket=Seau d'acide
|
||||||
|
Sand Bucket=Seau de sable
|
4
nalc_bucket/locale/template.txt
Normal file
4
nalc_bucket/locale/template.txt
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# textdomain: nalc_bucket
|
||||||
|
|
||||||
|
Acid Bucket=
|
||||||
|
Sand Bucket=
|
4
nalc_bucket/mod.conf
Normal file
4
nalc_bucket/mod.conf
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
name = nalc_bucket
|
||||||
|
title = NALC Buckets
|
||||||
|
description = Add sand and acid source
|
||||||
|
depends = nalc_default,bucket
|
@ -1 +0,0 @@
|
|||||||
boost_cart
|
|
5
nalc_carts/mod.conf
Normal file
5
nalc_carts/mod.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
name = nalc_carts
|
||||||
|
title = NALC Carts
|
||||||
|
description = Customize cart mod
|
||||||
|
depends = boost_cart
|
||||||
|
|
@ -1,2 +0,0 @@
|
|||||||
default
|
|
||||||
toolranks?
|
|
@ -1,7 +1,9 @@
|
|||||||
|
local S = nalc_default.get_translator
|
||||||
|
|
||||||
default.register_fence(
|
default.register_fence(
|
||||||
":nalc:fence_cobble",
|
":nalc:fence_cobble",
|
||||||
{
|
{
|
||||||
description = "Cobble Fence",
|
description = S("Cobble Fence"),
|
||||||
texture = "default_fence_cobble.png",
|
texture = "default_fence_cobble.png",
|
||||||
material = "default:cobble",
|
material = "default:cobble",
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||||
@ -11,7 +13,7 @@ default.register_fence(
|
|||||||
default.register_fence(
|
default.register_fence(
|
||||||
":nalc:fence_desert_cobble",
|
":nalc:fence_desert_cobble",
|
||||||
{
|
{
|
||||||
description = "Desert Cobble Fence",
|
description = S("Desert Cobble Fence"),
|
||||||
texture = "default_fence_desert_cobble.png",
|
texture = "default_fence_desert_cobble.png",
|
||||||
material = "default:desert_cobble",
|
material = "default:desert_cobble",
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||||
@ -21,7 +23,7 @@ default.register_fence(
|
|||||||
default.register_fence(
|
default.register_fence(
|
||||||
":nalc:fence_steelblock",
|
":nalc:fence_steelblock",
|
||||||
{
|
{
|
||||||
description = "Steel Block Fence",
|
description = S("Steel Block Fence"),
|
||||||
texture = "default_fence_steelblock.png",
|
texture = "default_fence_steelblock.png",
|
||||||
material = "default:steelblock",
|
material = "default:steelblock",
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||||
@ -31,7 +33,7 @@ default.register_fence(
|
|||||||
default.register_fence(
|
default.register_fence(
|
||||||
":nalc:fence_brick",
|
":nalc:fence_brick",
|
||||||
{
|
{
|
||||||
description = "Brick Fence",
|
description = S("Brick Fence"),
|
||||||
texture = "default_fence_brick.png",
|
texture = "default_fence_brick.png",
|
||||||
material = "default:brick",
|
material = "default:brick",
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
local modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||||
|
|
||||||
|
local S = minetest.get_translator("nalc_default")
|
||||||
|
nalc_default = {}
|
||||||
|
nalc_default.get_translator = S
|
||||||
|
|
||||||
-- Functions
|
-- Functions
|
||||||
dofile(modpath.."/functions.lua")
|
dofile(modpath.."/functions.lua")
|
||||||
|
|
||||||
@ -26,6 +30,11 @@ minetest.register_on_joinplayer(
|
|||||||
function(player)
|
function(player)
|
||||||
player:hud_set_hotbar_image("hud_hotbar.png")
|
player:hud_set_hotbar_image("hud_hotbar.png")
|
||||||
player:hud_set_hotbar_selected_image("hud_hotbar_selected.png")
|
player:hud_set_hotbar_selected_image("hud_hotbar_selected.png")
|
||||||
|
|
||||||
|
-- Set cloud height
|
||||||
|
local cloud_params = player:get_clouds()
|
||||||
|
cloud_params.height = 150
|
||||||
|
player:set_clouds(cloud_params)
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
|
31
nalc_default/locale/nalc_default.fr.tr
Normal file
31
nalc_default/locale/nalc_default.fr.tr
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# textdomain: nalc_default
|
||||||
|
|
||||||
|
## nodes.lua ##
|
||||||
|
|
||||||
|
Coal Ore=Minerai de charbon
|
||||||
|
Iron Ore=Minerai de fer
|
||||||
|
Copper Ore=Minerai de cuivre
|
||||||
|
Tin Ore=Minerai d'étain
|
||||||
|
Meze Block=Bloc de meze
|
||||||
|
Spiky Cactus=Cactus piquant
|
||||||
|
Acid Source=Source d'acide
|
||||||
|
Flowing Acid=Écoulement d'acide
|
||||||
|
Sand Source=Source de sable
|
||||||
|
Flowing Sand=Écoulement de sable
|
||||||
|
Obsidian Ladder=Échelle en obsidienne
|
||||||
|
|
||||||
|
|
||||||
|
## fences.lua ##
|
||||||
|
|
||||||
|
Cobble Fence=Clôture en pavé
|
||||||
|
Desert Cobble Fence=Clôture en pavé du désert
|
||||||
|
Steel Block Fence=Clôture en blocs d'acier
|
||||||
|
Brick Fence=Clôture en brique
|
||||||
|
|
||||||
|
|
||||||
|
## mapgen.lua ##
|
||||||
|
|
||||||
|
Golden Pickaxe=Pioche en or
|
||||||
|
Golden Shovel=Pelle en or
|
||||||
|
Golden Axe=Hache en or
|
||||||
|
Golden Sword=Épée en or
|
31
nalc_default/locale/template.txt
Normal file
31
nalc_default/locale/template.txt
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# textdomain: nalc_default
|
||||||
|
|
||||||
|
## nodes.lua ##
|
||||||
|
|
||||||
|
Coal Ore=
|
||||||
|
Iron Ore=
|
||||||
|
Copper Ore=
|
||||||
|
Tin Ore=
|
||||||
|
Meze Block=
|
||||||
|
Spiky Cactus=
|
||||||
|
Acid Source=
|
||||||
|
Flowing Acid=
|
||||||
|
Sand Source=
|
||||||
|
Flowing Sand=
|
||||||
|
Obsidian Ladder=
|
||||||
|
|
||||||
|
|
||||||
|
## fences.lua ##
|
||||||
|
|
||||||
|
Cobble Fence=
|
||||||
|
Desert Cobble Fence=
|
||||||
|
Steel Block Fence=
|
||||||
|
Brick Fence=
|
||||||
|
|
||||||
|
|
||||||
|
## mapgen.lua ##
|
||||||
|
|
||||||
|
Golden Pickaxe=
|
||||||
|
Golden Shovel=
|
||||||
|
Golden Axe=
|
||||||
|
Golden Sword=
|
5
nalc_default/mod.conf
Normal file
5
nalc_default/mod.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
name = nalc_default
|
||||||
|
title = NALC Default
|
||||||
|
description = Customize default mod
|
||||||
|
depends = default
|
||||||
|
optional_depends = toolranks
|
@ -1,3 +1,5 @@
|
|||||||
|
local S = nalc_default.get_translator
|
||||||
|
|
||||||
local function die_later(digger)
|
local function die_later(digger)
|
||||||
digger:set_hp(0)
|
digger:set_hp(0)
|
||||||
end
|
end
|
||||||
@ -5,7 +7,7 @@ end
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:desert_stone_with_coal",
|
":nalc:desert_stone_with_coal",
|
||||||
{
|
{
|
||||||
description = "Coal Ore",
|
description = S("Coal Ore"),
|
||||||
tiles = {"default_desert_stone.png^default_mineral_coal.png"},
|
tiles = {"default_desert_stone.png^default_mineral_coal.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {crumbly = 1, cracky = 3},
|
groups = {crumbly = 1, cracky = 3},
|
||||||
@ -20,7 +22,7 @@ minetest.register_node(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:desert_stone_with_iron",
|
":nalc:desert_stone_with_iron",
|
||||||
{
|
{
|
||||||
description = "Iron Ore",
|
description = S("Iron Ore"),
|
||||||
tiles = {"default_desert_stone.png^default_mineral_iron.png"},
|
tiles = {"default_desert_stone.png^default_mineral_iron.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky = 2},
|
groups = {cracky = 2},
|
||||||
@ -35,7 +37,7 @@ minetest.register_node(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:desert_stone_with_copper",
|
":nalc:desert_stone_with_copper",
|
||||||
{
|
{
|
||||||
description = "Copper Ore",
|
description = S("Copper Ore"),
|
||||||
tiles = {"default_desert_stone.png^default_mineral_copper.png"},
|
tiles = {"default_desert_stone.png^default_mineral_copper.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky = 2},
|
groups = {cracky = 2},
|
||||||
@ -50,7 +52,7 @@ minetest.register_node(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:desert_stone_with_tin",
|
":nalc:desert_stone_with_tin",
|
||||||
{
|
{
|
||||||
description = "Tin Ore",
|
description = S("Tin Ore"),
|
||||||
tiles = {"default_desert_stone.png^default_mineral_tin.png"},
|
tiles = {"default_desert_stone.png^default_mineral_tin.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
groups = {cracky = 2},
|
groups = {cracky = 2},
|
||||||
@ -65,7 +67,7 @@ minetest.register_node(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:meze",
|
":nalc:meze",
|
||||||
{
|
{
|
||||||
description = "Meze Block",
|
description = S("Meze Block"),
|
||||||
tiles = {"default_meze_block.png"},
|
tiles = {"default_meze_block.png"},
|
||||||
is_ground_content = true,
|
is_ground_content = true,
|
||||||
drop = "",
|
drop = "",
|
||||||
@ -98,7 +100,7 @@ minetest.override_item(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:cactus_spiky",
|
":nalc:cactus_spiky",
|
||||||
{
|
{
|
||||||
description = "Spiky Cactus",
|
description = S("Spiky Cactus"),
|
||||||
tiles = {"default_cactus_top.png", "default_cactus_top.png",
|
tiles = {"default_cactus_top.png", "default_cactus_top.png",
|
||||||
"default_cactus_spiky.png"},
|
"default_cactus_spiky.png"},
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
@ -119,7 +121,7 @@ minetest.register_node(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:acid_source",
|
":nalc:acid_source",
|
||||||
{
|
{
|
||||||
description = "Acid Source",
|
description = S("Acid Source"),
|
||||||
inventory_image = minetest.inventorycube("default_acid.png"),
|
inventory_image = minetest.inventorycube("default_acid.png"),
|
||||||
drawtype = "liquid",
|
drawtype = "liquid",
|
||||||
tiles = {
|
tiles = {
|
||||||
@ -133,7 +135,7 @@ minetest.register_node(
|
|||||||
backface_culling = false,
|
backface_culling = false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
alpha = 160,
|
use_texture_alpha = "blend",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
pointable = false,
|
pointable = false,
|
||||||
@ -154,7 +156,7 @@ minetest.register_node(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:acid_flowing",
|
":nalc:acid_flowing",
|
||||||
{
|
{
|
||||||
description = "Flowing Acid",
|
description = S("Flowing Acid"),
|
||||||
inventory_image = minetest.inventorycube("default_acid.png"),
|
inventory_image = minetest.inventorycube("default_acid.png"),
|
||||||
drawtype = "flowingliquid",
|
drawtype = "flowingliquid",
|
||||||
tiles = {"default_acid.png"},
|
tiles = {"default_acid.png"},
|
||||||
@ -170,7 +172,7 @@ minetest.register_node(
|
|||||||
animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 0.6}
|
animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 0.6}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
alpha = 160,
|
use_texture_alpha = "blend",
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "flowingliquid",
|
paramtype2 = "flowingliquid",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
@ -192,11 +194,10 @@ minetest.register_node(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:sand_source",
|
":nalc:sand_source",
|
||||||
{
|
{
|
||||||
description = "Sand Source",
|
description = S("Sand Source"),
|
||||||
inventory_image = minetest.inventorycube("default_sand.png"),
|
inventory_image = minetest.inventorycube("default_sand.png"),
|
||||||
drawtype = "liquid",
|
drawtype = "liquid",
|
||||||
tiles = {"default_sand.png"},
|
tiles = {"default_sand.png"},
|
||||||
alpha = 255,
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
pointable = false,
|
pointable = false,
|
||||||
@ -216,7 +217,7 @@ minetest.register_node(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:sand_flowing",
|
":nalc:sand_flowing",
|
||||||
{
|
{
|
||||||
description = "Flowing Sand",
|
description = S("Flowing Sand"),
|
||||||
inventory_image = minetest.inventorycube("default_sand.png"),
|
inventory_image = minetest.inventorycube("default_sand.png"),
|
||||||
drawtype = "flowingliquid",
|
drawtype = "flowingliquid",
|
||||||
tiles = {"default_sand.png"},
|
tiles = {"default_sand.png"},
|
||||||
@ -232,7 +233,6 @@ minetest.register_node(
|
|||||||
animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 0.6}
|
animation={type = "vertical_frames", aspect_w= 16, aspect_h = 16, length = 0.6}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
alpha = 255,
|
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
paramtype2 = "flowingliquid",
|
paramtype2 = "flowingliquid",
|
||||||
walkable = false,
|
walkable = false,
|
||||||
@ -256,7 +256,7 @@ minetest.register_node(
|
|||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
":nalc:ladder_obsidian",
|
":nalc:ladder_obsidian",
|
||||||
{
|
{
|
||||||
description = "Obsidian Ladder",
|
description = S("Obsidian Ladder"),
|
||||||
drawtype = "signlike",
|
drawtype = "signlike",
|
||||||
tiles = {"default_ladder_obsidian.png"},
|
tiles = {"default_ladder_obsidian.png"},
|
||||||
inventory_image = "default_ladder_obsidian.png",
|
inventory_image = "default_ladder_obsidian.png",
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
local S = nalc_default.get_translator
|
||||||
|
|
||||||
minetest.register_craft(
|
minetest.register_craft(
|
||||||
{ output = 'nalc:pick_gold',
|
{ output = 'nalc:pick_gold',
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -44,7 +46,7 @@ minetest.register_craft(
|
|||||||
minetest.register_tool(
|
minetest.register_tool(
|
||||||
":nalc:pick_gold",
|
":nalc:pick_gold",
|
||||||
{
|
{
|
||||||
description = "Golden Pickaxe",
|
description = S("Golden Pickaxe"),
|
||||||
inventory_image = "default_tool_goldpick.png",
|
inventory_image = "default_tool_goldpick.png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1.2,
|
full_punch_interval = 1.2,
|
||||||
@ -60,7 +62,7 @@ minetest.register_tool(
|
|||||||
minetest.register_tool(
|
minetest.register_tool(
|
||||||
":nalc:shovel_gold",
|
":nalc:shovel_gold",
|
||||||
{
|
{
|
||||||
description = "Golden Shovel",
|
description = S("Golden Shovel"),
|
||||||
inventory_image = "default_tool_goldshovel.png",
|
inventory_image = "default_tool_goldshovel.png",
|
||||||
wield_image = "default_tool_goldshovel.png^[transformR90",
|
wield_image = "default_tool_goldshovel.png^[transformR90",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
@ -76,7 +78,7 @@ minetest.register_tool(
|
|||||||
minetest.register_tool(
|
minetest.register_tool(
|
||||||
":nalc:axe_gold",
|
":nalc:axe_gold",
|
||||||
{
|
{
|
||||||
description = "Golden Axe",
|
description = S("Golden Axe"),
|
||||||
inventory_image = "default_tool_goldaxe.png",
|
inventory_image = "default_tool_goldaxe.png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1.2,
|
full_punch_interval = 1.2,
|
||||||
@ -92,7 +94,7 @@ minetest.register_tool(
|
|||||||
minetest.register_tool(
|
minetest.register_tool(
|
||||||
":nalc:sword_gold",
|
":nalc:sword_gold",
|
||||||
{
|
{
|
||||||
description = "Golden Sword",
|
description = S("Golden Sword"),
|
||||||
inventory_image = "default_tool_goldsword.png",
|
inventory_image = "default_tool_goldsword.png",
|
||||||
tool_capabilities = {
|
tool_capabilities = {
|
||||||
full_punch_interval = 1,
|
full_punch_interval = 1,
|
||||||
@ -106,28 +108,10 @@ minetest.register_tool(
|
|||||||
|
|
||||||
-- Toolranks
|
-- Toolranks
|
||||||
if minetest.get_modpath("toolranks") then
|
if minetest.get_modpath("toolranks") then
|
||||||
|
toolranks.add_tool("nalc:pick_gold")
|
||||||
minetest.override_item(
|
toolranks.add_tool("nalc:shovel_gold")
|
||||||
"nalc:pick_gold",
|
toolranks.add_tool("nalc:axe_gold")
|
||||||
{
|
toolranks.add_tool("nalc:sword_gold")
|
||||||
original_description = "Golden Pickaxe",
|
|
||||||
description = toolranks.create_description("Golden Pickaxe", 0, 1),
|
|
||||||
after_use = toolranks.new_afteruse
|
|
||||||
})
|
|
||||||
minetest.override_item(
|
|
||||||
"nalc:axe_gold",
|
|
||||||
{
|
|
||||||
original_description = "Golden Axe",
|
|
||||||
description = toolranks.create_description("Golden Axe", 0, 1),
|
|
||||||
after_use = toolranks.new_afteruse
|
|
||||||
})
|
|
||||||
minetest.override_item(
|
|
||||||
"nalc:shovel_gold",
|
|
||||||
{
|
|
||||||
original_description = "Golden Shovel",
|
|
||||||
description = toolranks.create_description("Golden Shovel", 0, 1),
|
|
||||||
after_use = toolranks.new_afteruse
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Aliases
|
-- Aliases
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
diet
|
|
||||||
farming?
|
|
||||||
mtfoods?
|
|
5
nalc_diet/mod.conf
Normal file
5
nalc_diet/mod.conf
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
name = nalc_diet
|
||||||
|
title = NALC Diet
|
||||||
|
description = Customize diet mod
|
||||||
|
depends = diet
|
||||||
|
optional_depends = farming,mtfoods
|
@ -1,2 +0,0 @@
|
|||||||
doors
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
|||||||
|
local S = minetest.get_translator("nalc_doors")
|
||||||
|
|
||||||
-- Register MFF doors
|
-- Register MFF doors
|
||||||
|
|
||||||
-- doors tin MFF
|
-- doors tin MFF
|
||||||
@ -5,9 +7,9 @@ doors.register(
|
|||||||
"door_tin",
|
"door_tin",
|
||||||
{
|
{
|
||||||
tiles = { "doors_door_tin.png" },
|
tiles = { "doors_door_tin.png" },
|
||||||
description = "Tin Door",
|
description = S("Tin Door"),
|
||||||
inventory_image = "doors_item_tin.png",
|
inventory_image = "doors_item_tin.png",
|
||||||
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1},
|
groups = {node=1,snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1},
|
||||||
protected = true,
|
protected = true,
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
sunlight = false,
|
sunlight = false,
|
||||||
@ -24,11 +26,13 @@ if minetest.get_modpath("darkage") then
|
|||||||
"door_prison",
|
"door_prison",
|
||||||
{
|
{
|
||||||
tiles = { "doors_door_prison.png" },
|
tiles = { "doors_door_prison.png" },
|
||||||
description = "Prison Door",
|
description = S("Prison Door"),
|
||||||
inventory_image = "doors_item_prison.png",
|
inventory_image = "doors_item_prison.png",
|
||||||
groups = {snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1},
|
groups = {node=1,snappy=1,bendy=2,cracky=1,melty=2,level=2,door=1},
|
||||||
protected = true,
|
protected = true,
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
sound_open = "doors_steel_door_open",
|
||||||
|
sound_close = "doors_steel_door_close",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"darkage:iron_stick", "darkage:iron_stick"},
|
{"darkage:iron_stick", "darkage:iron_stick"},
|
||||||
{"darkage:iron_stick", "darkage:iron_stick"},
|
{"darkage:iron_stick", "darkage:iron_stick"},
|
||||||
@ -43,9 +47,9 @@ if minetest.get_modpath("dye") then
|
|||||||
"doors:door_gardengate_white",
|
"doors:door_gardengate_white",
|
||||||
{
|
{
|
||||||
tiles = { "doors_door_gardengate_white.png" },
|
tiles = { "doors_door_gardengate_white.png" },
|
||||||
description = "Garden Gate White Door",
|
description = S("Garden Gate White Door"),
|
||||||
inventory_image = "doors_item_gardengate_white.png",
|
inventory_image = "doors_item_gardengate_white.png",
|
||||||
groups = {choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
|
groups = {node=1,choppy=2,oddly_breakable_by_hand=2,flammable=2,door=1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
recipe = {
|
recipe = {
|
||||||
{"dye:white", "group:stick", ""},
|
{"dye:white", "group:stick", ""},
|
||||||
@ -211,12 +215,18 @@ function _doors.door_toggle(pos, node, clicker)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local dir = node.param2
|
local dir = node.param2
|
||||||
minetest.swap_node(
|
|
||||||
pos,
|
-- It's possible param2 is messed up, so, validate before using
|
||||||
{
|
-- the input data. This indicates something may have rotated
|
||||||
name = name .. transform[state + 1][dir+1].v,
|
-- the door, even though that is not supported.
|
||||||
param2 = transform[state + 1][dir+1].param2
|
if not transform[state + 1] or not transform[state + 1][dir + 1] then
|
||||||
})
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.swap_node(pos, {
|
||||||
|
name = name .. transform[state + 1][dir+1].v,
|
||||||
|
param2 = transform[state + 1][dir+1].param2
|
||||||
|
})
|
||||||
meta:set_int("state", state)
|
meta:set_int("state", state)
|
||||||
|
|
||||||
--MFF double porte
|
--MFF double porte
|
||||||
@ -237,14 +247,20 @@ function _doors.door_toggle(pos, node, clicker)
|
|||||||
-- /double porte
|
-- /double porte
|
||||||
|
|
||||||
if state % 2 == 0 then
|
if state % 2 == 0 then
|
||||||
minetest.sound_play(def.door.sounds[1], {pos = pos, gain = 0.3, max_hear_distance = 10})
|
minetest.sound_play(def.door.sounds[1],
|
||||||
|
{pos = pos, gain = def.door.gains[1], max_hear_distance = 10}, true)
|
||||||
else
|
else
|
||||||
minetest.sound_play(def.door.sounds[2], {pos = pos, gain = 0.3, max_hear_distance = 10})
|
minetest.sound_play(def.door.sounds[2],
|
||||||
|
{pos = pos, gain = def.door.gains[2], max_hear_distance = 10}, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local old_doors_toggle = doors.door_toggle -- unused now
|
||||||
|
doors.door_toggle = _doors.door_toggle
|
||||||
|
|
||||||
local function on_place_node(place_to, newnode, placer, oldnode, itemstack, pointed_thing)
|
local function on_place_node(place_to, newnode, placer, oldnode, itemstack, pointed_thing)
|
||||||
-- Run script hook
|
-- Run script hook
|
||||||
for _, callback in ipairs(minetest.registered_on_placenodes) do
|
for _, callback in ipairs(minetest.registered_on_placenodes) do
|
||||||
@ -274,6 +290,70 @@ local function can_dig_door(pos, digger)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function on_skeleton_key_use(pos, player, newsecret)
|
||||||
|
replace_old_owner_information(pos)
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local owner = meta:get_string("owner")
|
||||||
|
local pname = player:get_player_name()
|
||||||
|
|
||||||
|
-- verify placer is owner of lockable door
|
||||||
|
if owner ~= pname then
|
||||||
|
minetest.record_protection_violation(pos, pname)
|
||||||
|
minetest.chat_send_player(pname, S("You do not own this locked door."))
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local secret = meta:get_string("key_lock_secret")
|
||||||
|
if secret == "" then
|
||||||
|
secret = newsecret
|
||||||
|
meta:set_string("key_lock_secret", secret)
|
||||||
|
|
||||||
|
--MFF double porte
|
||||||
|
local node = minetest.get_node(pos)
|
||||||
|
local def = minetest.registered_nodes[node.name]
|
||||||
|
local b = string.sub(node.name, -1)
|
||||||
|
local dir = node.param2
|
||||||
|
local state = meta:get_string("state")
|
||||||
|
if state == "" then
|
||||||
|
if node.name:sub(-2) == "_b" then
|
||||||
|
state = 2
|
||||||
|
else
|
||||||
|
state = 0
|
||||||
|
end
|
||||||
|
else
|
||||||
|
state = tonumber(state)
|
||||||
|
end
|
||||||
|
local pos2 = get_double_doors(pos, dir, state, b)
|
||||||
|
if pos2 then
|
||||||
|
local node2 = minetest.get_node_or_nil(pos2)
|
||||||
|
if node2 and string.sub(node2.name, 0, -3) == string.sub(node.name, 0, -3) then
|
||||||
|
if b ~= string.sub(node2.name, -1) then
|
||||||
|
local state2 = minetest.get_meta(pos2):get_int("state")
|
||||||
|
if (state % 2) == (state2 % 2) then
|
||||||
|
local meta2 = minetest.get_meta(pos2)
|
||||||
|
meta2:set_string("key_lock_secret", secret)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- /double porte
|
||||||
|
end
|
||||||
|
|
||||||
|
return secret, S("a locked door"), owner
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- / rewrite function of default protected doors, keys open double doors
|
||||||
|
minetest.register_on_mods_loaded(function()
|
||||||
|
for n in pairs(doors.registered_doors) do
|
||||||
|
local def = minetest.registered_nodes[n]
|
||||||
|
if def and def.on_skeleton_key_use then
|
||||||
|
def.on_skeleton_key_use = on_skeleton_key_use
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
-- door 3 nodes
|
-- door 3 nodes
|
||||||
function doors.register3(name, def)
|
function doors.register3(name, def)
|
||||||
if not name:find(":") then
|
if not name:find(":") then
|
||||||
@ -281,155 +361,150 @@ function doors.register3(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- replace old doors of this type automatically
|
-- replace old doors of this type automatically
|
||||||
minetest.register_lbm(
|
minetest.register_lbm({
|
||||||
{
|
name = ":doors:replace_" .. name:gsub(":", "_"),
|
||||||
name = ":doors:replace_" .. name:gsub(":", "_"),
|
nodenames = {name.."_b_1", name.."_b_2"},
|
||||||
nodenames = {name.."_b_1", name.."_b_2"},
|
action = function(pos, node)
|
||||||
action = function(pos, node)
|
local l = tonumber(node.name:sub(-1))
|
||||||
local l = tonumber(node.name:sub(-1))
|
local meta = minetest.get_meta(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local h = meta:get_int("right") + 1
|
||||||
local h = meta:get_int("right") + 1
|
local p2 = node.param2
|
||||||
local p2 = node.param2
|
local replace = {
|
||||||
local replace = {
|
{{type = "a", state = 0}, {type = "a", state = 3}},
|
||||||
{{type = "a", state = 0}, {type = "a", state = 3}},
|
{{type = "b", state = 1}, {type = "b", state = 2}}
|
||||||
{{type = "b", state = 1}, {type = "b", state = 2}}
|
}
|
||||||
}
|
local new = replace[l][h]
|
||||||
local new = replace[l][h]
|
-- retain infotext and doors_owner fields
|
||||||
-- retain infotext and doors_owner fields
|
minetest.swap_node(pos, {name = name .. "_" .. new.type, param2 = p2})
|
||||||
minetest.swap_node(pos, {name = name .. "_" .. new.type, param2 = p2})
|
meta:set_int("state", new.state)
|
||||||
meta:set_int("state", new.state)
|
-- properly place doors:hidden at the right spot
|
||||||
-- properly place doors:hidden at the right spot
|
local p3 = p2
|
||||||
local p3 = p2
|
if new.state >= 2 then
|
||||||
|
p3 = (p3 + 3) % 4
|
||||||
|
end
|
||||||
|
if new.state % 2 == 1 then
|
||||||
if new.state >= 2 then
|
if new.state >= 2 then
|
||||||
|
p3 = (p3 + 1) % 4
|
||||||
|
else
|
||||||
p3 = (p3 + 3) % 4
|
p3 = (p3 + 3) % 4
|
||||||
end
|
end
|
||||||
if new.state % 2 == 1 then
|
|
||||||
if new.state >= 2 then
|
|
||||||
p3 = (p3 + 1) % 4
|
|
||||||
else
|
|
||||||
p3 = (p3 + 3) % 4
|
|
||||||
end
|
|
||||||
end
|
|
||||||
-- wipe meta on top node as it's unused
|
|
||||||
minetest.set_node(
|
|
||||||
{x = pos.x, y = pos.y + 1, z = pos.z},
|
|
||||||
{name = "doors:hidden", param2 = p3}
|
|
||||||
)
|
|
||||||
minetest.set_node(
|
|
||||||
{x = pos.x, y = pos.y + 2, z = pos.z},
|
|
||||||
{name = "doors:hidden", param2 = p3}
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
})
|
-- wipe meta on top node as it's unused
|
||||||
|
minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z},
|
||||||
|
{name = "doors:hidden", param2 = p3})
|
||||||
|
minetest.set_node({x = pos.x, y = pos.y + 2, z = pos.z},
|
||||||
|
{name = "doors:hidden", param2 = p3})
|
||||||
|
end
|
||||||
|
})
|
||||||
|
|
||||||
minetest.register_craftitem(
|
minetest.register_craftitem(":" .. name, {
|
||||||
":" .. name,
|
description = def.description,
|
||||||
{
|
inventory_image = def.inventory_image,
|
||||||
description = def.description,
|
groups = table.copy(def.groups),
|
||||||
inventory_image = def.inventory_image,
|
|
||||||
groups = table.copy(def.groups),
|
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
local pos
|
local pos
|
||||||
|
|
||||||
if not pointed_thing.type == "node" then
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
local node = minetest.get_node(pointed_thing.under)
|
|
||||||
local pdef = minetest.registered_nodes[node.name]
|
|
||||||
if pdef and pdef.on_rightclick and
|
|
||||||
not placer:get_player_control().sneak then
|
|
||||||
return pdef.on_rightclick(pointed_thing.under,
|
|
||||||
node, placer, itemstack, pointed_thing)
|
|
||||||
end
|
|
||||||
|
|
||||||
if pdef and pdef.buildable_to then
|
|
||||||
pos = pointed_thing.under
|
|
||||||
else
|
|
||||||
pos = pointed_thing.above
|
|
||||||
node = minetest.get_node(pos)
|
|
||||||
pdef = minetest.registered_nodes[node.name]
|
|
||||||
if not pdef or not pdef.buildable_to then
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
|
||||||
local top_node = minetest.get_node_or_nil(above)
|
|
||||||
local topdef = top_node and minetest.registered_nodes[top_node.name]
|
|
||||||
|
|
||||||
if not topdef or not topdef.buildable_to then
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
local above2 = { x = pos.x, y = pos.y + 2, z = pos.z }
|
|
||||||
local top_node2 = minetest.get_node_or_nil(above2)
|
|
||||||
local topdef2 = top_node2 and minetest.registered_nodes[top_node2.name]
|
|
||||||
|
|
||||||
if not topdef2 or not topdef2.buildable_to then
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
local pn = placer:get_player_name()
|
|
||||||
if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) or minetest.is_protected(above2, pn) then
|
|
||||||
return itemstack
|
|
||||||
end
|
|
||||||
|
|
||||||
local dir = minetest.dir_to_facedir(placer:get_look_dir())
|
|
||||||
|
|
||||||
local ref = {
|
|
||||||
{x = -1, y = 0, z = 0},
|
|
||||||
{x = 0, y = 0, z = 1},
|
|
||||||
{x = 1, y = 0, z = 0},
|
|
||||||
{x = 0, y = 0, z = -1},
|
|
||||||
}
|
|
||||||
|
|
||||||
local aside = {
|
|
||||||
x = pos.x + ref[dir + 1].x,
|
|
||||||
y = pos.y + ref[dir + 1].y,
|
|
||||||
z = pos.z + ref[dir + 1].z,
|
|
||||||
}
|
|
||||||
|
|
||||||
local state = 0
|
|
||||||
if minetest.get_item_group(minetest.get_node(aside).name, "door") == 1 then
|
|
||||||
state = state + 2
|
|
||||||
minetest.set_node(pos, {name = name .. "_b", param2 = dir})
|
|
||||||
minetest.set_node(above, {name = "doors:hidden", param2 = (dir + 3) % 4})
|
|
||||||
minetest.set_node(above2, {name = "doors:hidden", param2 = (dir + 3) % 4})
|
|
||||||
else
|
|
||||||
minetest.set_node(pos, {name = name .. "_a", param2 = dir})
|
|
||||||
minetest.set_node(above, {name = "doors:hidden", param2 = dir})
|
|
||||||
minetest.set_node(above2, {name = "doors:hidden", param2 = dir})
|
|
||||||
end
|
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
meta:set_int("state", state)
|
|
||||||
|
|
||||||
if def.protected then
|
|
||||||
meta:set_string("owner", pn)
|
|
||||||
meta:set_string("infotext", "Owned by " .. pn)
|
|
||||||
end
|
|
||||||
|
|
||||||
if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then
|
|
||||||
itemstack:take_item()
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.sound_play(def.sounds.place, {pos = pos})
|
|
||||||
|
|
||||||
on_place_node(pos, minetest.get_node(pos), placer, node, itemstack, pointed_thing)
|
|
||||||
|
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
})
|
|
||||||
|
local doorname = itemstack:get_name()
|
||||||
|
local node = minetest.get_node(pointed_thing.under)
|
||||||
|
local pdef = minetest.registered_nodes[node.name]
|
||||||
|
if pdef and pdef.on_rightclick and
|
||||||
|
not (placer and placer:is_player() and
|
||||||
|
placer:get_player_control().sneak) then
|
||||||
|
return pdef.on_rightclick(pointed_thing.under,
|
||||||
|
node, placer, itemstack, pointed_thing)
|
||||||
|
end
|
||||||
|
|
||||||
|
if pdef and pdef.buildable_to then
|
||||||
|
pos = pointed_thing.under
|
||||||
|
else
|
||||||
|
pos = pointed_thing.above
|
||||||
|
node = minetest.get_node(pos)
|
||||||
|
pdef = minetest.registered_nodes[node.name]
|
||||||
|
if not pdef or not pdef.buildable_to then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
|
||||||
|
local top_node = minetest.get_node_or_nil(above)
|
||||||
|
local topdef = top_node and minetest.registered_nodes[top_node.name]
|
||||||
|
|
||||||
|
if not topdef or not topdef.buildable_to then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local above2 = { x = pos.x, y = pos.y + 2, z = pos.z }
|
||||||
|
local top_node2 = minetest.get_node_or_nil(above2)
|
||||||
|
local topdef2 = top_node2 and minetest.registered_nodes[top_node2.name]
|
||||||
|
|
||||||
|
if not topdef2 or not topdef2.buildable_to then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local pn = placer and placer:get_player_name() or ""
|
||||||
|
if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) or minetest.is_protected(above2, pn) then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local dir = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0
|
||||||
|
|
||||||
|
local ref = {
|
||||||
|
{x = -1, y = 0, z = 0},
|
||||||
|
{x = 0, y = 0, z = 1},
|
||||||
|
{x = 1, y = 0, z = 0},
|
||||||
|
{x = 0, y = 0, z = -1},
|
||||||
|
}
|
||||||
|
|
||||||
|
local aside = {
|
||||||
|
x = pos.x + ref[dir + 1].x,
|
||||||
|
y = pos.y + ref[dir + 1].y,
|
||||||
|
z = pos.z + ref[dir + 1].z,
|
||||||
|
}
|
||||||
|
|
||||||
|
local state = 0
|
||||||
|
if minetest.get_item_group(minetest.get_node(aside).name, "door") == 1 then
|
||||||
|
state = state + 2
|
||||||
|
minetest.set_node(pos, {name = doorname .. "_b", param2 = dir})
|
||||||
|
minetest.set_node(above, {name = "doors:hidden", param2 = (dir + 3) % 4})
|
||||||
|
minetest.set_node(above2, {name = "doors:hidden", param2 = (dir + 3) % 4})
|
||||||
|
else
|
||||||
|
minetest.set_node(pos, {name = name .. "_a", param2 = dir})
|
||||||
|
minetest.set_node(above, {name = "doors:hidden", param2 = dir})
|
||||||
|
minetest.set_node(above2, {name = "doors:hidden", param2 = dir})
|
||||||
|
end
|
||||||
|
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
meta:set_int("state", state)
|
||||||
|
|
||||||
|
if def.protected then
|
||||||
|
meta:set_string("owner", pn)
|
||||||
|
meta:set_string("infotext", def.description .. "\n" .. S("Owned by @1", pn))
|
||||||
|
end
|
||||||
|
|
||||||
|
if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then
|
||||||
|
itemstack:take_item()
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.sound_play(def.sounds.place, {pos = pos}, true)
|
||||||
|
|
||||||
|
on_place_node(pos, minetest.get_node(pos),
|
||||||
|
placer, node, itemstack, pointed_thing)
|
||||||
|
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
})
|
||||||
def.inventory_image = nil
|
def.inventory_image = nil
|
||||||
|
|
||||||
if def.recipe then
|
if def.recipe then
|
||||||
minetest.register_craft(
|
minetest.register_craft({
|
||||||
{
|
output = name,
|
||||||
output = name,
|
recipe = def.recipe,
|
||||||
recipe = def.recipe,
|
})
|
||||||
})
|
|
||||||
end
|
end
|
||||||
def.recipe = nil
|
def.recipe = nil
|
||||||
|
|
||||||
@ -445,24 +520,36 @@ function doors.register3(name, def)
|
|||||||
def.sound_close = "doors_door_close"
|
def.sound_close = "doors_door_close"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if not def.gain_open then
|
||||||
|
def.gain_open = 0.3
|
||||||
|
end
|
||||||
|
|
||||||
|
if not def.gain_close then
|
||||||
|
def.gain_close = 0.3
|
||||||
|
end
|
||||||
|
|
||||||
def.groups.not_in_creative_inventory = 1
|
def.groups.not_in_creative_inventory = 1
|
||||||
def.groups.door = 1
|
def.groups.door = 1
|
||||||
def.drop = name
|
def.drop = name
|
||||||
def.door = {
|
def.door = {
|
||||||
name = name,
|
name = name,
|
||||||
sounds = { def.sound_close, def.sound_open },
|
sounds = {def.sound_close, def.sound_open},
|
||||||
|
gains = {def.gain_close, def.gain_open},
|
||||||
}
|
}
|
||||||
|
if not def.on_rightclick then
|
||||||
def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
_doors.door_toggle(pos, node, clicker)
|
_doors.door_toggle(pos, node, clicker)
|
||||||
return itemstack
|
return itemstack
|
||||||
|
end
|
||||||
end
|
end
|
||||||
def.after_dig_node = function(pos, node, meta, digger)
|
def.after_dig_node = function(pos, node, meta, digger)
|
||||||
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
|
minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z})
|
||||||
minetest.remove_node({x = pos.x, y = pos.y + 2, z = pos.z})
|
minetest.remove_node({x = pos.x, y = pos.y + 2, z = pos.z})
|
||||||
minetest.check_for_falling({x = pos.x, y = pos.y + 2, z = pos.z})
|
minetest.check_for_falling({x = pos.x, y = pos.y + 2, z = pos.z})
|
||||||
end
|
end
|
||||||
def.on_rotate = false
|
def.on_rotate = function(pos, node, user, mode, new_param2)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
if def.protected then
|
if def.protected then
|
||||||
def.can_dig = can_dig_door
|
def.can_dig = can_dig_door
|
||||||
@ -471,27 +558,9 @@ function doors.register3(name, def)
|
|||||||
local door = doors.get(pos)
|
local door = doors.get(pos)
|
||||||
door:toggle(player)
|
door:toggle(player)
|
||||||
end
|
end
|
||||||
def.on_skeleton_key_use = function(pos, player, newsecret)
|
def.on_skeleton_key_use = on_skeleton_key_use
|
||||||
replace_old_owner_information(pos)
|
|
||||||
local meta = minetest.get_meta(pos)
|
|
||||||
local owner = meta:get_string("owner")
|
|
||||||
local pname = player:get_player_name()
|
|
||||||
|
|
||||||
-- verify placer is owner of lockable door
|
def.node_dig_prediction = ""
|
||||||
if owner ~= pname then
|
|
||||||
minetest.record_protection_violation(pos, pname)
|
|
||||||
minetest.chat_send_player(pname, "You do not own this locked door.")
|
|
||||||
return nil
|
|
||||||
end
|
|
||||||
|
|
||||||
local secret = meta:get_string("key_lock_secret")
|
|
||||||
if secret == "" then
|
|
||||||
secret = newsecret
|
|
||||||
meta:set_string("key_lock_secret", secret)
|
|
||||||
end
|
|
||||||
|
|
||||||
return secret, "a locked door", owner
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
def.on_blast = function(pos, intensity)
|
def.on_blast = function(pos, intensity)
|
||||||
minetest.remove_node(pos)
|
minetest.remove_node(pos)
|
||||||
@ -516,24 +585,35 @@ function doors.register3(name, def)
|
|||||||
def.buildable_to = false
|
def.buildable_to = false
|
||||||
def.selection_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,2.5,-6/16}}
|
def.selection_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,2.5,-6/16}}
|
||||||
def.collision_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,2.5,-6/16}}
|
def.collision_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,2.5,-6/16}}
|
||||||
|
def.use_texture_alpha = def.use_texture_alpha or "clip"
|
||||||
|
|
||||||
def.mesh = "door3_a.obj"
|
def.mesh = "door3_a.obj"
|
||||||
minetest.register_node(":" .. name .. "_a", def)
|
minetest.register_node(":" .. name .. "_a", table.copy(def))
|
||||||
|
|
||||||
def.mesh = "door3_b.obj"
|
def.mesh = "door3_b.obj"
|
||||||
minetest.register_node(":" .. name .. "_b", def)
|
minetest.register_node(":" .. name .. "_b", table.copy(def))
|
||||||
|
|
||||||
|
def.mesh = "door3_b.obj"
|
||||||
|
minetest.register_node(":" .. name .. "_c", table.copy(def))
|
||||||
|
|
||||||
|
def.mesh = "door3_a.obj"
|
||||||
|
minetest.register_node(":" .. name .. "_d", table.copy(def))
|
||||||
|
|
||||||
_doors.registered_doors3[name .. "_a"] = true
|
_doors.registered_doors3[name .. "_a"] = true
|
||||||
_doors.registered_doors3[name .. "_b"] = true
|
_doors.registered_doors3[name .. "_b"] = true
|
||||||
|
_doors.registered_doors3[name .. "_c"] = true
|
||||||
|
_doors.registered_doors3[name .. "_d"] = true
|
||||||
end
|
end
|
||||||
|
|
||||||
doors.register3(
|
doors.register3(
|
||||||
"door3_wood",
|
"door3_wood",
|
||||||
{
|
{
|
||||||
tiles = {{ name = "doors_door3_wood.png", backface_culling = true }},
|
tiles = {{ name = "doors_door3_wood.png", backface_culling = true }},
|
||||||
description = "Wooden Door 3 Nodes",
|
description = S("Wooden Door 3 Nodes"),
|
||||||
inventory_image = "doors3_item_wood.png",
|
inventory_image = "doors3_item_wood.png",
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2 },
|
groups = {node = 1, choppy = 2, oddly_breakable_by_hand = 2, flammable = 2 },
|
||||||
|
gain_open = 0.06,
|
||||||
|
gain_close = 0.13,
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "", ""},
|
{"", "", ""},
|
||||||
{"", "doors:door_wood", ""},
|
{"", "doors:door_wood", ""},
|
||||||
@ -551,10 +631,10 @@ doors.register3(
|
|||||||
"door3_steel",
|
"door3_steel",
|
||||||
{
|
{
|
||||||
tiles = {{ name = "doors_door3_steel.png", backface_culling = true }},
|
tiles = {{ name = "doors_door3_steel.png", backface_culling = true }},
|
||||||
description = "Steel Door 3 Nodes",
|
description = S("Steel Door 3 Nodes"),
|
||||||
inventory_image = "doors3_item_steel.png",
|
inventory_image = "doors3_item_steel.png",
|
||||||
protected = true,
|
protected = true,
|
||||||
groups = {cracky = 1, level = 2},
|
groups = {node = 1, cracky = 1, level = 2},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
sound_open = "doors_steel_door_open",
|
sound_open = "doors_steel_door_open",
|
||||||
sound_close = "doors_steel_door_close",
|
sound_close = "doors_steel_door_close",
|
||||||
@ -575,9 +655,9 @@ doors.register3(
|
|||||||
"door3_glass",
|
"door3_glass",
|
||||||
{
|
{
|
||||||
tiles = { "doors_door3_glass.png"},
|
tiles = { "doors_door3_glass.png"},
|
||||||
description = "Glass Door 3 Nodes",
|
description = S("Glass Door 3 Nodes"),
|
||||||
inventory_image = "doors3_item_glass.png",
|
inventory_image = "doors3_item_glass.png",
|
||||||
groups = {cracky=3, oddly_breakable_by_hand=3},
|
groups = {node=1, cracky=3, oddly_breakable_by_hand=3},
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
sound_open = "doors_glass_door_open",
|
sound_open = "doors_glass_door_open",
|
||||||
sound_close = "doors_glass_door_close",
|
sound_close = "doors_glass_door_close",
|
||||||
@ -598,9 +678,9 @@ doors.register3(
|
|||||||
"door3_obsidian_glass",
|
"door3_obsidian_glass",
|
||||||
{
|
{
|
||||||
tiles = { "doors_door3_obsidian_glass.png" },
|
tiles = { "doors_door3_obsidian_glass.png" },
|
||||||
description = "Obsidian Glass Door 3 Nodes",
|
description = S("Obsidian Glass Door 3 Nodes"),
|
||||||
inventory_image = "doors3_item_obsidian_glass.png",
|
inventory_image = "doors3_item_obsidian_glass.png",
|
||||||
groups = {cracky=3},
|
groups = {node=1,cracky=3},
|
||||||
sounds = default.node_sound_glass_defaults(),
|
sounds = default.node_sound_glass_defaults(),
|
||||||
sound_open = "doors_glass_door_open",
|
sound_open = "doors_glass_door_open",
|
||||||
sound_close = "doors_glass_door_close",
|
sound_close = "doors_glass_door_close",
|
||||||
@ -623,9 +703,9 @@ if minetest.get_modpath("cherry_tree") then
|
|||||||
"door3_cherry",
|
"door3_cherry",
|
||||||
{
|
{
|
||||||
tiles = { "doors_door3_cherry.png" },
|
tiles = { "doors_door3_cherry.png" },
|
||||||
description = "Cherry Door 3 Nodes",
|
description = S("Cherry Door 3 Nodes"),
|
||||||
inventory_image = "doors3_item_cherry.png",
|
inventory_image = "doors3_item_cherry.png",
|
||||||
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, door=1},
|
groups = {node=1, choppy=2, oddly_breakable_by_hand=2, flammable=2, door=1},
|
||||||
sounds = default.node_sound_wood_defaults(),
|
sounds = default.node_sound_wood_defaults(),
|
||||||
recipe = {
|
recipe = {
|
||||||
{"", "", ""},
|
{"", "", ""},
|
||||||
@ -655,10 +735,10 @@ if minetest.get_modpath("darkage") then
|
|||||||
"door3_prison",
|
"door3_prison",
|
||||||
{
|
{
|
||||||
tiles = { "doors_door3_prison.png" },
|
tiles = { "doors_door3_prison.png" },
|
||||||
description = "Prison Door 3 Nodes",
|
description = S("Prison Door 3 Nodes"),
|
||||||
inventory_image = "doors3_item_prison.png",
|
inventory_image = "doors3_item_prison.png",
|
||||||
protected = true,
|
protected = true,
|
||||||
groups = {cracky = 1, level = 2},
|
groups = {node = 1, cracky = 1, level = 2},
|
||||||
sounds = default.node_sound_metal_defaults(),
|
sounds = default.node_sound_metal_defaults(),
|
||||||
sound_open = "doors_steel_door_open",
|
sound_open = "doors_steel_door_open",
|
||||||
sound_close = "doors_steel_door_close",
|
sound_close = "doors_steel_door_close",
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user