diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /game/shared/baseprojectile.cpp | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'game/shared/baseprojectile.cpp')
| -rw-r--r-- | game/shared/baseprojectile.cpp | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/game/shared/baseprojectile.cpp b/game/shared/baseprojectile.cpp new file mode 100644 index 0000000..f2ff3fd --- /dev/null +++ b/game/shared/baseprojectile.cpp @@ -0,0 +1,94 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//=============================================================================// + +#include "cbase.h" +#include "baseprojectile.h" + + +IMPLEMENT_NETWORKCLASS_ALIASED( BaseProjectile, DT_BaseProjectile ) + +BEGIN_NETWORK_TABLE( CBaseProjectile, DT_BaseProjectile ) +#if !defined( CLIENT_DLL ) + SendPropEHandle( SENDINFO( m_hOriginalLauncher ) ), +#else + RecvPropEHandle( RECVINFO( m_hOriginalLauncher ) ), +#endif // CLIENT_DLL +END_NETWORK_TABLE() + + +#ifndef CLIENT_DLL +IMPLEMENT_AUTO_LIST( IBaseProjectileAutoList ); +#endif // !CLIENT_DLL + + +//----------------------------------------------------------------------------- +// Purpose: Constructor. +//----------------------------------------------------------------------------- +CBaseProjectile::CBaseProjectile() +{ +#ifdef GAME_DLL + m_iDestroyableHitCount = 0; + + m_bCanCollideWithTeammates = false; +#endif + m_hOriginalLauncher = NULL; +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CBaseProjectile::SetLauncher( CBaseEntity *pLauncher ) +{ + if ( m_hOriginalLauncher == NULL ) + { + m_hOriginalLauncher = pLauncher; + } + +#ifdef GAME_DLL + ResetCollideWithTeammates(); +#endif // GAME_DLL +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CBaseProjectile::Spawn() +{ + BaseClass::Spawn(); + +#ifdef GAME_DLL + ResetCollideWithTeammates(); +#endif // GAME_DLL +} + + +#ifdef GAME_DLL + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CBaseProjectile::CollideWithTeammatesThink() +{ + m_bCanCollideWithTeammates = true; +} + + +//----------------------------------------------------------------------------- +// Purpose: +//----------------------------------------------------------------------------- +void CBaseProjectile::ResetCollideWithTeammates() +{ + // Don't collide with players on the owner's team for the first bit of our life + m_bCanCollideWithTeammates = false; + + SetContextThink( &CBaseProjectile::CollideWithTeammatesThink, gpGlobals->curtime + GetCollideWithTeammatesDelay(), "CollideWithTeammates" ); +} + +#endif // GAME_DLL + |