From bb9ed4498b87d4656b04bf5f36505604bbbd86ed Mon Sep 17 00:00:00 2001 From: teknomunk Date: Wed, 26 Jun 2024 06:52:10 -0500 Subject: [PATCH] Address review comments --- mods/HUD/mcl_experience/orb.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mods/HUD/mcl_experience/orb.lua b/mods/HUD/mcl_experience/orb.lua index 3b4c10b42..aa77f00a2 100644 --- a/mods/HUD/mcl_experience/orb.lua +++ b/mods/HUD/mcl_experience/orb.lua @@ -61,15 +61,13 @@ local function xp_step(self, dtime) if multiplier < 1 then multiplier = 1 end - local goal = vector.multiply(direction,multiplier) local currentvel = self.object:get_velocity() if distance > 1 then multiplier = 20 - distance - local velocity = vector.multiply(direction,multiplier) - goal = velocity - local acceleration = vector.new(goal.x-currentvel.x,goal.y-currentvel.y,goal.z-currentvel.z) - self.object:add_velocity(vector.add(acceleration,player_velocity)) + local velocity = vector.multiply(direction, multiplier) + local acceleration = vector.new(velocity.x - currentvel.x, velocity.y - currentvel.y, velocity.z - currentvel.z) + self.object:add_velocity(vector.add(acceleration, player_velocity)) elseif distance < 0.8 then mcl_experience.add_xp(collector, self._xp) self.object:remove() @@ -91,9 +89,10 @@ local function xp_step(self, dtime) local pos = self.object:get_pos() if not pos then return end + -- Get the node directly below the XP orb local node = minetest.get_node_or_nil({ x = pos.x, - y = pos.y -0.25, + y = pos.y - 0.25, -- Orb collision box is +/-0.2, so go a bit below that z = pos.z })