// // Name: CC_SwitchToPhyscannon // Author: Hekar Khani // Description: Concommand. Switches between Physcannon and last weapon // Notes: // void CC_SwitchToPhyscannon( void ) { CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() ); if ( pPlayer ) { CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon(); if ( pWeapon ) { // Tell the client to stop selecting weapons engine->ClientCommand( UTIL_GetCommandClient()->edict(), "cancelselect" ); const char *strWeaponName = pWeapon->GetName(); if ( !Q_stricmp( strWeaponName, "weapon_lf_combat_cannon" ) ) { pPlayer->SelectLastItem(); } else { pPlayer->SelectItem( "weapon_lf_combat_cannon" ); } } } }
void asw_marine_spectate_f(const CCommand &args) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( args.ArgC() < 2 ) { Msg( "Usage: asw_marine_spectate [marine_num]\n" ); return; } CASW_Game_Resource* pGameResource = ASWGameResource(); if (!pGameResource) return; int iMarine = atof(args[1]); if (iMarine < 0 || iMarine >= pGameResource->GetMaxMarineResources()) return; CASW_Marine_Resource* pMR = pGameResource->GetMarineResource(iMarine); if (!pMR) { Msg("No marine resource in that index\n"); return; } CASW_Marine *pMarine = pMR->GetMarineEntity(); if (!pMarine) { Msg("No live marine in that slot\n"); return; } pPlayer->SetSpectatingMarine(pMarine); }
static void fire_rocket_projectile_f( void ) { CBasePlayer *pPlayer = (CBasePlayer *)UTIL_GetCommandClient(); Vector ptEyes, vForward; QAngle vLookAng; ptEyes = pPlayer->EyePosition(); pPlayer->EyeVectors( &vForward ); vLookAng = pPlayer->EyeAngles(); CRocket_Turret_Projectile *pRocket = (CRocket_Turret_Projectile *) CBaseEntity::Create( "rocket_turret_projectile", ptEyes, vLookAng, pPlayer ); if ( !pRocket ) return; pRocket->SetThink( NULL ); pRocket->SetMoveType( MOVETYPE_FLY ); pRocket->SetModel( ROCKET_TURRET_PROJECTILE_NAME ); UTIL_SetSize( pRocket, vec3_origin, vec3_origin ); pRocket->CreateSmokeTrail(); pRocket->SetAbsVelocity( vForward * 550 ); pRocket->SetLauncher ( NULL ); }
// creates a batch of aliens at the mouse cursor void asw_alien_batch_f( const CCommand& args ) { MDLCACHE_CRITICAL_SECTION(); bool allowPrecache = CBaseEntity::IsPrecacheAllowed(); CBaseEntity::SetAllowPrecache( true ); // find spawn point CASW_Player* pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; trace_t tr; Vector forward; AngleVectors( pMarine->EyeAngles(), &forward ); UTIL_TraceLine(pMarine->EyePosition(), pMarine->EyePosition() + forward * 300.0f,MASK_SOLID, pMarine, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction != 0.0 ) { // trace to the floor from this spot Vector vecSrc = tr.endpos; tr.endpos.z += 12; UTIL_TraceLine( vecSrc + Vector(0, 0, 12), vecSrc - Vector( 0, 0, 512 ) ,MASK_SOLID, pMarine, COLLISION_GROUP_NONE, &tr ); ASWSpawnManager()->SpawnAlienBatch( "asw_parasite", 25, tr.endpos, vec3_angle ); } CBaseEntity::SetAllowPrecache( allowPrecache ); }
void asw_path_end_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( !pPlayer || !ASWPathUtils() ) return; if ( !pPlayer->GetMarine() ) return; Vector vecPathEnd = pPlayer->GetMarine()->GetAbsOrigin(); debugoverlay->AddBoxOverlay( g_vecPathStart, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 0, 0, 255, 30.0f ); debugoverlay->AddBoxOverlay( vecPathEnd, Vector(-10, -10, -10 ), Vector(10, 10, 10) , vec3_angle, 255, 255, 0, 255, 30.0f ); AI_Waypoint_t *pWaypoint = ASWPathUtils()->BuildRoute( g_vecPathStart, vecPathEnd, NULL, 100, NAV_NONE, bits_BUILD_GET_CLOSE ); if ( !pWaypoint ) { Msg( "Failed to find route\n" ); return; } if ( UTIL_ASW_DoorBlockingRoute( pWaypoint, true ) ) { Msg(" Route blocked by sealed/locked door\n" ); } ASWPathUtils()->DebugDrawRoute( g_vecPathStart, pWaypoint ); }
void asw_test_turret_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine()) { CASW_Marine *pMarine = pPlayer->GetMarine(); if (pMarine->m_hRemoteTurret.Get()) { pMarine->m_hRemoteTurret->StopUsingTurret();//m_hUser = NULL; pMarine->m_hRemoteTurret = NULL; return; } CBaseEntity* pEntity = NULL; while ((pEntity = gEntList.FindEntityByClassname( pEntity, "asw_remote_turret" )) != NULL) { CASW_Remote_Turret* pTurret = dynamic_cast<CASW_Remote_Turret*>(pEntity); if (pTurret) { pTurret->StartedUsingTurret(pMarine); pMarine->m_hRemoteTurret = pTurret; Msg("Set turret\n"); return; } } } Msg("Failed to find a turret\n"); }
void asw_room_info_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( pPlayer && pPlayer->GetMarine() && missionchooser && missionchooser->RandomMissions() ) { IASW_Room_Details *pRoom = missionchooser->RandomMissions()->GetRoomDetails( pPlayer->GetMarine()->GetAbsOrigin() ); if ( !pRoom ) { Msg(" Couldn't find room\n" ); } else { char buf[MAX_PATH]; pRoom->GetFullRoomName( buf, MAX_PATH ); Msg( " Room name: %s\n", buf ); Msg( " Room tags: " ); int nNumTags = pRoom->GetNumTags(); for ( int i = 0; i < nNumTags; ++ i ) { Msg( "%s ", pRoom->GetTag( i ) ); } Msg( "\n" ); } } }
static void change_portalgun_linkage_id_f( const CCommand &args ) { if( sv_cheats->GetBool() == false ) //heavy handed version since setting the concommand with FCVAR_CHEATS isn't working like I thought return; if( args.ArgC() < 2 ) return; unsigned char iNewID = (unsigned char)atoi( args[1] ); CPortal_Player *pPlayer = (CPortal_Player *)UTIL_GetCommandClient(); int iWeaponCount = pPlayer->WeaponCount(); for( int i = 0; i != iWeaponCount; ++i ) { CBaseCombatWeapon *pWeapon = pPlayer->GetWeapon(i); if( pWeapon == NULL ) continue; if( dynamic_cast<CWeaponPortalgun *>(pWeapon) != NULL ) { CWeaponPortalgun *pPortalGun = (CWeaponPortalgun *)pWeapon; pPortalGun->m_iPortalLinkageGroupID = iNewID; break; } } }
//------------------------------------------------------------------------------ // Purpose: Create an NPC of the given type //------------------------------------------------------------------------------ void CC_ASW_Ent_Create( const CCommand& args ) { MDLCACHE_CRITICAL_SECTION(); bool allowPrecache = CBaseEntity::IsPrecacheAllowed(); CBaseEntity::SetAllowPrecache( true ); // Try to create entity CBaseEntity *entity = dynamic_cast< CBaseEntity * >( CreateEntityByName(args[1]) ); if (entity) { entity->Precache(); // Now attempt to drop into the world CASW_Player* pPlayer = ToASW_Player( UTIL_GetCommandClient() ); if (!pPlayer) return; trace_t tr; UTIL_TraceLine( pPlayer->GetCrosshairTracePos() + Vector( 0, 0, 30 ), pPlayer->GetCrosshairTracePos(), MASK_SOLID, pPlayer, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction != 0.0 ) { // Raise the end position a little up off the floor, place the npc and drop him down tr.endpos.z += 12; entity->Teleport( &tr.endpos, NULL, NULL ); // this was causing aliens to spawn under ground //UTIL_DropToFloor( entity, MASK_SOLID ); } DispatchSpawn(entity); } CBaseEntity::SetAllowPrecache( allowPrecache ); }
void asw_drop_ammo_f(const CCommand &args) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; CASW_Marine *pMarine = pPlayer->GetMarine(); if (!pMarine) return; int iBagSlot = atoi(args[1]); CASW_Weapon_Ammo_Bag *pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(0)); if (pBag) { if (pBag->DropAmmoPickup(iBagSlot)) { return; } } pBag = dynamic_cast<CASW_Weapon_Ammo_Bag*>(pMarine->GetWeapon(1)); if (pBag) { if (pBag->DropAmmoPickup(iBagSlot)) { return; } } }
//------------------------------------------------------------------------------ // Purpose: Console command to cause a screen shake. //------------------------------------------------------------------------------ void CC_ASW_Shake( void ) { CBasePlayer *pPlayer = UTIL_GetCommandClient(); if (pPlayer) { UTIL_ASW_ScreenShake( pPlayer->WorldSpaceCenter(), 25.0, 150.0, 1.0, 750, SHAKE_START ); } }
//------------------------------------------------------------------------------ // Purpose : // Input : // Output : //------------------------------------------------------------------------------ void CC_WC_Create( void ) { // Only allowed in wc_edit_mode if (engine->IsInEditMode()) { CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex(); if (g_pAINetworkManager->GetEditOps()->m_bLinkEditMode) { NWCEdit::CreateAILink(UTIL_GetCommandClient()); } else { NWCEdit::CreateAINode(UTIL_GetCommandClient()); } } }
void asw_debug_spectator_server_f(void) { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; Msg("Server: m_bRequestedSpectator=%d\n", pPlayer->m_bRequestedSpectator); }
void asw_live_marines_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; Msg("Has live marines: %d\n", pPlayer->HasLiveMarines()); }
void asw_suicide_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine() && pPlayer->GetMarine()->GetHealth() > 0) { pPlayer->GetMarine()->Suicide(); } }
void asw_LeaveMarinef() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient());; if (pPlayer && pPlayer->GetMarine()) { pPlayer->LeaveMarines(); } }
//----------------------------------------------------------------------------- // Purpose: Console command to fade out to a given color. //----------------------------------------------------------------------------- static void CC_FadeOut( void ) { float flTime; color32 clrFade; GetFadeParms( flTime, clrFade ); CBasePlayer *pPlayer = UTIL_GetCommandClient(); UTIL_ScreenFade( pPlayer, clrFade, flTime, 0, FFADE_OUT | FFADE_PURGE | FFADE_STAYOUT ); }
//----------------------------------------------------------------------------- // Purpose: Console command to fade in from a given color. //----------------------------------------------------------------------------- static void CC_FadeIn( const CCommand &args ) { float flTime; color32 clrFade; GetFadeParms( args, flTime, clrFade ); CBasePlayer *pPlayer = UTIL_GetCommandClient(); UTIL_ScreenFade( pPlayer, clrFade, flTime, 0, FFADE_IN | FFADE_PURGE ); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CommandListIssues( void ) { CBasePlayer *commandIssuer = UTIL_GetCommandClient(); if ( g_voteController && commandIssuer ) { g_voteController->ListIssues(commandIssuer); } }
//------------------------------------------------------------------------------ // Display the hull type of the specified NPC. //------------------------------------------------------------------------------ void CC_AI_Hull( const CCommand &args ) { if ( !g_pAINetworkManager ) return; bool bSpawned = false; CBaseEntity *pEnt = NULL; if ( !args[1] || !args[1][0] ) { // No arg means the entity under the crosshair. pEnt = FindPickerEntity( UTIL_GetCommandClient() ); if ( !pEnt ) { DevMsg( "No entity under the crosshair.\n" ); return; } } else { // Find the entity specified on the command line. pEnt = gEntList.FindEntityGeneric( NULL, args[1] ); if ( !pEnt ) { // Not found, try to create one. pEnt = (CAI_BaseNPC *)CreateEntityByName( args[1] ); if ( !pEnt ) { DevMsg( "Entity %s not found, and couldn't create!\n", args[1] ); return; } bSpawned = true; DispatchSpawn( pEnt ); } } CAI_BaseNPC *pNPC = dynamic_cast<CAI_BaseNPC *>( pEnt ); if ( !pNPC ) { DevMsg( "Entity %s is not an NPC.\n", pEnt->GetDebugName() ); return; } Hull_t eHull = pNPC->GetHullType(); if ( bSpawned ) { UTIL_Remove( pEnt ); } g_pAINetworkManager->GetEditOps()->DrawHull( eHull ); CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex(); }
void CC_ASW_WC_EditEmitter( void ) { // Only allowed in wc_edit_mode if (engine->IsInEditMode()) { CBaseEntity::m_nDebugPlayer = UTIL_GetCommandClientIndex(); ASW_WCEdit::EditEmitter(UTIL_GetCommandClient()); } }
void CC_ShootPlayerBall(const CCommand &args) { CSDKPlayer *pPl = ToSDKPlayer(UTIL_GetCommandClient()); if (!CSDKPlayer::IsOnField(pPl) || !pPl->GetPlayerBall()) return; pPl->GetPlayerBall()->SetBallCannonMode(true); pPl->GetPlayerBall()->RestoreBallCannonSettings(); pPl->m_Shared.SetStamina(100); }
void asw_stop_burning_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine()) { CASW_Marine *pMarine = pPlayer->GetMarine(); pMarine->Extinguish(); } }
void asw_build_speech_durations_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer || !MarineProfileList() || !pPlayer->GetMarine()) return; Msg("Saving speech durations..."); MarineProfileList()->SaveSpeechDurations(pPlayer->GetMarine()); Msg("Done!\n"); }
void asw_debug_server_cursor_f( const CCommand& args ) { MDLCACHE_CRITICAL_SECTION(); // Now attempt to drop into the world CASW_Player* pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (!pPlayer) return; NDebugOverlay::Cross3D( pPlayer->GetCrosshairTracePos(), 20.0f, 255, 128, 0, true, 1.0f ); }
void ASW_PhysicsShove_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if (pPlayer && pPlayer->GetMarine()) { if (pPlayer->GetMarine()->GetFlags() & FL_FROZEN) // don't allow this if the marine is frozen return; pPlayer->GetMarine()->PhysicsShove(); } }
void CC_UpgradePortalGun( void ) { CPortal_Player *pPlayer = ToPortalPlayer( UTIL_GetCommandClient() ); CWeaponPortalgun *pPortalGun = static_cast<CWeaponPortalgun*>( pPlayer->Weapon_OwnsThisType( "weapon_portalgun" ) ); if ( pPortalGun ) { pPortalGun->SetCanFirePortal1(); pPortalGun->SetCanFirePortal2(); } }
void ShootMe() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( pPlayer->GetMarine() ) { CTakeDamageInfo dmgInfo( pPlayer, pPlayer, 3, DMG_BULLET ); Vector vecDir = RandomVector(-1, 1); trace_t tr; pPlayer->GetMarine()->DispatchTraceAttack( dmgInfo, vecDir, &tr ); } }
void asw_path_start_f() { CASW_Player *pPlayer = ToASW_Player(UTIL_GetCommandClient()); if ( !pPlayer || !ASWPathUtils() ) return; if ( !pPlayer->GetMarine() ) return; g_vecPathStart = pPlayer->GetMarine()->GetAbsOrigin(); }
//------------------------------------------------------------------------------ // Applies keyvalues to the entity by hammer ID. //------------------------------------------------------------------------------ void CC_Ent_Keyvalue( const CCommand &args ) { // Must have an odd number of arguments. if ( ( args.ArgC() < 4 ) || ( args.ArgC() & 1 ) ) { Msg( "Format: ent_keyvalue <entity id> \"key1\" \"value1\" \"key2\" \"value2\" ... \"keyN\" \"valueN\"\n" ); return; } CBasePlayer *pPlayer = ToBasePlayer( UTIL_GetCommandClient() ); CBaseEntity *pEnt; if ( FStrEq( args[1], "" ) || FStrEq( args[1], "!picker" ) ) { if (!pPlayer) return; extern CBaseEntity *FindPickerEntity( CBasePlayer *pPlayer ); pEnt = FindPickerEntity( pPlayer ); if ( !pEnt ) { ClientPrint( pPlayer, HUD_PRINTCONSOLE, "No entity in front of player.\n" ); return; } } else if ( FStrEq( args[1], "!self" ) || FStrEq( args[1], "!caller" ) || FStrEq( args[1], "!activator" ) ) { if (!pPlayer) return; pEnt = pPlayer; } else { int nID = atoi( args[1] ); pEnt = g_ServerTools.FindEntityByHammerID( nID ); if ( !pEnt ) { Msg( "Entity ID %d not found.\n", nID ); return; } } int nArg = 2; while ( nArg < args.ArgC() ) { const char *pszKey = args[ nArg ]; const char *pszValue = args[ nArg + 1 ]; nArg += 2; g_ServerTools.SetKeyValue( pEnt, pszKey, pszValue ); } }