mirror of
https://github.com/APercy/automobiles_pck
synced 2025-06-15 21:38:02 +02:00
improved motorcycles attachment
This commit is contained in:
parent
9b054df841
commit
5c27a89082
@ -86,8 +86,8 @@ function automobiles_lib.on_rightclick (self, clicker)
|
||||
attach_pax_f(self, clicker, true)
|
||||
end
|
||||
else
|
||||
--there is a passeger
|
||||
--if you are the psenger, so deattach
|
||||
--there is a passenger
|
||||
--if you are the passenger, so deattach
|
||||
local dettach_pax_f = automobiles_lib.dettach_pax
|
||||
if self._dettach_pax then dettach_pax_f = self._dettach_pax end
|
||||
dettach_pax_f(self, clicker)
|
||||
@ -422,7 +422,7 @@ function automobiles_lib.on_step(self, dtime)
|
||||
local player_attach = player:get_attach()
|
||||
if player_attach then
|
||||
if self.driver_seat then
|
||||
if player_attach == self.driver_seat then is_attached = true end
|
||||
if player_attach == self.driver_seat or player_attach == self.object then is_attached = true end
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -725,7 +725,7 @@ function automobiles_lib.on_step(self, dtime)
|
||||
else
|
||||
if self._is_motorcycle then
|
||||
local turn_effect_speed = longit_speed
|
||||
if turn_effect_speed > 10 then turn_effect_speed = 10 end
|
||||
if turn_effect_speed > 20 then turn_effect_speed = 20 end
|
||||
newroll = (-self._steering_angle/100)*(turn_effect_speed/10)
|
||||
|
||||
if is_attached == false and stop == true then
|
||||
|
@ -1,10 +1,14 @@
|
||||
local S = automobiles_lib.S
|
||||
|
||||
function automobiles_lib.getCarFromPlayer(player)
|
||||
function automobiles_lib.getCarFromPlayer(player, self)
|
||||
local seat = player:get_attach()
|
||||
if seat then
|
||||
local car = seat:get_attach()
|
||||
return car
|
||||
if car then
|
||||
return car
|
||||
else
|
||||
return seat
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
@ -186,7 +186,7 @@ minetest.register_entity("automobiles_motorcycle:motorcycle", {
|
||||
_rear_lights = 'automobiles_motorcycle:r_lights',
|
||||
|
||||
_LONGIT_DRAG_FACTOR = 0.14*0.14,
|
||||
_LATER_DRAG_FACTOR = 100.0,
|
||||
_LATER_DRAG_FACTOR = 200.0,
|
||||
_max_acc_factor = 8,
|
||||
_max_speed = 20,
|
||||
_min_later_speed = 5,
|
||||
|
@ -34,9 +34,11 @@ function motorcycle.attach_driver_stand(self, player)
|
||||
--minetest.chat_send_all(dump(self.driver_properties))
|
||||
|
||||
-- attach the driver
|
||||
local x_pos = -4 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
player:set_attach(self.driver_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_eye_offset({x = 0, y = 0, z = 1.5}, {x = 0, y = 3, z = -30})
|
||||
local x_pos = 0 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
--player:set_attach(self.driver_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_attach(self.object, "", self._seat_pos[1], {x = 0, y = 0, z = 0})
|
||||
--player:set_eye_offset({x = 0, y = 0, z = 1.5}, {x = 0, y = 3, z = -30})
|
||||
player:set_eye_offset({x = self._seat_pos[1].x, y = 0, z = self._seat_pos[1].z}, {x = 0, y = 3, z = -30})
|
||||
player_api.player_attached[name] = true
|
||||
|
||||
-- makes it "invisible"
|
||||
@ -122,13 +124,15 @@ function motorcycle.attach_pax_stand(self, player)
|
||||
self._passenger = name
|
||||
|
||||
-- attach the driver
|
||||
local x_pos = -4 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
player:set_attach(self.passenger_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_eye_offset({x = 0, y = 3, z = 0}, {x = 0, y = 3, z = -30})
|
||||
local x_pos = 0 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
--player:set_attach(self.passenger_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_attach(self.object, "", self._seat_pos[2], {x = 0, y = 0, z = 0})
|
||||
--player:set_eye_offset({x = 0, y = 3, z = 0}, {x = 0, y = 3, z = -30})
|
||||
player:set_eye_offset({x = self._seat_pos[2].x, y = 3, z = self._seat_pos[2].z}, {x = 0, y = 3, z = -30})
|
||||
player_api.player_attached[name] = true
|
||||
|
||||
-- makes it "invisible"
|
||||
player:set_properties({mesh = "automobiles_pivot_mesh.b3d", textures = {"automobiles_alpha.png",} })
|
||||
player:set_properties({mesh = "automobiles_pivot_mesh.b3d"})
|
||||
|
||||
--create the dummy mesh
|
||||
local pos = player:get_pos()
|
||||
|
@ -180,7 +180,7 @@ minetest.register_entity("automobiles_vespa:vespa", {
|
||||
_rear_lights = 'automobiles_vespa:r_lights',
|
||||
|
||||
_LONGIT_DRAG_FACTOR = 0.15*0.15,
|
||||
_LATER_DRAG_FACTOR = 100.0,
|
||||
_LATER_DRAG_FACTOR = 200.0,
|
||||
_max_acc_factor = 6,
|
||||
_max_speed = 15,
|
||||
_min_later_speed = 5,
|
||||
|
@ -34,9 +34,11 @@ function vespa.attach_driver_stand(self, player)
|
||||
--minetest.chat_send_all(dump(self.driver_properties))
|
||||
|
||||
-- attach the driver
|
||||
local x_pos = -4 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
player:set_attach(self.driver_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_eye_offset({x = 0, y = 0, z = 1.5}, {x = 0, y = 3, z = -30})
|
||||
local x_pos = 0 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
--player:set_attach(self.driver_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_attach(self.object, "", self._seat_pos[1], {x = 0, y = 0, z = 0})
|
||||
--player:set_eye_offset({x = 0, y = 0, z = 1.5}, {x = 0, y = 3, z = -30})
|
||||
player:set_eye_offset({x = self._seat_pos[1].x, y = 0, z = self._seat_pos[1].z}, {x = 0, y = 3, z = -30})
|
||||
player_api.player_attached[name] = true
|
||||
|
||||
-- makes it "invisible"
|
||||
@ -122,13 +124,15 @@ function vespa.attach_pax_stand(self, player)
|
||||
self._passenger = name
|
||||
|
||||
-- attach the driver
|
||||
local x_pos = -4 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
player:set_attach(self.passenger_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_eye_offset({x = 0, y = 3, z = 0}, {x = 0, y = 3, z = -30})
|
||||
local x_pos = 0 --WHY?! because after the 5.9.1 version the motorcycle got an strange shaking. But when I move it from the center, it ceases. Then I use the camera center bug.
|
||||
--player:set_attach(self.passenger_seat, "", {x = x_pos, y = 0, z = 0}, {x = 0, y = 0, z = 0})
|
||||
player:set_attach(self.object, "", self._seat_pos[2], {x = 0, y = 0, z = 0})
|
||||
--player:set_eye_offset({x = 0, y = 3, z = 0}, {x = 0, y = 3, z = -30})
|
||||
player:set_eye_offset({x = self._seat_pos[2].x, y = 3, z = self._seat_pos[2].z}, {x = 0, y = 3, z = -30})
|
||||
player_api.player_attached[name] = true
|
||||
|
||||
-- makes it "invisible"
|
||||
player:set_properties({mesh = "automobiles_pivot_mesh.b3d", textures = {"automobiles_alpha.png",}})
|
||||
player:set_properties({mesh = "automobiles_pivot_mesh.b3d"})
|
||||
|
||||
--create the dummy mesh
|
||||
local pos = player:get_pos()
|
||||
|
Loading…
Reference in New Issue
Block a user