1
0
Fork 0

Disable weather in Nether and End and Void

This commit is contained in:
Wuzzy 2017-08-22 18:18:53 +02:00
parent 7ade843e29
commit fe31afc119
5 changed files with 41 additions and 19 deletions

View File

@ -388,6 +388,28 @@ function mcl_util.layer_to_y(layer, mc_dimension)
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
-- * condition: function(pos, node)
-- * A function which is called by the on_place function to check if the node can be placed

View File

@ -158,7 +158,7 @@ rain.make_weather = function()
end
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
end
rain.add_player(player)

View File

@ -73,7 +73,7 @@ minetest.register_globalstep(function(dtime)
end
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
end
snow.add_rain_particles(player)

View File

@ -91,8 +91,8 @@ minetest.register_globalstep(function(dtime)
for s, stack in ipairs(player:get_inventory():get_list("main")) do
local _, dim = mcl_util.y_to_layer(player:getpos().y)
local frame
-- Clocks do not work in the End, Nether or the Void
if dim == "end" or dim == "nether" or dim == "void" then
-- Clocks do not work in certain zones
if not mcl_util.clock_works(player:getpos()) then
frame = random_frame
else
frame = now

View File

@ -31,8 +31,8 @@ minetest.register_globalstep(function(dtime)
local pos = player:getpos()
local _, dim = mcl_util.y_to_layer(pos.y)
local compass_image
-- Compasses do not work in the End, Nether or the Void
if dim == "end" or dim == "nether" or dim == "void" then
-- Compasses do not work in certain zones
if not mcl_util.compass_works(player:getpos()) then
compass_image = random_frame
else
local spawn = {x=0,y=0,z=0}