From aef89e9bb4c016cface75525ed9bc2605f20ea49 Mon Sep 17 00:00:00 2001 From: rtldg <55846624+rtldg@users.noreply.github.com> Date: Tue, 18 Jan 2022 17:55:03 +0000 Subject: [PATCH] add awful prestrafe limit thing because tas autoprestrafe on 128 tick goes slightly higher than 290.0 --- addons/sourcemod/scripting/shavit-core.sp | 37 ++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/addons/sourcemod/scripting/shavit-core.sp b/addons/sourcemod/scripting/shavit-core.sp index 2751f3bc..0ce1c5d4 100644 --- a/addons/sourcemod/scripting/shavit-core.sp +++ b/addons/sourcemod/scripting/shavit-core.sp @@ -2292,6 +2292,41 @@ TimerStatus GetTimerStatus(int client) return Timer_Running; } +// TODO: remove this one day and properly calculate it because this sucks a lot +float ShittyGetMaxPrestrafe(int client) +{ + static ConVar gCV_PrestrafeLimit = view_as(-1); + + if (gCV_PrestrafeLimit == view_as(-1)) + { + gCV_PrestrafeLimit = FindConVar("shavit_misc_prestrafelimit"); + } + + float tickrate = 1.0 / GetTickInterval(); + float variance = 0.611; + + if (tickrate <= 105.0) + { + variance = 0.000; + } + else if (tickrate <= 128.0) + { + variance = 0.112; + } + else if (tickrate <= 200.0) + { + variance = 0.322; + } + else if (tickrate <= 500.0) + { + variance = 0.543; + } + + float runspeed = GetStyleSettingFloat(gA_Timers[client].bsStyle, "runspeed"); + float prestrafelimit = gCV_PrestrafeLimit ? gCV_PrestrafeLimit.FloatValue : 30.0; + return runspeed + prestrafelimit + variance; +} + void StartTimer(int client, int track) { if(!IsValidClient(client, true) || GetClientTeam(client) < 2 || IsFakeClient(client) || !gB_CookiesRetrieved[client]) @@ -2312,7 +2347,7 @@ void StartTimer(int client, int track) if (!nozaxisspeed || GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 1 || - (fSpeed[2] == 0.0 && (GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 2 || curVel <= 290.0))) + (fSpeed[2] == 0.0 && (GetStyleSettingInt(gA_Timers[client].bsStyle, "prespeed") == 2 || curVel <= ShittyGetMaxPrestrafe(client)))) { Action result = Plugin_Continue; Call_StartForward(gH_Forwards_StartPre);