mirror of
https://github.com/APercy/automobiles_pck
synced 2025-09-01 01:26:23 +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
|
||||
--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 longit_speed > 0 then
|
||||
acc = -5
|
||||
if (longit_speed + acc) < 0 then
|
||||
acc = longit_speed * -1
|
||||
end
|
||||
end
|
||||
|
||||
if longit_speed < 0 then
|
||||
acc = 5
|
||||
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
|
||||
stop = true
|
||||
end
|
||||
else
|
||||
acc = -5
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,7 @@ function delorean.gravity_auto_correction(self, dtime)
|
||||
--minetest.chat_send_player(self.driver_name, "antes: " .. self._car_gravity)
|
||||
if self._car_gravity > 0 then factor = -1 end
|
||||
local time_correction = (dtime/delorean.ideal_step)
|
||||
local intensity = 1
|
||||
local intensity = 0.2
|
||||
local correction = (intensity*factor) * time_correction
|
||||
--minetest.chat_send_player(self.driver_name, correction)
|
||||
local before_correction = self._car_gravity
|
||||
@ -72,6 +72,7 @@ end
|
||||
function delorean.turn_flight_mode(self)
|
||||
if self._is_flying == 1 then
|
||||
--initial lift
|
||||
self._car_gravity = 5
|
||||
local curr_pos = self.object:get_pos()
|
||||
curr_pos.y = curr_pos.y + 1.5
|
||||
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()
|
||||
if ent then
|
||||
if fields.go_out then
|
||||
|
||||
if ent._passenger then --any pax?
|
||||
local pax_obj = minetest.get_player_by_name(ent._passenger)
|
||||
automobiles_lib.dettach_pax(ent, pax_obj)
|
||||
end
|
||||
|
||||
ent._is_flying = 0
|
||||
automobiles_lib.dettach_driver(ent, player)
|
||||
end
|
||||
if fields.lights then
|
||||
|
Loading…
Reference in New Issue
Block a user