Fix possible boat crash

This commit is contained in:
Wuzzy 2023-02-06 11:07:21 +01:00
parent 7ca094f4dd
commit 7e82b8f2ce

View File

@ -105,7 +105,7 @@ local register_boat = function(name, def)
if self._driver then if self._driver then
if not self._driver:is_player() then if not self._driver:is_player() then
self._driver = nil self._driver = nil
end else
local ctrl = self._driver:get_player_control() local ctrl = self._driver:get_player_control()
if ctrl.left and not ctrl.right then if ctrl.left and not ctrl.right then
yaw = yaw + YAW_CHANGE_RATE * dtime yaw = yaw + YAW_CHANGE_RATE * dtime
@ -122,6 +122,7 @@ local register_boat = function(name, def)
end end
end end
end end
end
local get_horvel = function(v, yaw) local get_horvel = function(v, yaw)
local x = -math.sin(yaw) * v local x = -math.sin(yaw) * v
local z = math.cos(yaw) * v local z = math.cos(yaw) * v