Address review comments

This commit is contained in:
teknomunk 2024-06-26 06:52:10 -05:00
parent 94981d9c09
commit bb9ed4498b
1 changed files with 5 additions and 6 deletions

View File

@ -61,14 +61,12 @@ 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)
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)
@ -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
})