Skip to content

Commit

Permalink
M2 Control: Extend jockey cooldown if stagger is cancelled early
Browse files Browse the repository at this point in the history
Change:
- Plugin now adds remaining stagger time to ability cooldown (jockey only).
  • Loading branch information
jensewe committed Nov 22, 2023
1 parent b71f431 commit 8e43e18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Binary file modified addons/sourcemod/plugins/optional/l4d2_m2_control_eq.smx
Binary file not shown.
13 changes: 13 additions & 0 deletions addons/sourcemod/scripting/l4d2_m2_control_eq.sp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,16 @@ void Event_PlayerShoved(Event hEvent, const char[] eName, bool dontBroadcast)
SetEntPropFloat(shover, Prop_Send, "m_flNextShoveTime", CalcNextShoveTime(penalty, minPenalty, maxPenalty) - eps);
}

float g_flStaggerEndTime;
public Action L4D_OnCancelStagger(int client)
{
g_flStaggerEndTime = GetEntPropFloat(client, Prop_Send, "m_staggerTimer", 1);
if (g_flStaggerEndTime <= 0.0 || g_flStaggerEndTime <= GetGameTime())
g_flStaggerEndTime = -1.0;

return Plugin_Continue;
}

public void L4D_OnCancelStagger_Post(int client)
{
if (IsInfected(client) && IsPlayerAlive(client) && !L4D_IsPlayerGhost(client))
Expand All @@ -139,6 +149,9 @@ public void L4D_OnCancelStagger_Post(int client)
case L4D2Infected_Jockey: {
recharge = hLeapIntervalCvar.FloatValue;
bAttacking = GetEntPropEnt(client, Prop_Send, "m_jockeyVictim") != -1;

if (g_flStaggerEndTime != -1.0)
recharge += g_flStaggerEndTime - GetGameTime();
}
default: {
return;
Expand Down

0 comments on commit 8e43e18

Please sign in to comment.