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:
parent
55189a57f8
commit
d0edf57d46
@ -258,7 +258,7 @@ function beds.on_rightclick(pos, player)
|
|||||||
local ppos = player:get_pos()
|
local ppos = player:get_pos()
|
||||||
local tod = minetest.get_timeofday()
|
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
|
if beds.player[name] then
|
||||||
lay_down(player, nil, nil, false)
|
lay_down(player, nil, nil, false)
|
||||||
|
@ -41,6 +41,11 @@ beds.is_50 = is_50
|
|||||||
beds.is_53 = is_53
|
beds.is_53 = is_53
|
||||||
beds.is_54 = is_54
|
beds.is_54 = is_54
|
||||||
|
|
||||||
|
beds.day_interval = {
|
||||||
|
start = 0.2,
|
||||||
|
finish = 0.805,
|
||||||
|
}
|
||||||
|
|
||||||
local modpath = minetest.get_modpath("beds")
|
local modpath = minetest.get_modpath("beds")
|
||||||
|
|
||||||
-- check for minetest 5.x/0.4 compatibility
|
-- check for minetest 5.x/0.4 compatibility
|
||||||
|
Loading…
x
Reference in New Issue
Block a user