Update cart direction after punch

This commit is contained in:
Wuzzy 2017-08-15 14:02:21 +02:00
parent 73ae5eb940
commit 9bae398946

View file

@ -229,19 +229,12 @@ function mcl_minecarts.cart:on_step(dtime)
end
end
if self._punched then
self._punched = false
end
-- Give achievement when player reached a distance of 1000 nodes from the start position
if self._driver and (vector.distance(self._start_pos, pos) >= 1000) then
awards.unlock(self._driver, "mcl:onARail")
end
if not (update.vel or update.pos) then
return
end
if update.pos or self._punched then
local yaw = 0
if dir.x < 0 then
yaw = 0.5
@ -250,10 +243,18 @@ function mcl_minecarts.cart:on_step(dtime)
elseif dir.z < 0 then
yaw = 1
end
if update.pos then
self.object:setyaw(yaw * math.pi)
end
if self._punched then
self._punched = false
end
if not (update.vel or update.pos) then
return
end
local anim = {x=0, y=0}
if dir.y == -1 then
anim = {x=1, y=1}