Replace deprecated functions with newer ones (#6)

This commit is contained in:
David Leal 2022-11-26 22:11:54 -06:00 committed by GitHub
parent 2530938f6e
commit b78b6dda43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -130,11 +130,6 @@ function lib_mount.attach(entity, player, is_passenger, passenger_number)
entity.player_rotation = {x=0, y=0, z=0}
end
local rot_view = 0
if entity.player_rotation.y == 90 then
rot_view = math.pi/2
end
if is_passenger == true and passenger_number == 1 then
if not entity.passenger_attach_at then
entity.passenger_attach_at = {x=0, y=0, z=0}
@ -196,7 +191,7 @@ function lib_mount.attach(entity, player, is_passenger, passenger_number)
minetest.after(0.2, function()
player_api.set_animation(player, "sit", 30)
end)
player:set_look_horizontal(entity.object:get_yaw() - rot_view)
player:set_look_horizontal(entity.object:get_yaw() + math.rad(90))
end
function lib_mount.detach(player, offset)
@ -231,9 +226,9 @@ function lib_mount.drive(entity, dtime, is_mob, moving_anim, stand_anim, jump_he
jump_height = 0
end
local rot_steer, rot_view = math.pi/2, 0
local rot_steer, rot_view = math.pi/2, 0 -- luacheck: ignore
if entity.player_rotation.y == 90 then
rot_steer, rot_view = 0, math.pi/2
rot_steer, rot_view = 0, math.pi/2 -- luacheck: ignore
end
local acce_y = 0
@ -271,7 +266,7 @@ function lib_mount.drive(entity, dtime, is_mob, moving_anim, stand_anim, jump_he
entity.object:set_yaw(entity.object:get_yaw()-get_sign(entity.v)*math.rad(1+dtime)*entity.turn_spd)
end
else
entity.object:set_yaw(entity.driver:get_look_yaw() - rot_steer)
entity.object:set_yaw(entity.driver:get_look_yaw() + math.rad(90))
end
if ctrl.jump then
if jump_height > 0 and velo.y == 0 then