Skip to content

Commit

Permalink
Fix boat flying up and some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
paramat authored and BlockMen committed Aug 7, 2014
1 parent 6967232 commit 5b5aa49
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions mods/boats/init.lua
Expand Up @@ -106,21 +106,21 @@ function boat.on_step(self, dtime)
end
if ctrl.left then
if ctrl.down then
self.object:setyaw(yaw - math.pi / 120 - dtime * math.pi / 120)
self.object:setyaw(yaw - (1 + dtime) * 0.03)
else
self.object:setyaw(yaw + math.pi / 120 + dtime * math.pi / 120)
self.object:setyaw(yaw + (1 + dtime) * 0.03)
end
end
if ctrl.right then
if ctrl.down then
self.object:setyaw(yaw + math.pi / 120 + dtime * math.pi / 120)
self.object:setyaw(yaw + (1 + dtime) * 0.03)
else
self.object:setyaw(yaw - math.pi / 120 - dtime*math.pi/120)
self.object:setyaw(yaw - (1 + dtime) * 0.03)
end
end
end
local velo = self.object:getvelocity()
if self.v == 0 and velo.x == 0 and velo.z == 0 then
if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then
return
end
local s = get_sign(self.v)
Expand All @@ -142,8 +142,10 @@ function boat.on_step(self, dtime)
local nodedef = minetest.registered_nodes[minetest.get_node(p).name]
if (not nodedef) or nodedef.walkable then
self.v = 0
new_acce = {x = 0, y = 1, z = 0}
else
new_acce = {x = 0, y = -9.8, z = 0} -- freefall in air -9.81
end
new_acce = {x = 0, y = -10, z = 0}
new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y)
else
p.y = p.y + 1
Expand All @@ -159,7 +161,7 @@ function boat.on_step(self, dtime)
new_velo = get_velocity(self.v, self.object:getyaw(), y)
else
new_acce = {x = 0, y = 0, z = 0}
if math.abs(self.object:getvelocity().y) < 1 then
if math.abs(self.object:getvelocity().y) <= 2 then
local pos = self.object:getpos()
pos.y = math.floor(pos.y) + 0.5
self.object:setpos(pos)
Expand Down

0 comments on commit 5b5aa49

Please sign in to comment.