Merge 98283c7d6c into 7191ecc418
This commit is contained in:
commit
c06fef4993
|
|
@ -174,40 +174,31 @@ void CCurrencyPack::BlinkThink( void )
|
|||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Become touchable when we are at rest
|
||||
// Purpose: Collect this pack when it comes to rest if it is outside the playable space.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CCurrencyPack::ComeToRest( void )
|
||||
{
|
||||
BaseClass::ComeToRest();
|
||||
|
||||
if ( IsClaimed() || m_bDistributed )
|
||||
// I'm not sure when this should ever actually return true, but it doesn't seem to cause any issues so I'm not touching it.
|
||||
if ( IsClaimed() )
|
||||
return;
|
||||
|
||||
// if we've come to rest in an area with no nav, just grant the money to the player
|
||||
if ( TheNavMesh->GetNavArea( GetAbsOrigin() ) == NULL )
|
||||
{
|
||||
TFGameRules()->DistributeCurrencyAmount( m_nAmount );
|
||||
m_bTouched = true;
|
||||
UTIL_Remove( this );
|
||||
|
||||
AutoCollect();
|
||||
return;
|
||||
}
|
||||
|
||||
// See if we've come to rest in a trigger_hurt
|
||||
for ( int i = 0; i < ITriggerHurtAutoList::AutoList().Count(); i++ )
|
||||
{
|
||||
CTriggerHurt *pTrigger = static_cast<CTriggerHurt*>( ITriggerHurtAutoList::AutoList()[i] );
|
||||
if ( !pTrigger->m_bDisabled )
|
||||
CTriggerHurt *pTrigger = static_cast<CTriggerHurt *>( ITriggerHurtAutoList::AutoList()[ i ] );
|
||||
if ( !pTrigger->m_bDisabled && pTrigger->PointIsWithin( GetAbsOrigin() ) )
|
||||
{
|
||||
Vector vecMins, vecMaxs;
|
||||
pTrigger->GetCollideable()->WorldSpaceSurroundingBounds( &vecMins, &vecMaxs );
|
||||
if ( IsPointInBox( GetCollideable()->GetCollisionOrigin(), vecMins, vecMaxs ) )
|
||||
{
|
||||
TFGameRules()->DistributeCurrencyAmount( m_nAmount );
|
||||
|
||||
m_bTouched = true;
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
AutoCollect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -215,18 +206,27 @@ void CCurrencyPack::ComeToRest( void )
|
|||
for ( int i = 0; i < IFuncRespawnRoomAutoList::AutoList().Count(); i++ )
|
||||
{
|
||||
CFuncRespawnRoom *pRespawnRoom = static_cast<CFuncRespawnRoom *>( IFuncRespawnRoomAutoList::AutoList()[ i ] );
|
||||
Vector vecMins, vecMaxs;
|
||||
pRespawnRoom->GetCollideable()->WorldSpaceSurroundingBounds( &vecMins, &vecMaxs );
|
||||
if ( IsPointInBox( GetCollideable()->GetCollisionOrigin(), vecMins, vecMaxs ) )
|
||||
if ( !pRespawnRoom->m_bDisabled && pRespawnRoom->PointIsWithin( GetAbsOrigin() ) )
|
||||
{
|
||||
TFGameRules()->DistributeCurrencyAmount( m_nAmount );
|
||||
|
||||
m_bTouched = true;
|
||||
UTIL_Remove( this );
|
||||
AutoCollect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Collects the pack, crediting the player team appropriately. Intended for when a pack lands outside the playable space.
|
||||
//-----------------------------------------------------------------------------
|
||||
void CCurrencyPack::AutoCollect( void )
|
||||
{
|
||||
if ( !m_bDistributed )
|
||||
{
|
||||
TFGameRules()->DistributeCurrencyAmount( m_nAmount );
|
||||
}
|
||||
m_bTouched = true;
|
||||
UTIL_Remove( this );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Sets the value of a custom pack
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public:
|
|||
bool MyTouch( CBasePlayer *pPlayer );
|
||||
virtual bool AffectedByRadiusCollection() const { return true; }
|
||||
|
||||
void AutoCollect( void );
|
||||
void SetAmount( float flAmount );
|
||||
void SetClaimed( void ) { m_bClaimed = true; } // Radius collection code "steers" packs toward the player
|
||||
bool IsClaimed( void ) { return m_bClaimed; } // So don't allow other players to interfere
|
||||
|
|
|
|||
Loading…
Reference in New Issue