Crickets and birds don't sing in rain

This commit is contained in:
Wuzzy 2019-09-21 19:38:34 +02:00
parent 150c0a5627
commit e370e71b37
2 changed files with 15 additions and 0 deletions

View File

@ -1 +1,2 @@
default
weather?

View File

@ -3,6 +3,8 @@
-- By Kaadmy, for Pixture
--
local mod_weather = minetest.get_modpath("weather")
ambiance = {}
ambiance.sounds = {}
@ -16,6 +18,12 @@ ambiance.sounds["birds"] = {
can_play = function(pos)
local tod = (minetest.get_timeofday() or 1) * 2
if mod_weather then
if weather.weather ~= "clear" then
return false
end
end
if tod > 0.47 and tod < 1.53 then -- bit of overlap into crickets
return true
end
@ -33,6 +41,12 @@ ambiance.sounds["crickets"] = {
can_play = function(pos)
local tod = (minetest.get_timeofday() or 1) * 2
if mod_weather then
if weather.weather ~= "clear" then
return false
end
end
if tod < 0.5 or tod > 1.5 then
return true
end