From 49949e2f36b8eff7d50aecd79e919e2d24d92837 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 11 Feb 2019 16:14:08 +0100 Subject: [PATCH] Don't allow to go to bed while player moves --- mods/ITEMS/mcl_beds/functions.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index b1eaa85a25..f763a23c98 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -71,6 +71,14 @@ local function lay_down(player, pos, bed_pos, state, skip) return end + -- No sleeping while moving. This is a workaround. + -- TODO: Ideally, the player speed should be force-set to 0, + -- but this is not possible in Minetest 0.4.17. + if vector.length(player:get_player_velocity()) > 0.001 then + minetest.chat_send_player(name, "You have to stop moving before going to bed!") + return + end + -- No sleeping if monsters nearby. -- The exceptions above apply. -- Zombie pigmen only prevent sleep while they are hostle.