Address review comments

This commit is contained in:
teknomunk 2024-06-26 06:52:10 -05:00
parent 94981d9c09
commit bb9ed4498b

@ -61,15 +61,13 @@ local function xp_step(self, dtime)
if multiplier < 1 then if multiplier < 1 then
multiplier = 1 multiplier = 1
end end
local goal = vector.multiply(direction,multiplier)
local currentvel = self.object:get_velocity() local currentvel = self.object:get_velocity()
if distance > 1 then if distance > 1 then
multiplier = 20 - distance multiplier = 20 - distance
local velocity = vector.multiply(direction,multiplier) local velocity = vector.multiply(direction, multiplier)
goal = velocity local acceleration = vector.new(velocity.x - currentvel.x, velocity.y - currentvel.y, velocity.z - currentvel.z)
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))
self.object:add_velocity(vector.add(acceleration,player_velocity))
elseif distance < 0.8 then elseif distance < 0.8 then
mcl_experience.add_xp(collector, self._xp) mcl_experience.add_xp(collector, self._xp)
self.object:remove() self.object:remove()
@ -91,9 +89,10 @@ local function xp_step(self, dtime)
local pos = self.object:get_pos() local pos = self.object:get_pos()
if not pos then return end if not pos then return end
-- Get the node directly below the XP orb
local node = minetest.get_node_or_nil({ local node = minetest.get_node_or_nil({
x = pos.x, 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 z = pos.z
}) })