From d0edf57d4660ae1b4f932fd8de8ecaaade244b61 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Thu, 18 Apr 2024 16:44:29 -0400 Subject: [PATCH] Beds: Replace hardcoded values of day interval with constants * backported https://github.com/minetest/minetest_game/pull/2990 * backported commit https://github.com/minetest/minetest_game/commit/2e8ac46120a764cdc6bba6a334215e05ab92bb69 --- mods/beds/functions.lua | 2 +- mods/beds/init.lua | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/mods/beds/functions.lua b/mods/beds/functions.lua index 6e21bfc..5eefa5e 100644 --- a/mods/beds/functions.lua +++ b/mods/beds/functions.lua @@ -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) diff --git a/mods/beds/init.lua b/mods/beds/init.lua index 41a64e3..3ca476a 100644 --- a/mods/beds/init.lua +++ b/mods/beds/init.lua @@ -41,6 +41,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