forked from MineClone5/MineClone5
Disable compass+clock updates in Nether, End, Void
This commit is contained in:
parent
c97a14e969
commit
c7fc3845c1
|
@ -1,3 +1,4 @@
|
||||||
mcl_core
|
mcl_init
|
||||||
|
mcl_util
|
||||||
mesecons
|
mesecons
|
||||||
doc?
|
doc?
|
||||||
|
|
|
@ -76,6 +76,9 @@ minetest.register_globalstep(function(dtime)
|
||||||
local players = minetest.get_connected_players()
|
local players = minetest.get_connected_players()
|
||||||
for p, player in ipairs(players) do
|
for p, player in ipairs(players) do
|
||||||
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)
|
||||||
|
-- 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()
|
local count = stack:get_count()
|
||||||
if stack:get_name() == mcl_clock.stereotype then
|
if stack:get_name() == mcl_clock.stereotype then
|
||||||
player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..now.." "..count)
|
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
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Immediately set correct clock time after crafting
|
-- Immediately set correct clock time after crafting
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
mcl_core
|
mcl_core
|
||||||
|
mcl_util
|
||||||
mesecons
|
mesecons
|
||||||
doc?
|
doc?
|
||||||
|
|
|
@ -26,6 +26,9 @@ minetest.register_globalstep(function(dtime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local pos = player:getpos()
|
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 dir = player:get_look_horizontal()
|
||||||
local angle_north = math.deg(math.atan2(spawn.x - pos.x, spawn.z - pos.z))
|
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
|
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
|
end
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local images = {}
|
local images = {}
|
||||||
|
|
Loading…
Reference in New Issue