rain volume increased
parent
3c7accffb5
commit
57d7f4ea41
|
@ -28,3 +28,4 @@ dust_effect = true
|
||||||
#Rain Tweaks
|
#Rain Tweaks
|
||||||
rain_particles = 15
|
rain_particles = 15
|
||||||
rain_falling_speed = 15
|
rain_falling_speed = 15
|
||||||
|
rain_sound_gain = 0.35
|
||||||
|
|
42
engine.lua
42
engine.lua
|
@ -26,6 +26,7 @@ climatez.settings = {
|
||||||
rain_particles = tonumber(settings:get("rain_particles")) or 15,
|
rain_particles = tonumber(settings:get("rain_particles")) or 15,
|
||||||
rain_falling_speed = tonumber(settings:get("rain_falling_speed")) or 15,
|
rain_falling_speed = tonumber(settings:get("rain_falling_speed")) or 15,
|
||||||
lightning_duration = tonumber(settings:get("lightning_duration")) or 0.15,
|
lightning_duration = tonumber(settings:get("lightning_duration")) or 0.15,
|
||||||
|
rain_sound_gain = tonumber(settings:get("rain_sound_gain")) or 0.35,
|
||||||
}
|
}
|
||||||
|
|
||||||
local timer = 0 -- A timer to create climates each x seconds an for lightning too.
|
local timer = 0 -- A timer to create climates each x seconds an for lightning too.
|
||||||
|
@ -121,7 +122,7 @@ local function is_on_surface(player_pos)
|
||||||
if not height then
|
if not height then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
if (player_pos.y + 1.5) >= height then
|
if (player_pos.y + 5) >= height then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -237,6 +238,23 @@ local function remove_lightning(player_name)
|
||||||
meta:set_int("climatez:lightning", -1)
|
meta:set_int("climatez:lightning", -1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- raind sounds
|
||||||
|
|
||||||
|
local function start_rain_sound(player_name)
|
||||||
|
local rain_sound_handle = minetest.sound_play("climatez_rain", {
|
||||||
|
to_player = player_name,
|
||||||
|
loop = true,
|
||||||
|
gain = climatez.settings.rain_sound_gain
|
||||||
|
})
|
||||||
|
climatez.players[player_name].rain_sound_handle = rain_sound_handle
|
||||||
|
end
|
||||||
|
|
||||||
|
local function stop_rain_sound(player_name, rain_sound_handle)
|
||||||
|
minetest.sound_stop(rain_sound_handle)
|
||||||
|
climatez.players[player_name].rain_sound_handle = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- CLIMATE PLAYERS FUNCTIONS
|
-- CLIMATE PLAYERS FUNCTIONS
|
||||||
|
|
||||||
local function add_climate_player(player_name, climate_id, downfall_type)
|
local function add_climate_player(player_name, climate_id, downfall_type)
|
||||||
|
@ -281,13 +299,9 @@ local function add_climate_player(player_name, climate_id, downfall_type)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if climatez.settings.climate_rain_sound and (downfall_type == "rain" or downfall_type== "storm") then
|
if climatez.settings.climate_rain_sound and (downfall_type == "rain" or downfall_type== "storm")
|
||||||
local rain_sound_handle = minetest.sound_play("climatez_rain", {
|
and is_on_surface(player:get_pos()) then
|
||||||
to_player = player_name,
|
start_rain_sound(player_name)
|
||||||
loop = true,
|
|
||||||
gain = 1.0,
|
|
||||||
})
|
|
||||||
climatez.players[player_name].rain_sound_handle = rain_sound_handle
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--minetest.chat_send_all(player_name.." added to climate "..tostring(climate_id))
|
--minetest.chat_send_all(player_name.." added to climate "..tostring(climate_id))
|
||||||
|
@ -312,7 +326,7 @@ local function remove_climate_player_effects(player_name)
|
||||||
local rain_sound_handle = climatez.players[player_name].rain_sound_handle
|
local rain_sound_handle = climatez.players[player_name].rain_sound_handle
|
||||||
if rain_sound_handle and climatez.settings.climate_rain_sound
|
if rain_sound_handle and climatez.settings.climate_rain_sound
|
||||||
and (downfall_type == "rain" or downfall_type == "storm") then
|
and (downfall_type == "rain" or downfall_type == "storm") then
|
||||||
minetest.sound_stop(rain_sound_handle)
|
stop_rain_sound(player_name, rain_sound_handle)
|
||||||
end
|
end
|
||||||
|
|
||||||
if downfall_type == "sand" and climatez.settings.dust_effect then
|
if downfall_type == "sand" and climatez.settings.dust_effect then
|
||||||
|
@ -538,6 +552,16 @@ local climate = {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if climatez.settings.climate_rain_sound
|
||||||
|
and (self.downfall_type == "rain" or self.downfall_type == "storm") then
|
||||||
|
local rain_sound_handle = climatez.players[_player_name].rain_sound_handle
|
||||||
|
if rain_sound_handle and not(is_on_surface(_player_pos)) then
|
||||||
|
stop_rain_sound(_player_name, rain_sound_handle)
|
||||||
|
elseif not(rain_sound_handle) and is_on_surface(_player_pos) then
|
||||||
|
start_rain_sound(_player_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--minetest.chat_send_all("Climate created by ".._player_name)
|
--minetest.chat_send_all("Climate created by ".._player_name)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue