From a18d2cf4598ac0fb283cefb3bde0e529dbff1612 Mon Sep 17 00:00:00 2001 From: Alexsandro Percy Date: Tue, 26 Dec 2023 21:48:34 -0300 Subject: [PATCH] added experimental hand brake activated by spacebar --- automobiles_lib/control.lua | 2 +- automobiles_lib/entities.lua | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/automobiles_lib/control.lua b/automobiles_lib/control.lua index 9a890b2..a89cfb1 100755 --- a/automobiles_lib/control.lua +++ b/automobiles_lib/control.lua @@ -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]]-- diff --git a/automobiles_lib/entities.lua b/automobiles_lib/entities.lua index ca6334a..4769436 100644 --- a/automobiles_lib/entities.lua +++ b/automobiles_lib/entities.lua @@ -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