mirror of
https://github.com/APercy/automobiles_pck
synced 2025-11-15 19:27:59 +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
|
if stop ~= true then
|
||||||
--self.object:set_velocity(velocity)
|
--self.object:set_velocity(velocity)
|
||||||
if player then
|
|
||||||
automobiles_lib.attach_driver(self, player)
|
|
||||||
end
|
|
||||||
self.object:set_acceleration(accel)
|
self.object:set_acceleration(accel)
|
||||||
else
|
else
|
||||||
if stop == true then
|
if stop == true then
|
||||||
|
|||||||
@ -646,9 +646,6 @@ minetest.register_entity("automobiles_coupe:coupe", {
|
|||||||
|
|
||||||
if stop ~= true then
|
if stop ~= true then
|
||||||
--self.object:set_velocity(velocity)
|
--self.object:set_velocity(velocity)
|
||||||
if player then
|
|
||||||
automobiles_lib.attach_driver(self, player)
|
|
||||||
end
|
|
||||||
self.object:set_acceleration(accel)
|
self.object:set_acceleration(accel)
|
||||||
else
|
else
|
||||||
if stop == true then
|
if stop == true then
|
||||||
|
|||||||
@ -79,13 +79,26 @@ function automobiles_lib.attach_driver(self, player)
|
|||||||
end
|
end
|
||||||
player:set_eye_offset({x = 0, y = eye_y, z = 0}, {x = 0, y = eye_y, z = -30})
|
player:set_eye_offset({x = 0, y = eye_y, z = 0}, {x = 0, y = eye_y, z = -30})
|
||||||
player_api.player_attached[name] = true
|
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()
|
minetest.after(0.2, function()
|
||||||
player = minetest.get_player_by_name(name)
|
player = minetest.get_player_by_name(name)
|
||||||
if player then
|
if player then
|
||||||
--player:set_properties({physical=false})
|
local speed = 30.01
|
||||||
player_api.set_animation(player, "sit")
|
local mesh = player:get_properties().mesh
|
||||||
--apply_physics_override(player, {speed=0,gravity=0,jump=0})
|
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)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
name = automobiles_lib
|
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
|
if stop ~= true then
|
||||||
--self.object:set_velocity(velocity)
|
--self.object:set_velocity(velocity)
|
||||||
if player then
|
|
||||||
automobiles_lib.attach_driver(self, player)
|
|
||||||
end
|
|
||||||
self.object:set_acceleration(accel)
|
self.object:set_acceleration(accel)
|
||||||
else
|
else
|
||||||
if stop == true then
|
if stop == true then
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user