1
0
Fork 0

Update cart direction after punch

This commit is contained in:
Wuzzy 2017-08-15 14:02:21 +02:00
parent 73ae5eb940
commit 9bae398946
1 changed files with 16 additions and 15 deletions

View File

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