mirror of
https://github.com/APercy/automobiles_pck
synced 2025-06-16 13:58:01 +02:00
improve delorean flight start
This commit is contained in:
parent
ffc684f3e0
commit
4e61b4f584
@ -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 not self._is_flying or self._is_flying == 0 then
|
||||||
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
|
||||||
acc = longit_speed * -1
|
acc = longit_speed * -1
|
||||||
end
|
end]]--
|
||||||
end
|
end
|
||||||
|
|
||||||
if longit_speed < 0 then
|
if longit_speed < 0 then
|
||||||
|
@ -69,6 +69,7 @@ function delorean.turn_flight_mode(self)
|
|||||||
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)
|
||||||
|
self._start_flight_semaphore = 1 --semaphore to avoid the grouund detection on first loop
|
||||||
end
|
end
|
||||||
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}))
|
local noded = automobiles_lib.nodeatpos(automobiles_lib.pos_shift(curr_pos,{y=-0.6}))
|
||||||
if (noded and noded.drawtype ~= 'airlike') then
|
if (noded and noded.drawtype ~= 'airlike') then
|
||||||
if noded.drawtype ~= 'liquid' 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
|
end
|
||||||
--avoid liquids
|
--avoid liquids
|
||||||
if noded.drawtype == 'liquid' then
|
if noded.drawtype == 'liquid' then
|
||||||
|
Loading…
Reference in New Issue
Block a user