Skip to content

Commit

Permalink
HL 25th anniversary update satchel changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nekonomicon committed Jan 22, 2024
1 parent 538e3a8 commit 28db0ab
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions dlls/satchel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,31 @@ LINK_ENTITY_TO_CLASS( weapon_satchel, CSatchel )
int CSatchel::AddDuplicate( CBasePlayerItem *pOriginal )
{
CSatchel *pSatchel;
int nNumSatchels, nSatchelsInPocket;
CBaseEntity *pStartEntity;

#if CLIENT_DLL
if( bIsMultiplayer() )
#else
if( g_pGameRules->IsMultiplayer() )
#endif
{
if( !pOriginal->m_pPlayer )
return TRUE;

nNumSatchels = 0;
nSatchelsInPocket = pOriginal->m_pPlayer->m_rgAmmo[pOriginal->PrimaryAmmoIndex()];
pStartEntity = NULL;

while( ( pStartEntity = UTIL_FindEntityInSphere( pStartEntity, pOriginal->m_pPlayer->pev->origin, 4096 )) != NULL )
{
if( FClassnameIs( pStartEntity->pev, "monster_satchel" ))
nNumSatchels += pStartEntity->pev->owner == pOriginal->m_pPlayer->edict();
}

pSatchel = (CSatchel *)pOriginal;

if( pSatchel->m_chargeReady != SATCHEL_IDLE )
if( pSatchel->m_chargeReady != SATCHEL_IDLE || nSatchelsInPocket + nNumSatchels <= SATCHEL_MAX_CARRY - 1 )
{
// player has some satchels deployed. Refuse to add more.
return FALSE;
Expand Down Expand Up @@ -330,14 +345,19 @@ void CSatchel::Holster( int skiplocal /* = 0 */ )
}
}

void CSatchel::PrimaryAttack()
void CSatchel::PrimaryAttack( void )
{
if( m_chargeReady != SATCHEL_RELOAD )
{
Throw();
}
}

void CSatchel::SecondaryAttack()
{
switch( m_chargeReady )
{
case SATCHEL_IDLE:
{
Throw();
}
break;
case SATCHEL_READY:
{
Expand Down Expand Up @@ -370,14 +390,6 @@ void CSatchel::PrimaryAttack()
}
}

void CSatchel::SecondaryAttack( void )
{
if( m_chargeReady != SATCHEL_RELOAD )
{
Throw();
}
}

void CSatchel::Throw( void )
{
if( m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] )
Expand Down

0 comments on commit 28db0ab

Please sign in to comment.