From cfc86bcf3dc273c217b1c26d935e12d5e682348f Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Mon, 4 Jan 2021 18:06:31 +0100 Subject: [PATCH] Fix #952 and other occurences of get_player_velocity --- mods/HUD/mcl_experience/init.lua | 20 ++++++++++---------- mods/ITEMS/mcl_beds/functions.lua | 2 +- mods/PLAYER/mcl_hunger/hunger.lua | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/mods/HUD/mcl_experience/init.lua b/mods/HUD/mcl_experience/init.lua index 556f419d4..a443399f8 100644 --- a/mods/HUD/mcl_experience/init.lua +++ b/mods/HUD/mcl_experience/init.lua @@ -163,7 +163,7 @@ minetest.register_on_joinplayer(function(player) name = player:get_player_name() temp_pool = pool[name] - + hud_manager.add_hud(player,"experience_bar", { hud_elem_type = "image", @@ -175,7 +175,7 @@ minetest.register_on_joinplayer(function(player) alignment = { x = 1, y = 1 }, z_index = 11, }) - + hud_manager.add_hud(player,"xp_level", { hud_elem_type = "text", position = {x=0.5, y=1}, @@ -279,7 +279,7 @@ minetest.register_on_dieplayer(function(player) name = player:get_player_name() temp_pool = pool[name] xp_amount = temp_pool.xp - + temp_pool.xp = 0 temp_pool.level = 0 temp_pool.bar, temp_pool.bar_step, temp_pool.xp_next_level = mcl_experience.xp_to_bar(temp_pool.xp, temp_pool.level) @@ -312,11 +312,11 @@ local function xp_step(self, dtime) --get the variables pos = self.object:get_pos() pos2 = collector:get_pos() - - player_velocity = collector:get_player_velocity() - + + player_velocity = collector:get_velocity() + pos2.y = pos2.y + 0.8 - + direction = vector.direction(pos,pos2) distance = vector.distance(pos2,pos) multiplier = distance @@ -413,7 +413,7 @@ local function xp_step(self, dtime) end end - + self.age = self.age + dtime if self.age > max_orb_age then self.object:remove() @@ -598,8 +598,8 @@ function mcl_experience.throw_experience(pos, amount) return false end obj:set_velocity({ - x=math.random(-2,2)*math.random(), - y=math.random(2,5), + x=math.random(-2,2)*math.random(), + y=math.random(2,5), z=math.random(-2,2)*math.random() }) i = i + xp diff --git a/mods/ITEMS/mcl_beds/functions.lua b/mods/ITEMS/mcl_beds/functions.lua index df1a2317b..f7f4ebfc9 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_player_velocity()) > 0.125 then + if vector.length(player:get_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 5a1e34ee3..a70d79eb8 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_player_velocity() + local v = user:get_velocity() local minvel = vector.add(v, {x=-1, y=1, z=-1}) local maxvel = vector.add(v, {x=1, y=2, z=1})