source-sdk-2013 icon indicating copy to clipboard operation
source-sdk-2013 copied to clipboard

[TF2] gameplay: automatically collect MvM money in respawn room

Open mastercoms opened this issue 10 months ago • 2 comments

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 that is in a spawn room, just like it is already done for trigger_hurt.

mastercoms avatar Feb 18 '25 23:02 mastercoms

In my opinion it would be cleaner to expand the above check to also check for the nav flags instead of iterating through all the respawn rooms, can do something like this:

CTFNavArea *area = (CTFNavArea *)TheNavMesh->GetNavArea( GetAbsOrigin() );
if ( !area || area->HasAttributeTF(TF_NAV_SPAWN_ROOM_BLUE | TF_NAV_SPAWN_ROOM_RED) )
{
	TFGameRules()->DistributeCurrencyAmount( m_nAmount );
	m_bTouched = true;
	UTIL_Remove( this );

	return;
}

Mikusch avatar Feb 27 '25 15:02 Mikusch

Sure, I just thought it was appropriate since trigger_hurt has the same check.

mastercoms avatar Feb 27 '25 17:02 mastercoms

Hi, there seems to be a regression with this; many custom MvM maps opt to group the func_respawnroom brushes into a single entity, causing them to have a massive bounding box spanning the entire map. This is most noticable on Hoovydam.

flurbury avatar May 18 '25 11:05 flurbury

Ack, that's no good! My apologies. The solution @Mikusch proposed would likely be suitable for fixing this.

mastercoms avatar May 18 '25 13:05 mastercoms