improve delorean flight start

This commit is contained in:
Alexsandro Percy 2024-09-01 04:26:39 -03:00
parent ffc684f3e0
commit 4e61b4f584
2 changed files with 8 additions and 3 deletions

View File

@ -43,9 +43,9 @@ function delorean.control(self, dtime, hull_direction, longit_speed, longit_drag
if not self._is_flying or self._is_flying == 0 then
if longit_speed > 0 then
acc = -5
if (longit_speed + acc) < 0 then
--[[if (longit_speed + acc) < 0 then
acc = longit_speed * -1
end
end]]--
end
if longit_speed < 0 then

View File

@ -69,6 +69,7 @@ function delorean.turn_flight_mode(self)
local curr_pos = self.object:get_pos()
curr_pos.y = curr_pos.y + 1.5
self.object:move_to(curr_pos)
self._start_flight_semaphore = 1 --semaphore to avoid the grouund detection on first loop
end
end
@ -122,7 +123,11 @@ function delorean.set_mode(self, is_attached, curr_pos, velocity, player, dtime)
local noded = automobiles_lib.nodeatpos(automobiles_lib.pos_shift(curr_pos,{y=-0.6}))
if (noded and noded.drawtype ~= 'airlike') then
if noded.drawtype ~= 'liquid' then
self._is_flying = 0
if not self._start_flight_semaphore then --check if the flight started now
self._is_flying = 0
else
self._start_flight_semaphore = nil --set the deactivation to work normally now
end
end
--avoid liquids
if noded.drawtype == 'liquid' then