From 4d547665902acbdd597a31f03d1b562c022fb098 Mon Sep 17 00:00:00 2001 From: kay27 Date: Tue, 5 Jan 2021 00:25:58 +0400 Subject: [PATCH] quick fix of https://git.minetest.land/Wuzzy/MineClone2/issues/954 --- mods/HUD/mcl_experience/init.lua | 2 +- mods/ITEMS/mcl_beds/functions.lua | 2 +- mods/PLAYER/mcl_hunger/hunger.lua | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mods/HUD/mcl_experience/init.lua b/mods/HUD/mcl_experience/init.lua index da2d11f2a..f9f300069 100644 --- a/mods/HUD/mcl_experience/init.lua +++ b/mods/HUD/mcl_experience/init.lua @@ -313,7 +313,7 @@ local function xp_step(self, dtime) pos = self.object:get_pos() pos2 = collector:get_pos() - player_velocity = collector:get_velocity() + player_velocity = collector:get_velocity() or collector:get_player_velocity() pos2.y = pos2.y + 0.8 diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index f7f4ebfc9..917b1123d 100644 --- a/mods/ITEMS/mcl_beds/functions.lua +++ b/mods/ITEMS/mcl_beds/functions.lua @@ -92,7 +92,7 @@ local function lay_down(player, pos, bed_pos, state, skip) -- FIXME: Velocity threshold should be 0.01 but Minetest 5.3.0 -- sometimes reports incorrect Y speed. A velocity threshold -- of 0.125 still seems good enough. - if vector.length(player:get_velocity()) > 0.125 then + if vector.length(player:get_velocity() or player:get_player_velocity()) > 0.125 then minetest.chat_send_player(name, S("You have to stop moving before going to bed!")) return false end diff --git a/mods/PLAYER/mcl_hunger/hunger.lua b/mods/PLAYER/mcl_hunger/hunger.lua index a70d79eb8..393bdc9a9 100644 --- a/mods/PLAYER/mcl_hunger/hunger.lua +++ b/mods/PLAYER/mcl_hunger/hunger.lua @@ -156,7 +156,7 @@ function mcl_hunger.item_eat(hunger_change, replace_with_item, poisontime, poiso -- Special item definition field: _food_particles -- If false, force item to not spawn any food partiles when eaten if def._food_particles ~= false and texture and texture ~= "" then - local v = user:get_velocity() + local v = user:get_velocity() or user:get_player_velocity() local minvel = vector.add(v, {x=-1, y=1, z=-1}) local maxvel = vector.add(v, {x=1, y=2, z=1})