Set Minecraft sleeping times for bed

This commit is contained in:
Wuzzy 2017-02-21 02:53:32 +01:00
parent 6e9b23eb12
commit 93cbabc61e

@ -129,15 +129,16 @@ function beds.kick_players()
end end
function beds.skip_night() function beds.skip_night()
minetest.set_timeofday(0.23) minetest.set_timeofday(0.25) -- tod = 6000
end end
function beds.on_rightclick(pos, player) function beds.on_rightclick(pos, player)
local name = player:get_player_name() local name = player:get_player_name()
local ppos = player:getpos() local ppos = player:getpos()
local tod = minetest.get_timeofday() local tod = minetest.get_timeofday() * 24000
if tod > 0.2 and tod < 0.805 then -- Values taken from Minecraft Wiki with offset of +6000
if tod < 18541 and tod > 5458 then
if beds.player[name] then if beds.player[name] then
lay_down(player, nil, nil, false) lay_down(player, nil, nil, false)
end end