mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 14:16:06 +02:00
Removed all whitespaces (using new script)
This commit is contained in:
@ -15,36 +15,36 @@ local max_frequency_all = 1000 --the larger you make this number the lest freque
|
||||
|
||||
--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_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.6
|
||||
local day_volume = 0.6
|
||||
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_volume = 1.0
|
||||
local cave_frequent_frequency = 70 --drops of water dripping
|
||||
local cave_frequent_volume = 1.0
|
||||
local cave_frequent_volume = 1.0
|
||||
local beach_frequency = 20 --seagulls
|
||||
local beach_volume = 1.0
|
||||
local beach_volume = 1.0
|
||||
local beach_frequent_frequency = 1000 --waves
|
||||
local beach_frequent_volume = 1.0
|
||||
local beach_frequent_volume = 1.0
|
||||
local water_frequent_frequency = 1000 --water sounds
|
||||
local water_frequent_volume = 1.0
|
||||
local water_frequent_volume = 1.0
|
||||
local desert_frequency = 20 --coyote
|
||||
local desert_volume = 1.0
|
||||
local desert_volume = 1.0
|
||||
local desert_frequent_frequency = 700 --desertwind
|
||||
local desert_frequent_volume = 1.0
|
||||
local desert_frequent_volume = 1.0
|
||||
local swimming_frequent_frequency = 1000 --swimming splashes
|
||||
local swimming_frequent_volume = 1.0
|
||||
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
|
||||
local music_volume = 0.3
|
||||
|
||||
--End of Config
|
||||
----------------------------------------------------------------------------------------------------
|
||||
@ -269,7 +269,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
|
||||
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.find_nodes_in_area(minp, maxp, node_name)
|
||||
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
|
||||
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
|
||||
if #nodes >= threshold then
|
||||
return true
|
||||
@ -277,8 +277,8 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
|
||||
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.find_nodes_in_area(minp, maxp, node_name)
|
||||
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
|
||||
nodes = minetest.find_nodes_in_area(minp, maxp, node_name)
|
||||
-- minetest.chat_send_all("x+Found (" .. node_name .. ": " .. #nodes .. ")")
|
||||
if #nodes >= threshold then
|
||||
return true
|
||||
end
|
||||
@ -286,7 +286,7 @@ local atleast_nodes_in_grid = function(pos, search_distance, height, node_name,
|
||||
-- minetest.chat_send_all("Found total(" .. totalnodes .. ")")
|
||||
if totalnodes >= threshold*2 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
@ -298,11 +298,11 @@ local get_immediate_nodes = function(pos)
|
||||
pos.y = pos.y+3
|
||||
pos.y = pos.y+2.2
|
||||
node_at_upper_body = minetest.get_node(pos).name
|
||||
pos.y = pos.y-1.19
|
||||
pos.y = pos.y-1.19
|
||||
node_at_lower_body = minetest.get_node(pos).name
|
||||
pos.y = pos.y+0.99
|
||||
pos.y = pos.y+0.99
|
||||
--minetest.chat_send_all("node_under_feet(" .. nodename .. ")")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local get_ambience = function(player)
|
||||
@ -315,19 +315,19 @@ local get_ambience = function(player)
|
||||
local player_name = player:get_player_name()
|
||||
if player_name == nil or players_pos[player_name] == nil then return end
|
||||
if players_pos[player_name]["last_x_pos"] ~=pos.x or players_pos[player_name]["last_z_pos"] ~=pos.z then
|
||||
player_is_moving_horiz = true
|
||||
player_is_moving_horiz = true
|
||||
end
|
||||
if pos.y > players_pos[player_name]["last_y_pos"]+.5 then
|
||||
player_is_climbing = true
|
||||
end
|
||||
if pos.y < players_pos[player_name]["last_y_pos"]-.5 then
|
||||
player_is_descending = true
|
||||
player_is_descending = true
|
||||
end
|
||||
|
||||
|
||||
players_pos[player_name]["last_x_pos"] = pos.x
|
||||
players_pos[player_name]["last_z_pos"] = pos.z
|
||||
players_pos[player_name]["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}
|
||||
@ -342,20 +342,20 @@ local get_ambience = function(player)
|
||||
--swimming w, m swimming
|
||||
--walking in water nw, m splashing
|
||||
--treading water w, nm sloshing
|
||||
--standing in water nw, nm beach trumps, then 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
|
||||
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
|
||||
end
|
||||
else--player is not moving: treading water
|
||||
if string.find(node_under_feet, "default:water") then
|
||||
@ -363,25 +363,25 @@ local get_ambience = function(player)
|
||||
return {water_surface=water_surface, music=music}
|
||||
else
|
||||
return {water_surface}
|
||||
end
|
||||
else --didn't find water under feet
|
||||
end
|
||||
else --didn't find water under feet
|
||||
standing_in_water = true
|
||||
end
|
||||
end
|
||||
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
|
||||
-- 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
|
||||
@ -392,7 +392,7 @@ local get_ambience = function(player)
|
||||
-- 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}
|
||||
local minp = {x=pos.x-3,y=pos.y-4, z=pos.z-3}
|
||||
local maxp = {x=pos.x+3,y=pos.y-1, z=pos.z+3}
|
||||
@ -405,19 +405,19 @@ local get_ambience = function(player)
|
||||
-- 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!!!!")
|
||||
-- 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
|
||||
-- end
|
||||
--minetest.chat_send_all("not flying!!!!")
|
||||
--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}
|
||||
return {lava=lava, lava2=lava2, music=music}
|
||||
else
|
||||
return {lava=lava}
|
||||
end
|
||||
@ -428,7 +428,7 @@ local get_ambience = function(player)
|
||||
else
|
||||
return {flowing_water=flowing_water, flowing_water2=flowing_water2}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--if we are near sea level and there is lots of water around the area
|
||||
@ -437,17 +437,17 @@ local get_ambience = function(player)
|
||||
return {beach=beach, beach_frequent=beach_frequent, music=music}
|
||||
else
|
||||
return {beach=beach, beach_frequent=beach_frequent}
|
||||
end
|
||||
end
|
||||
end
|
||||
if standing_in_water then
|
||||
if music then
|
||||
return {water_surface=water_surface, music=music}
|
||||
else
|
||||
return {water_surface}
|
||||
end
|
||||
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
|
||||
@ -456,12 +456,12 @@ local get_ambience = function(player)
|
||||
else
|
||||
return {desert=desert, desert_frequent=desert_frequent}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- pos.y = pos.y-2
|
||||
-- pos.y = pos.y-2
|
||||
-- nodename = minetest.get_node(pos).name
|
||||
-- minetest.chat_send_all("Found " .. nodename .. pos.y )
|
||||
|
||||
|
||||
|
||||
if player:getpos().y < 0 then
|
||||
if music then
|
||||
@ -491,7 +491,7 @@ local play_sound = function(player, list, number, is_music)
|
||||
if list.handler[player_name] == nil then
|
||||
local gain = 1.0
|
||||
if list[number].gain ~= nil then
|
||||
if is_music then
|
||||
if is_music then
|
||||
gain = list[number].gain*soundset.get_gain(player_name, "music")
|
||||
--minetest.chat_send_all("gain music: " .. gain )
|
||||
else
|
||||
@ -666,7 +666,7 @@ local stop_sound = function(still_playing, player)
|
||||
minetest.sound_stop(list.handler[player_name])
|
||||
list.handler[player_name] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if still_playing.lava2 == nil then
|
||||
local list = lava2
|
||||
if list.handler[player_name] ~= nil then
|
||||
@ -676,7 +676,7 @@ local stop_sound = function(still_playing, player)
|
||||
minetest.sound_stop(list.handler[player_name])
|
||||
list.handler[player_name] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if still_playing.water == nil then
|
||||
local list = water
|
||||
if list.handler[player_name] ~= nil then
|
||||
@ -690,7 +690,7 @@ local stop_sound = function(still_playing, player)
|
||||
if still_playing.water_surface == nil then
|
||||
local list = water_surface
|
||||
if list.handler[player_name] ~= nil then
|
||||
if list.on_stop ~= nil then
|
||||
if list.on_stop ~= nil then
|
||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player_name, "ambience")})
|
||||
played_on_start = false
|
||||
end
|
||||
@ -701,9 +701,9 @@ local stop_sound = function(still_playing, player)
|
||||
if still_playing.water_frequent == nil then
|
||||
local list = water_frequent
|
||||
if list.handler[player_name] ~= nil then
|
||||
if list.on_stop ~= nil then
|
||||
if list.on_stop ~= nil then
|
||||
minetest.sound_play(list.on_stop, {to_player=player:get_player_name(),gain=0.5*soundset.get_gain(player_name, "ambience")})
|
||||
-- minetest.chat_send_all("list.on_stop " .. list.on_stop )
|
||||
-- minetest.chat_send_all("list.on_stop " .. list.on_stop )
|
||||
played_on_start = false
|
||||
end
|
||||
minetest.sound_stop(list.handler[player_name])
|
||||
@ -723,7 +723,7 @@ local stop_sound = function(still_playing, player)
|
||||
minetest.sound_stop(list.handler[player_name])
|
||||
list.handler[player_name] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if still_playing.splashing_water == nil then
|
||||
local list = splashing_water
|
||||
if list.handler[player_name] ~= nil then
|
||||
@ -733,8 +733,8 @@ local stop_sound = function(still_playing, player)
|
||||
minetest.sound_stop(list.handler[player_name])
|
||||
list.handler[player_name] = nil
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local timer = 0
|
||||
@ -749,7 +749,7 @@ minetest.register_globalstep(function(dtime)
|
||||
ambiences = get_ambience(player)
|
||||
stop_sound(ambiences, player)
|
||||
for _,ambience in pairs(ambiences) do
|
||||
if math.random(1, 1000) <= ambience.frequency then
|
||||
if math.random(1, 1000) <= ambience.frequency then
|
||||
-- if(played_on_start) then
|
||||
-- -- minetest.chat_send_all("playedOnStart " )
|
||||
-- else
|
||||
@ -762,7 +762,7 @@ minetest.register_globalstep(function(dtime)
|
||||
-- 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()})
|
||||
-- minetest.sound_play(ambience.on_start, {to_player=player:get_player_name()})
|
||||
-- end
|
||||
local is_music =false
|
||||
if ambience.is_music ~= nil then
|
||||
@ -816,8 +816,8 @@ minetest.register_chatcommand("mvol", {
|
||||
MUSICVOLUME = tonumber(param)
|
||||
-- local player = minetest.get_player_by_name(name)
|
||||
-- stop_sound({}, player)
|
||||
-- ambiences = get_ambience(player)
|
||||
-- ambiences = get_ambience(player)
|
||||
minetest.chat_send_player(name, "Music volume set to " .. param .. ".")
|
||||
end, })
|
||||
end, })
|
||||
]]
|
||||
|
||||
|
Reference in New Issue
Block a user