forked from VoxeLibre/VoxeLibre
Fix hearable rain in Nether and End dimensions
This commit is contained in:
parent
b4f1d2c521
commit
10a0819790
|
@ -45,7 +45,7 @@ rain.add_rain_particles = function(player)
|
|||
rain.last_rp_count = 0
|
||||
for i=rain.particles_count, 1,-1 do
|
||||
local random_pos_x, random_pos_y, random_pos_z = weather.get_random_pos_by_player_look_dir(player)
|
||||
if minetest.get_node_light({x=random_pos_x, y=random_pos_y, z=random_pos_z}, 0.5) == 15 then
|
||||
if weather.is_outdoor({x=random_pos_x, y=random_pos_y, z=random_pos_z}) then
|
||||
rain.last_rp_count = rain.last_rp_count + 1
|
||||
minetest.add_particle({
|
||||
pos = {x=random_pos_x, y=random_pos_y, z=random_pos_z},
|
||||
|
@ -159,6 +159,7 @@ rain.make_weather = function()
|
|||
|
||||
for _, player in ipairs(minetest.get_connected_players()) do
|
||||
if (weather.is_underwater(player) or not mcl_util.has_weather(player:getpos())) then
|
||||
rain.remove_sound(player)
|
||||
return false
|
||||
end
|
||||
rain.add_player(player)
|
||||
|
|
|
@ -38,8 +38,13 @@ weather.get_rand_end_time = function(min_duration, max_duration)
|
|||
end
|
||||
end
|
||||
|
||||
-- Returns true if pos is outdoor.
|
||||
-- Outdoor is defined as any node in the Overworld under open sky.
|
||||
-- FIXME: Nodes below glass also count as “outdoor”, this should not be the case.
|
||||
weather.is_outdoor = function(pos)
|
||||
if minetest.get_node_light({x=pos.x, y=pos.y + 1, z=pos.z}, 0.5) == 15 then
|
||||
local cpos = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local _, dim = mcl_util.y_to_layer(cpos.y)
|
||||
if minetest.get_node_light(cpos, 0.5) == 15 and dim == "overworld" then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
|
Reference in New Issue