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.