From 54426be30350a7be197e6480049914ad88f720be Mon Sep 17 00:00:00 2001 From: Kistaro Windrider Date: Sun, 14 Jan 2024 20:06:09 -0800 Subject: [PATCH] now it actually works! --- autobrake_test.p8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobrake_test.p8 b/autobrake_test.p8 index b440ba4..4a0a218 100644 --- a/autobrake_test.p8 +++ b/autobrake_test.p8 @@ -177,10 +177,10 @@ function constraints:constrain(s, want) end function brake_dist(v0, brake_max) - local tri_frames = v0\brake_max + local tri_frames = abs(v0\brake_max) local chunks = tri_frames * (tri_frames - 1) >> 1 local chunk_zone = chunks * brake_max - local overage = v0 - tri_frames * brake_max + local overage = abs(v0) - tri_frames * brake_max return (chunk_zone + overage * (tri_frames + 1)) * sgn(v0), (overage > 0) and tri_frames + 1 or tri_frames end