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

357/Python repeatedly starts reload animation if holding down primary attack with prediction enabled #3028

Open
SamVanheer opened this issue Jan 31, 2021 · 1 comment

Comments

@SamVanheer
Copy link

If weapon prediction is enabled and if you fire the 357 until it's empty and continue to hold down the primary attack key, the reload animation is started every frame until you let go of the attack key.

This happens because of this code:

halflife/dlls/python.cpp

Lines 170 to 176 in c7240b9

if (!m_fFireOnEmpty)
Reload( );
else
{
EMIT_SOUND(ENT(m_pPlayer->pev), CHAN_WEAPON, "weapons/357_cock1.wav", 0.8, ATTN_NORM);
m_flNextPrimaryAttack = 0.15;
}

If m_fFireOnEmpty is false it immediately tries to reload. This code executes every frame on the client which causes the glitchy animation.

It should instead do what the Glock does:

if (m_fFireOnEmpty)
{
PlayEmptySound();
m_flNextPrimaryAttack = GetNextAttackDelay(0.2);
}

The call to Reload needs to be removed. The weapon will reload automatically as soon as the player lets go of the attack key.

This bug was originally reported as part of #617 but was overlooked.

@pierow
Copy link

pierow commented Sep 12, 2021

This is happening because of issue #3071. m_fFireOnEmpty would be true if iMaxClip() could return the correct value in client side weapons code.

else if ((m_pPlayer->pev->button & IN_ATTACK) && (m_flNextPrimaryAttack <= 0.0))
{
if ( (m_iClip == 0 && pszAmmo1()) || (iMaxClip() == -1 && !m_pPlayer->m_rgAmmo[PrimaryAmmoIndex()] ) )
{
m_fFireOnEmpty = TRUE;
}
PrimaryAttack();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants