From 52e568b374ef3dd9f9309b8aa9f1fba7b0a3dbc0 Mon Sep 17 00:00:00 2001 From: mastercoms Date: Tue, 18 Feb 2025 17:58:03 -0500 Subject: [PATCH] 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 --- src/game/server/tf/entity_currencypack.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/game/server/tf/entity_currencypack.cpp b/src/game/server/tf/entity_currencypack.cpp index b2dc51de4..f9a18b51a 100644 --- a/src/game/server/tf/entity_currencypack.cpp +++ b/src/game/server/tf/entity_currencypack.cpp @@ -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( 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 ); + } + } } //-----------------------------------------------------------------------------