Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update staggersolver #722

Closed
wants to merge 2 commits into from
Closed
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
Binary file modified addons/sourcemod/plugins/optional/staggersolver.smx
Binary file not shown.
72 changes: 48 additions & 24 deletions addons/sourcemod/scripting/staggersolver.sp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public Plugin myinfo =
name = "Super Stagger Solver",
author = "CanadaRox, A1m (fix), Sir (rework), Forgetest",
description = "Blocks all button presses and restarts animations during stumbles",
version = "2.3",
version = "2.4",
url = "https://github.com/SirPlease/L4D2-Competitive-Rework"
};

Expand All @@ -20,19 +20,56 @@ public void L4D_OnShovedBySurvivor_Post(int client, int victim, const float vecD

public void L4D2_OnStagger_Post(int client, int source)
{
// Interesting to note is that this might not be needed.
// Issues might be caused by other plugins messing with the current stagger/anim prior to Post.
// Do with this information what you want.
if (GetClientTeam(client) != 3)
return;
if (GetClientTeam(client) != 3) return;

if (!L4D_IsPlayerStaggering(client))
return;

if (IsTankThrowingRock(client)) // handled by plugin "rock_stumble_block"
return;


PlayerAnimState anim = PlayerAnimState.FromPlayer(client);
if(IsTank(client))
{
if (IsTankThrowingRock(client)) // handled by plugin "rock_stumble_block"
return;

switch (anim.GetMainActivity())
{
case L4D2_ACT_TERROR_HULK_VICTORY,
L4D2_ACT_TERROR_HULK_VICTORY_B,
L4D2_ACT_TERROR_RAGE_AT_ENEMY,
L4D2_ACT_TERROR_RAGE_AT_KNOCKDOWN:
{
SetEntPropFloat(client, Prop_Send, "m_flCycle", 1.0);
}
case L4D2_ACT_TERROR_CLIMB_24_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_36_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_48_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_50_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_60_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_70_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_72_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_84_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_96_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_108_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_115_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_120_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_130_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_132_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_144_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_150_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_156_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_166_FROM_STAND,
L4D2_ACT_TERROR_CLIMB_168_FROM_STAND:
{
return;
}
default:
{
anim.ResetMainActivity();
}
}

return;
}

switch (anim.GetMainActivity())
{
Expand Down Expand Up @@ -73,9 +110,6 @@ public Action OnPlayerRunCmd(int client, int &buttons)

bool IsTankThrowingRock(int client)
{
if (!IsTank(client))
return false;

int ability = GetEntPropEnt(client, Prop_Send, "m_customAbility");
if (ability == -1)
return false;
Expand All @@ -85,14 +119,7 @@ bool IsTankThrowingRock(int client)

bool IsTank(int client)
{
static int s_iTankClass = -1;
if (s_iTankClass == -1)
{
s_iTankClass = L4D_IsEngineLeft4Dead() ? 5 : 8;
}

return GetClientTeam(client) == 3
&& GetEntProp(client, Prop_Send, "m_zombieClass") == s_iTankClass;
return GetEntProp(client, Prop_Send, "m_zombieClass") == 8;
}

bool CThrow__IsActive(int ability)
Expand All @@ -117,9 +144,6 @@ CountdownTimer CThrow__GetThrowTimer(int ability)

bool CThrow__SelectingTankAttack(int ability)
{
if (L4D_IsEngineLeft4Dead())
return false;

static int s_iOffs_m_bSelectingAttack = -1;
if (s_iOffs_m_bSelectingAttack == -1)
s_iOffs_m_bSelectingAttack = FindSendPropInfo("CThrow", "m_hasBeenUsed") + 28;
Expand Down
Loading