mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-16 16:11:06 +01:00
Disable compass+clock updates in Nether, End, Void
This commit is contained in:
parent
c97a14e969
commit
c7fc3845c1
4 changed files with 27 additions and 17 deletions
|
@ -1,3 +1,4 @@
|
|||
mcl_core
|
||||
mcl_init
|
||||
mcl_util
|
||||
mesecons
|
||||
doc?
|
||||
|
|
|
@ -76,6 +76,9 @@ minetest.register_globalstep(function(dtime)
|
|||
local players = minetest.get_connected_players()
|
||||
for p, player in ipairs(players) do
|
||||
for s, stack in ipairs(player:get_inventory():get_list("main")) do
|
||||
local _, dim = mcl_util.y_to_layer(player:getpos().y)
|
||||
-- Clocks do not work in the End, Nether or the Void
|
||||
if dim ~= "end" and dim ~= "nether" and dim ~= "void" then
|
||||
local count = stack:get_count()
|
||||
if stack:get_name() == mcl_clock.stereotype then
|
||||
player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..now.." "..count)
|
||||
|
@ -84,6 +87,7 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- Immediately set correct clock time after crafting
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
mcl_core
|
||||
mcl_util
|
||||
mesecons
|
||||
doc?
|
||||
|
|
|
@ -26,6 +26,9 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
end
|
||||
local pos = player:getpos()
|
||||
local _, dim = mcl_util.y_to_layer(pos.y)
|
||||
-- Compasses do not work in the End, Nether or the Void
|
||||
if dim ~= "end" and dim ~= "nether" and dim ~= "void" then
|
||||
local dir = player:get_look_horizontal()
|
||||
local angle_north = math.deg(math.atan2(spawn.x - pos.x, spawn.z - pos.z))
|
||||
if angle_north < 0 then angle_north = angle_north + 360 end
|
||||
|
@ -42,6 +45,7 @@ minetest.register_globalstep(function(dtime)
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local images = {}
|
||||
|
|
Loading…
Reference in a new issue