Beds: Replace hardcoded values of day interval with constants

* backported https://github.com/minetest/minetest_game/pull/2990
* backported commit 2e8ac46120
This commit is contained in:
mckaygerhard 2024-04-18 16:42:14 -04:00
parent 1f2b954d9e
commit 14e4c43a21
2 changed files with 6 additions and 1 deletions

View File

@ -258,7 +258,7 @@ function beds.on_rightclick(pos, player)
local ppos = player:get_pos()
local tod = minetest.get_timeofday()
if tod > 0.2 and tod < 0.805 then
if tod > beds.day_interval.start and tod < beds.day_interval.finish then
if beds.player[name] then
lay_down(player, nil, nil, false)

View File

@ -43,6 +43,11 @@ beds.is_50 = is_50
beds.is_53 = is_53
beds.is_54 = is_54
beds.day_interval = {
start = 0.2,
finish = 0.805,
}
local modpath = minetest.get_modpath("beds")
-- check for minetest 5.x/0.4 compatibility