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

[HL] Glitchy Hivehand #556

Open
Matthaiks opened this issue Feb 23, 2013 · 5 comments
Open

[HL] Glitchy Hivehand #556

Matthaiks opened this issue Feb 23, 2013 · 5 comments

Comments

@Matthaiks
Copy link

This is an old bug. The Hivehand sometimes behaves oddly when its magazine is empty.

In this video there are 3 examples. The first one seems rather normal. Check it out:

http://youtu.be/R4alKH4uEpQ

@di57inct
Copy link

I think this is the same kind of bug with the shotguns on CS and CZ that I just posted beneath(#555).

@ghost ghost self-assigned this Feb 23, 2013
@LevShisterov
Copy link

@Matthaiks, can you give text description?

@Matthaiks
Copy link
Author

Occasionally, there is a problem with sound when one shoots during hornets regeneration (and ammo counter shows 0). Sometimes there is a sound glitch, sometimes there are no sound and movement at all (except hornets).

@SamVanheer
Copy link

Most likely caused by #1621 due to the client hitting the <= 0 condition before the server does, resulting in the client simulating the attack twice instead of once.

SamVanheer added a commit to twhl-community/halflife-updated that referenced this issue Feb 21, 2022
@SamVanheer
Copy link

These bugs happen because the client is also simulating the ammo regeneration and not properly synchronizing the ammo value with the server. Because the reload time variable is an absolute time value it will vary and cause inconsistent regeneration intervals.

These bugs can be mostly fixed by making the following changes.

Change these lines:

if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)

if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0)

To this:

if (m_pPlayer->ammo_hornets <= 0)

Change this function:

halflife/dlls/hornetgun.cpp

Lines 265 to 275 in c7240b9

void CHgun::Reload( void )
{
if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] >= HORNET_MAX_CARRY)
return;
while (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time)
{
m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++;
m_flRechargeTime += 0.5;
}
}

To this:

void CHgun::Reload( void )
{
#ifndef CLIENT_DLL
	if (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] >= HORNET_MAX_CARRY)
		return;

	while (m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] < HORNET_MAX_CARRY && m_flRechargeTime < gpGlobals->time)
	{
		m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType]++;
		m_flRechargeTime += 0.5;
	}

	m_pPlayer->TabulateAmmo();
#endif
}

I say mostly because with high ping the attack animation will sometimes not play. This is because the client isn't simulating ammo regeneration so the client thinks it's out of ammo. I tried to implement that, but it caused the client to simulate attacks at a higher rate than the server so i opted for this instead.

hammermaps added a commit to sohl-modders/Updated-SOHL-1.2 that referenced this issue Apr 24, 2023
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

4 participants