gameplay: automatically collect MvM money in respawn room

MvM money is automatically collected in various
cases where its position is unfair for players to
collect themselves.

there is a case where robots can drop money in their
own spawn, which can prove hard or impossible to acquire

so add an additional check for money which is
in a spawn room, just like trigger_hurt
This commit is contained in:
mastercoms 2025-02-18 17:58:03 -05:00 committed by EricS-Valve
parent 0565403b15
commit 52e568b374

View File

@ -17,6 +17,7 @@
#include "particle_parse.h"
#include "player_vs_environment/tf_population_manager.h"
#include "collisionutils.h"
#include "func_respawnroom.h"
#include "tf_objective_resource.h"
//=============================================================================
@ -209,6 +210,19 @@ void CCurrencyPack::ComeToRest( void )
}
}
}
// Or a func_respawnroom (robots can drop money in their own spawn)
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 ) )
{
TFGameRules()->DistributeCurrencyAmount( m_nAmount );
m_bTouched = true;
UTIL_Remove( this );
}
}
}
//-----------------------------------------------------------------------------