Skip to content

Commit 5e65c8a

Browse files
committed
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
1 parent 84ac35b commit 5e65c8a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/game/server/tf/entity_currencypack.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "player_vs_environment/tf_population_manager.h"
1919
#include "collisionutils.h"
2020
#include "tf_objective_resource.h"
21+
#include "func_respawnroom.h"
2122

2223
//=============================================================================
2324
//
@@ -209,6 +210,21 @@ void CCurrencyPack::ComeToRest( void )
209210
}
210211
}
211212
}
213+
// Or a func_respawnroom
214+
for ( int j = 0; j < IFuncRespawnRoomAutoList::AutoList().Count(); j++ )
215+
{
216+
CFuncRespawnRoom *pRespawnRoom = static_cast<CFuncRespawnRoom*>( IFuncRespawnRoomAutoList::AutoList()[j] );
217+
Vector vecMins, vecMaxs;
218+
219+
pRespawnRoom->GetCollideable()->WorldSpaceSurroundingBounds( &vecMins, &vecMaxs );
220+
if ( IsPointInBox( GetCollideable()->GetCollisionOrigin(), vecMins, vecMaxs ) )
221+
{
222+
TFGameRules()->DistributeCurrencyAmount( m_nAmount );
223+
224+
m_bTouched = true;
225+
UTIL_Remove( this );
226+
}
227+
}
212228
}
213229

214230
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)