SpawnEnemyAboveMe(); // Refills all marine health
-
void SpawnBuzzerAboveMe( const CCommand &args ) { if ( args.ArgC() < 2 ) { Msg( "Format: asw_spawn_buzzer <z height above marine>\n" ); return; } MDLCACHE_CRITICAL_SECTION(); bool allowPrecache = CBaseEntity::IsPrecacheAllowed(); CBaseEntity::SetAllowPrecache( true ); // Try to create entity CBaseEntity *entity = dynamic_cast< CBaseEntity * >( CreateEntityByName( "asw_buzzer" ) ); if (entity) { entity->Precache(); // Now attempt to drop into the world CASW_Player* pPlayer = ToASW_Player( UTIL_GetCommandClient() ); if (!pPlayer) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if ( !pMarine ) return; Vector vecPos = pMarine->GetAbsOrigin(); vecPos.z += atof( args[1] ); entity->Teleport( &vecPos, NULL, NULL ); DispatchSpawn(entity); } CBaseEntity::SetAllowPrecache( allowPrecache ); } static ConCommand asw_spawn_buzzer("asw_spawn_buzzer", SpawnBuzzerAboveMe, "Refills all marine health", FCVAR_CHEAT);
Apparently, someone thought spawning an enemy would refill health. This is, unfortunately, just one of the many WTFs in the source code of Alien Swarm.
-
maybe the OC thought it would be a trap for cheaters; the unsuspecting cheater thinks it will refill all their health but actually will spawn an enemy on top of them ^_^
-
Someone copied and pasted and didn't change the description. Meh.
-
@lolwtf said:
Someone copied and pasted and didn't change the description. Meh.
This. I see stuff like that in our codebase at work. Usually some XAML databinding thing doesn't work, another coder comes to me for help, and I find they just pasted in a stock PropertyChanged event raiser line from elsewhere but didn't bother updating the property name to actually match the property they're working on.
-
Someone actually played this game longer than it took to get the achievement to get a hat in TF2?
That is a serious WTF.
-
@belgariontheking said:
Someone actually played this game longer than it took to get the achievement to get a hat in TF2?
That is a serious WTF.
No kidding. If I had paid money for it, I'd be pissed.
-
TRWTF is that it does not restore allowPrecache on error. And that args is a command.
-
@lolwtf said:
Someone copied and pasted and didn't change the description. Meh.
I wasted ten minutes of my time today debugging the wrong code, because someone* forgot to change a trace message after copy+pasting some boilerplate.Anyway, I'm slightly concerned with this bit:
dynamic_cast< CBaseEntity * >( CreateEntityByName( "asw_buzzer" ) )
Shouldn't that cast be redundant (or otherwise wrong)?
*me
-
@Zecc said:
dynamic_cast< CBaseEntity * >( CreateEntityByName( "asw_buzzer" ) )
CBaseEntity *CreateEntityByName( const char *className, int iForceEdictIndex = -1, bool bNotify = true );
So they're casting a CBaseEntity pointer to a CBaseEntity pointer at runtime.
To make a really bad simile, that's like saying that you don't want mashed potatoes and asking for mashed potatoes instead.
-
@Zecc said:
@lolwtf said:
Someone copied and pasted and didn't change the description. Meh.
I wasted ten minutes of my time today debugging the wrong code, because someone* forgot to change a trace message after copy+pasting some boilerplate.Anyway, I'm slightly concerned with this bit:
dynamic_cast< CBaseEntity * >( CreateEntityByName( "asw_buzzer" ) )
Shouldn't that cast be redundant (or otherwise wrong)?
*me
Since it's returning an object of a base class, but seems to be able to create all sorts of different entity types, it probably actually returns an object of whatever dervived entity type the created entity has.