1
0
mirror of https://github.com/SmallJoker/boost_cart.git synced 2024-12-25 18:30:19 +01:00

Prevent from getting suck in walls while moving up

This commit is contained in:
SmallJoker 2015-03-30 20:49:56 +02:00
parent 159d4ec603
commit 79905e47f4

View File

@ -117,9 +117,11 @@ end
function boost_cart.cart:on_step(dtime) function boost_cart.cart:on_step(dtime)
local vel = self.object:getvelocity() local vel = self.object:getvelocity()
local update = {}
if self.punched then if self.punched then
vel = vector.add(vel, self.velocity) vel = vector.add(vel, self.velocity)
self.object:setvelocity(vel) self.object:setvelocity(vel)
self.old_dir.y = 0
elseif vector.equals(vel, {x=0, y=0, z=0}) then elseif vector.equals(vel, {x=0, y=0, z=0}) then
return return
end end
@ -134,7 +136,6 @@ function boost_cart.cart:on_step(dtime)
end end
end end
local update = {}
local ctrl, player = nil, nil local ctrl, player = nil, nil
if self.driver then if self.driver then
player = minetest.get_player_by_name(self.driver) player = minetest.get_player_by_name(self.driver)