Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion addons/sourcemod/scripting/include/shavit/core.inc
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ enum struct timer_snapshot_t
float fLastAngle;

// Internal int used for the iMeasuredJumps & iPerfectJumps stuff.
int iLandingTick;
// How many ticks the player has been on the ground since landing. 0 = in air.
int iGroundTicks;
// Internal value used for unfucking style/zone gravity when using ladders.
MoveType iLastMoveType;
// Internal value used for blocking +strafe (if block_pstrafe is enabled).
Expand Down
20 changes: 15 additions & 5 deletions addons/sourcemod/scripting/shavit-core.sp
Original file line number Diff line number Diff line change
Expand Up @@ -3347,7 +3347,6 @@ void BuildSnapshot(int client, timer_snapshot_t snapshot)
snapshot = gA_Timers[client];
snapshot.fServerTime = GetEngineTime();
snapshot.fTimescale = (gA_Timers[client].fTimescale > 0.0) ? gA_Timers[client].fTimescale : 1.0;
//snapshot.iLandingTick = ?????; // TODO: Think about handling segmented scroll? /shrug
}

public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
Expand Down Expand Up @@ -3698,7 +3697,6 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3

if(bOnGround && !gA_Timers[client].bOnGround)
{
gA_Timers[client].iLandingTick = tickcount;
gI_FirstTouchedGroundForStartTimer[client] = tickcount;

if (gEV_Type != Engine_TF2 && GetStyleSettingBool(gA_Timers[client].bsStyle, "easybhop"))
Expand All @@ -3708,19 +3706,31 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
}
else if (!bOnGround && gA_Timers[client].bOnGround && gA_Timers[client].bJumped && !gA_Timers[client].bClientPaused)
{
int iDifference = (tickcount - gA_Timers[client].iLandingTick);
int iGroundTicks = gA_Timers[client].iGroundTicks;

if (iDifference < 10)
if (iGroundTicks < 10)
{
gA_Timers[client].iMeasuredJumps++;

if (iDifference == 1)
if (iGroundTicks == 1)
{
gA_Timers[client].iPerfectJumps++;
}
}
}

if (bOnGround)
{
if (!gA_Timers[client].bOnGround)
gA_Timers[client].iGroundTicks = 1; // landing frame
else
gA_Timers[client].iGroundTicks++;
}
else
{
gA_Timers[client].iGroundTicks = 0;
}

// This can be bypassed by spamming +duck on CSS which causes `iGroundEntity` to be `-1` here...
// (e.g. an autobhop + velocity_limit style...)
// m_hGroundEntity changes from 0 -> -1 same tick which causes problems and I'm not sure what the best way / place to handle that is...
Expand Down
Loading