parent
d78d07589d
commit
7ea41df5d9
|
@ -477,6 +477,28 @@ function wagon:on_step(dtime)
|
|||
self.object:setpos(actual_pos)
|
||||
self.object:setvelocity(velocityvec)
|
||||
self.object:setacceleration(accelerationvec)
|
||||
|
||||
if #self.seats > 0 and self.old_yaw ~= yaw then
|
||||
if not self.player_yaw then
|
||||
self.player_yaw = {}
|
||||
end
|
||||
for _,name in pairs(self.seatp) do
|
||||
local p = minetest.get_player_by_name(name)
|
||||
if p then
|
||||
if not self.turning then
|
||||
-- save player looking direction offset
|
||||
self.player_yaw[name] = p:get_look_horizontal()-self.old_yaw
|
||||
end
|
||||
-- set player looking direction using calculated offset
|
||||
p:set_look_horizontal(self.player_yaw[name]+yaw)
|
||||
end
|
||||
end
|
||||
self.turning = true
|
||||
elseif self.old_yaw == yaw then
|
||||
-- train is no longer turning
|
||||
self.turning = false
|
||||
end
|
||||
|
||||
self.object:setyaw(yaw)
|
||||
self.updatepct_timer=2
|
||||
if self.update_animation then
|
||||
|
|
Loading…
Reference in New Issue