From 14e4c43a215e29c465494242175dca765dd36ac0 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Thu, 18 Apr 2024 16:42:14 -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 543e392..0b6e12d 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 97d86f1..5794094 100644 --- a/mods/beds/init.lua +++ b/mods/beds/init.lua @@ -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