From: paramat Date: Thu, 7 Aug 2014 10:14:27 +0000 (+0200) Subject: Fix boat flying up and some tweaks X-Git-Tag: 0.4.11~59 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=5b5aa493b5c9e30949585e29db4be249462ab756;p=oweals%2Fminetest_game.git Fix boat flying up and some tweaks --- diff --git a/mods/boats/init.lua b/mods/boats/init.lua index 683325de..12126988 100644 --- a/mods/boats/init.lua +++ b/mods/boats/init.lua @@ -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) @@ -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 @@ -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)