mirror of
https://github.com/APercy/automobiles_pck
synced 2025-11-06 07:03:03 +01:00
Fix standing in car bug
This commit is contained in:
parent
df828d566b
commit
2e49602b19
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
name = automobiles_lib
|
||||
depends=biofuel,mobkit
|
||||
depends=biofuel,mobkit,player_api
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user