Do not rotate a boat while it is attached

Rotating a boat while it is attached to another object does not work as
expected: While the boat does not visually rotate, the head of the
driver rotates as if the boat did actually rotate. That looks wrong,
therefore no rotation must happen if the boat is attached to an object,
e.g. a minecart.
This commit is contained in:
Nils Dagsson Moskopp 2021-08-01 21:01:08 +02:00
parent 93b19d1588
commit 37828b27a0
Signed by untrusted user who does not match committer: erle
GPG Key ID: A3BC671C35191080
1 changed files with 11 additions and 2 deletions

View File

@ -305,13 +305,22 @@ function boat.on_step(self, dtime, moveresult)
self._animation = 0
end
end
if ctrl and ctrl.left then
-- Rotating a boat while it is attached to another
-- object does not work as expected: While the boat
-- does not visually rotate, the head of the driver
-- rotates as if the boat did actually rotate. That
-- looks wrong, therefore no rotation must happen if
-- the boat is attached to an object, e.g. a minecart.
--
-- TODO: Actually rotate boat once someone figures out
-- how to rotate an object attached to another object.
if ctrl and ctrl.left and not self.object:get_attach() then
if self._v < 0 then
self.object:set_yaw(yaw - (1 + dtime) * 0.03 * v_factor)
else
self.object:set_yaw(yaw + (1 + dtime) * 0.03 * v_factor)
end
elseif ctrl and ctrl.right then
elseif ctrl and ctrl.right and not self.object:get_attach() then
if self._v < 0 then
self.object:set_yaw(yaw + (1 + dtime) * 0.03 * v_factor)
else