fix: prevent unnecessary jump when using !r or switching to TAS
Some checks failed
Compile / Build SM ${{ matrix.sm-version }} (1.12) (push) Has been cancelled
Compile / Release (push) Has been cancelled

This commit is contained in:
rtldg 2025-04-27 00:53:15 +00:00
parent 158edbe158
commit 7e1c3f0dc3

View File

@ -56,6 +56,7 @@ float g_fPower[MAXPLAYERS + 1] = {1.0, ...};
bool gB_AutogainBasicStrafer[MAXPLAYERS + 1];
bool gB_ForceJump[MAXPLAYERS+1];
int gI_LastRestart[MAXPLAYERS+1];
ConVar sv_airaccelerate = null;
ConVar sv_accelerate = null;
@ -251,6 +252,11 @@ public Action Shavit_OnStart(int client, int track)
return Plugin_Continue;
}
public void Shavit_OnRestart(int client, int track)
{
gI_LastRestart[client] = GetGameTickCount();
}
public void Shavit_OnEnterZone(int client, int type, int track, int id, int entity, int data)
{
if (!IsValidClient(client, true) || IsFakeClient(client))
@ -269,6 +275,11 @@ public void Shavit_OnEnterZone(int client, int type, int track, int id, int enti
public void Shavit_OnLeaveZone(int client, int type, int track, int id, int entity, int data)
{
if (type != Zone_Start)
{
return;
}
if (!IsValidClient(client, true) || IsFakeClient(client))
{
return;
@ -284,8 +295,19 @@ public void Shavit_OnLeaveZone(int client, int type, int track, int id, int enti
return;
}
if (type == Zone_Start)
// You can be inside multiple startzones...
if (Shavit_InsideZone(client, type, track))
{
return;
}
// Shavit_OnLeaveZone() will be called a couple times because of the shavit-zones event-clearing thing that happens on restart.
// 5 is a good value that works, but we'll use 6 just-in-case.
if (GetGameTickCount() - gI_LastRestart[client] < 6)
{
return;
}
if (GetEntityFlags(client) & FL_ONGROUND)
{
if (gB_AutoJumpOnStart[client])
@ -293,7 +315,6 @@ public void Shavit_OnLeaveZone(int client, int type, int track, int id, int enti
gB_ForceJump[client] = true;
}
}
}
}
int FindMenuItem(Menu menu, const char[] info)