-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[TF2] Fix #618 causing money to be aggressively collected in the playable area #1307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -174,59 +174,59 @@ 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; | ||||||
} | ||||||
} | ||||||
|
||||||
// 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 ) ) | ||||||
if ( !pRespawnRoom->m_bDisabled && pRespawnRoom->PointIsWithin( GetAbsOrigin() ) ) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Correct me if I'm wrong but couldn't we also double check to see if the cash entity is touching the trigger using IsTouching? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
{ | ||||||
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 | ||||||
//----------------------------------------------------------------------------- | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the respawn room gets disabled before the money comes to rest, will this result in the money not autocollecting? Some maps may disable certain respawn rooms for robots mid-game but may not make those areas walkable for players.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would indeed happen, but I'm operating on the assumption that there's not really much reason to disable spawnroom entities in MvM except for making an area walkable and using
RecomputeBlockers
, given that robots won't attempt to hotswap their loadouts and their actual spawnpoints will continue to function as the mission maker directs independent of the spawnroom's status. Though of course if there's any maps this change would break, it would be worth reviewing this part again.