Instant rain sound updates when changing dimension
This commit is contained in:
parent
b1d15fb667
commit
6d609be8c7
1 changed files with 12 additions and 0 deletions
|
@ -102,6 +102,18 @@ mcl_weather.rain.remove_player = function(player)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mcl_worlds.register_on_dimension_change(function(player, dimension)
|
||||||
|
if dimension ~= "overworld" and dimension ~= "void" then
|
||||||
|
mcl_weather.rain.remove_sound(player)
|
||||||
|
mcl_weather.rain.remove_player(player)
|
||||||
|
elseif dimension == "overworld" then
|
||||||
|
mcl_weather.rain.update_sound(player)
|
||||||
|
if mcl_weather.rain.raining then
|
||||||
|
mcl_weather.rain.add_player(player)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
-- adds and removes rain sound depending how much rain particles around player currently exist.
|
-- adds and removes rain sound depending how much rain particles around player currently exist.
|
||||||
-- have few seconds delay before each check to avoid on/off sound too often
|
-- have few seconds delay before each check to avoid on/off sound too often
|
||||||
-- when player stay on 'edge' where sound should play and stop depending from random raindrop appearance.
|
-- when player stay on 'edge' where sound should play and stop depending from random raindrop appearance.
|
||||||
|
|
Reference in a new issue