forked from VoxeLibre/VoxeLibre
Disable weather in Nether and End and Void
This commit is contained in:
parent
7ade843e29
commit
fe31afc119
|
@ -388,6 +388,28 @@ function mcl_util.layer_to_y(layer, mc_dimension)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Takes a position and returns true if this position can have weather
|
||||||
|
function mcl_util.has_weather(pos)
|
||||||
|
-- Weather in the Overworld and the high part of the void below
|
||||||
|
return pos.y <= mcl_vars.mg_overworld_max and pos.y >= mcl_vars.mg_overworld_min - 64
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Takes a position (pos) and returns true if compasses are working here
|
||||||
|
function mcl_util.compass_works(pos)
|
||||||
|
-- It doesn't work in Nether and the End, but it works in the Overworld and in the high part of the void below
|
||||||
|
local _, dim = mcl_util.y_to_layer(pos.y)
|
||||||
|
if dim ~= "nether" or dim ~= "end" then
|
||||||
|
return false
|
||||||
|
elseif dim == "void" then
|
||||||
|
return pos.y <= mcl_vars.mg_overworld_max and pos.y >= mcl_vars.mg_overworld_min - 64
|
||||||
|
else
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Takes a position (pos) and returns true if clocks are working here
|
||||||
|
mcl_util.clock_works = mcl_util.compass_works
|
||||||
|
|
||||||
-- Returns a on_place function for plants
|
-- Returns a on_place function for plants
|
||||||
-- * condition: function(pos, node)
|
-- * condition: function(pos, node)
|
||||||
-- * A function which is called by the on_place function to check if the node can be placed
|
-- * A function which is called by the on_place function to check if the node can be placed
|
||||||
|
|
|
@ -158,7 +158,7 @@ rain.make_weather = function()
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
if (weather.is_underwater(player)) then
|
if (weather.is_underwater(player) or not mcl_util.has_weather(player:getpos())) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
rain.add_player(player)
|
rain.add_player(player)
|
||||||
|
|
|
@ -73,7 +73,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
|
|
||||||
for _, player in ipairs(minetest.get_connected_players()) do
|
for _, player in ipairs(minetest.get_connected_players()) do
|
||||||
if (weather.is_underwater(player)) then
|
if (weather.is_underwater(player) or not mcl_util.has_weather(player:getpos())) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
snow.add_rain_particles(player)
|
snow.add_rain_particles(player)
|
||||||
|
|
|
@ -91,8 +91,8 @@ minetest.register_globalstep(function(dtime)
|
||||||
for s, stack in ipairs(player:get_inventory():get_list("main")) do
|
for s, stack in ipairs(player:get_inventory():get_list("main")) do
|
||||||
local _, dim = mcl_util.y_to_layer(player:getpos().y)
|
local _, dim = mcl_util.y_to_layer(player:getpos().y)
|
||||||
local frame
|
local frame
|
||||||
-- Clocks do not work in the End, Nether or the Void
|
-- Clocks do not work in certain zones
|
||||||
if dim == "end" or dim == "nether" or dim == "void" then
|
if not mcl_util.clock_works(player:getpos()) then
|
||||||
frame = random_frame
|
frame = random_frame
|
||||||
else
|
else
|
||||||
frame = now
|
frame = now
|
||||||
|
|
|
@ -31,8 +31,8 @@ minetest.register_globalstep(function(dtime)
|
||||||
local pos = player:getpos()
|
local pos = player:getpos()
|
||||||
local _, dim = mcl_util.y_to_layer(pos.y)
|
local _, dim = mcl_util.y_to_layer(pos.y)
|
||||||
local compass_image
|
local compass_image
|
||||||
-- Compasses do not work in the End, Nether or the Void
|
-- Compasses do not work in certain zones
|
||||||
if dim == "end" or dim == "nether" or dim == "void" then
|
if not mcl_util.compass_works(player:getpos()) then
|
||||||
compass_image = random_frame
|
compass_image = random_frame
|
||||||
else
|
else
|
||||||
local spawn = {x=0,y=0,z=0}
|
local spawn = {x=0,y=0,z=0}
|
||||||
|
|
Loading…
Reference in New Issue