added experimental hand brake activated by spacebar

This commit is contained in:
Alexsandro Percy 2023-12-26 21:48:34 -03:00
parent 95af2b5f2a
commit a18d2cf459
2 changed files with 5 additions and 1 deletions

View File

@ -76,7 +76,7 @@ function automobiles_lib.control(self, dtime, hull_direction, longit_speed, long
end
--break
if ctrl.down then
if ctrl.down or ctrl.jump then
--[[if math.abs(longit_speed) > 0 then
acc = -5 / (longit_speed / 2) -- lets set a brake efficience based on speed
end]]--

View File

@ -381,6 +381,7 @@ function automobiles_lib.on_step(self, dtime)
local dynamic_later_drag = self._LATER_DRAG_FACTOR
if longit_speed > 2 then dynamic_later_drag = 2.0 end
if longit_speed > 8 then dynamic_later_drag = 0.5 end
local later_drag = vector.multiply(nhdir,later_speed*
later_speed*dynamic_later_drag*-1*automobiles_lib.sign(later_speed))
@ -406,6 +407,9 @@ function automobiles_lib.on_step(self, dtime)
local is_breaking = false
if is_attached then
local ctrl = player:get_player_control()
if ctrl.jump then
dynamic_later_drag = 0.2
end
if ctrl.aux1 then
--sets the engine running - but sets a delay also, cause keypress
if self._last_time_command > 0.8 then