Add default.is_day() and use it

master
BlockMen 2015-10-21 13:32:27 +02:00
parent fb20e626f9
commit 52b2a16255
2 changed files with 13 additions and 2 deletions

View File

@ -140,7 +140,7 @@ function beds.on_rightclick(pos, player)
local ppos = player:getpos()
local tod = minetest.get_timeofday()
if tod > 0.2 and tod < 0.805 then
if default.is_day() == true then
if beds.player[name] then
lay_down(player, nil, nil, false)
end

View File

@ -207,6 +207,18 @@ function default.dig_up(pos, node, digger)
end
-- Returns true/false based on fixed time range
function default.is_day()
local tod = minetest.get_timeofday()
if tod > 0.2 and tod < 0.805 then
return false
end
return true
end
--
-- Leafdecay
--
@ -344,4 +356,3 @@ minetest.register_abm({
end
end
})