Add default.is_day() and use it
parent
fb20e626f9
commit
52b2a16255
|
@ -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
|
||||
|
|
|
@ -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
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue