mirror of
https://github.com/APercy/automobiles_pck
synced 2025-09-11 06:16:24 +02:00
inproved stability in flight
This commit is contained in:
parent
abfdf2b153
commit
8f97786e46
@ -40,14 +40,14 @@ function delorean.control(self, dtime, hull_direction, longit_speed, longit_drag
|
|||||||
|
|
||||||
--total stop
|
--total stop
|
||||||
--wheel break
|
--wheel break
|
||||||
if longit_speed > 0 then
|
|
||||||
acc = -5
|
|
||||||
if (longit_speed + acc) < 0 then
|
|
||||||
acc = longit_speed * -1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if not self._is_flying or self._is_flying == 0 then
|
if not self._is_flying or self._is_flying == 0 then
|
||||||
|
if longit_speed > 0 then
|
||||||
|
acc = -5
|
||||||
|
if (longit_speed + acc) < 0 then
|
||||||
|
acc = longit_speed * -1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if longit_speed < 0 then
|
if longit_speed < 0 then
|
||||||
acc = 5
|
acc = 5
|
||||||
if (longit_speed + acc) > 0 then
|
if (longit_speed + acc) > 0 then
|
||||||
@ -57,6 +57,8 @@ function delorean.control(self, dtime, hull_direction, longit_speed, longit_drag
|
|||||||
if math.abs(longit_speed) < 0.2 then
|
if math.abs(longit_speed) < 0.2 then
|
||||||
stop = true
|
stop = true
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
acc = -5
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ function delorean.gravity_auto_correction(self, dtime)
|
|||||||
--minetest.chat_send_player(self.driver_name, "antes: " .. self._car_gravity)
|
--minetest.chat_send_player(self.driver_name, "antes: " .. self._car_gravity)
|
||||||
if self._car_gravity > 0 then factor = -1 end
|
if self._car_gravity > 0 then factor = -1 end
|
||||||
local time_correction = (dtime/delorean.ideal_step)
|
local time_correction = (dtime/delorean.ideal_step)
|
||||||
local intensity = 1
|
local intensity = 0.2
|
||||||
local correction = (intensity*factor) * time_correction
|
local correction = (intensity*factor) * time_correction
|
||||||
--minetest.chat_send_player(self.driver_name, correction)
|
--minetest.chat_send_player(self.driver_name, correction)
|
||||||
local before_correction = self._car_gravity
|
local before_correction = self._car_gravity
|
||||||
@ -72,6 +72,7 @@ end
|
|||||||
function delorean.turn_flight_mode(self)
|
function delorean.turn_flight_mode(self)
|
||||||
if self._is_flying == 1 then
|
if self._is_flying == 1 then
|
||||||
--initial lift
|
--initial lift
|
||||||
|
self._car_gravity = 5
|
||||||
local curr_pos = self.object:get_pos()
|
local curr_pos = self.object:get_pos()
|
||||||
curr_pos.y = curr_pos.y + 1.5
|
curr_pos.y = curr_pos.y + 1.5
|
||||||
self.object:move_to(curr_pos)
|
self.object:move_to(curr_pos)
|
||||||
|
@ -47,12 +47,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
local ent = car_obj:get_luaentity()
|
local ent = car_obj:get_luaentity()
|
||||||
if ent then
|
if ent then
|
||||||
if fields.go_out then
|
if fields.go_out then
|
||||||
|
|
||||||
if ent._passenger then --any pax?
|
if ent._passenger then --any pax?
|
||||||
local pax_obj = minetest.get_player_by_name(ent._passenger)
|
local pax_obj = minetest.get_player_by_name(ent._passenger)
|
||||||
automobiles_lib.dettach_pax(ent, pax_obj)
|
automobiles_lib.dettach_pax(ent, pax_obj)
|
||||||
end
|
end
|
||||||
|
ent._is_flying = 0
|
||||||
automobiles_lib.dettach_driver(ent, player)
|
automobiles_lib.dettach_driver(ent, player)
|
||||||
end
|
end
|
||||||
if fields.lights then
|
if fields.lights then
|
||||||
|
Loading…
Reference in New Issue
Block a user