mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-06 18:08:26 +00:00
fix: prevent unnecessary jump when using !r or switching to TAS
This commit is contained in:
parent
158edbe158
commit
7e1c3f0dc3
@ -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])
|
||||
@ -294,7 +316,6 @@ public void Shavit_OnLeaveZone(int client, int type, int track, int id, int enti
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int FindMenuItem(Menu menu, const char[] info)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user