Fix standing in car bug

This commit is contained in:
Johannes Fritz 2022-07-23 18:24:43 -05:00
parent df828d566b
commit 2e49602b19
5 changed files with 18 additions and 14 deletions

View File

@ -618,9 +618,6 @@ minetest.register_entity("automobiles_buggy:buggy", {
if stop ~= true then
--self.object:set_velocity(velocity)
if player then
automobiles_lib.attach_driver(self, player)
end
self.object:set_acceleration(accel)
else
if stop == true then

View File

@ -646,9 +646,6 @@ minetest.register_entity("automobiles_coupe:coupe", {
if stop ~= true then
--self.object:set_velocity(velocity)
if player then
automobiles_lib.attach_driver(self, player)
end
self.object:set_acceleration(accel)
else
if stop == true then

View File

@ -79,13 +79,26 @@ function automobiles_lib.attach_driver(self, player)
end
player:set_eye_offset({x = 0, y = eye_y, z = 0}, {x = 0, y = eye_y, z = -30})
player_api.player_attached[name] = true
-- make the driver sit
-- Make the driver sit
-- Minetest bug: Animation is not always applied on the client.
-- So we try sending it twice.
-- We call set_animation with a speed on the second call
-- so set_animation will not do nothing.
player_api.set_animation(player, "sit")
minetest.after(0.2, function()
player = minetest.get_player_by_name(name)
if player then
--player:set_properties({physical=false})
player_api.set_animation(player, "sit")
--apply_physics_override(player, {speed=0,gravity=0,jump=0})
local speed = 30.01
local mesh = player:get_properties().mesh
if mesh then
local character = player_api.registered_models[mesh]
if character and character.animation_speed then
speed = character.animation_speed + 0.01
end
end
player_api.set_animation(player, "sit", speed)
end
end)
end

View File

@ -1,2 +1,2 @@
name = automobiles_lib
depends=biofuel,mobkit
depends=biofuel,mobkit,player_api

View File

@ -591,9 +591,6 @@ minetest.register_entity("automobiles_roadster:roadster", {
if stop ~= true then
--self.object:set_velocity(velocity)
if player then
automobiles_lib.attach_driver(self, player)
end
self.object:set_acceleration(accel)
else
if stop == true then