//----------------------------------------------------------------------------- // Purpose: // Input : // Output : //----------------------------------------------------------------------------- void CWeapon_SLAM::PrimaryAttack( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if (!pOwner) { return; } if (pOwner->GetAmmoCount(m_iSecondaryAmmoType) <= 0) { return; } switch (m_tSlamState) { case SLAM_TRIPMINE_READY: if (CanAttachSLAM()) { StartTripmineAttach(); } break; case SLAM_SATCHEL_THROW: StartSatchelThrow(); break; case SLAM_SATCHEL_ATTACH: StartSatchelAttach(); break; } }
//--------------------------------------------------------- //--------------------------------------------------------- bool CVisibilityMonitor::EntityIsVisibleToPlayer( const visibility_target_t &target, CBasePlayer *pPlayer, int *numTraces ) { CBaseCombatCharacter *pEyeEntity = pPlayer->ActivePlayerCombatCharacter(); Vector vecTargetOrigin = target.entity->WorldSpaceCenter(); Vector vecPlayerOrigin = pEyeEntity->EyePosition(); float flDistSqr = vecPlayerOrigin.DistToSqr( vecTargetOrigin ); if( flDistSqr <= target.minDistSqr ) { // Increment the counter of traces done during this polling cycle *numTraces += 1; trace_t tr; int mask = MASK_BLOCKLOS_AND_NPCS & ~CONTENTS_BLOCKLOS; UTIL_TraceLine( vecPlayerOrigin, vecTargetOrigin, mask, pEyeEntity, COLLISION_GROUP_NONE, &tr ); if( tr.fraction == 1.0f || tr.m_pEnt == target.entity ) return true; if( debug_visibility_monitor.GetInt() > 1 ) { NDebugOverlay::Line( vecPlayerOrigin, vecTargetOrigin, 255, 0, 0, false, vismon_poll_frequency.GetFloat() ); } } return false; }
void CWeaponImmolator::ImmolationDamage( const CTakeDamageInfo &info, const Vector &vecSrcIn, float flRadius, int iClassIgnore ) { CBaseEntity *pEntity = NULL; trace_t tr; Vector vecSpot; Vector vecSrc = vecSrcIn; // iterate on all entities in the vicinity. for ( CEntitySphereQuery sphere( vecSrc, flRadius ); pEntity = sphere.GetCurrentEntity(); sphere.NextEntity() ) { CBaseCombatCharacter *pBCC; pBCC = pEntity->MyCombatCharacterPointer(); if ( pBCC && !pBCC->IsOnFire() ) { // UNDONE: this should check a damage mask, not an ignore if ( iClassIgnore != CLASS_NONE && pEntity->Classify() == iClassIgnore ) { continue; } if( pEntity == GetOwner() ) { continue; } pBCC->Ignite( random->RandomFloat( 15, 20 ) ); } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CWeaponTranquilizer::CreateLaserPointer( void ) { #ifndef CLIENT_DLL if ( m_hLaserDot != NULL ) return; CBaseCombatCharacter *pOwner = GetOwner(); if ( pOwner == NULL ) return; if ( pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0 ) return; m_hLaserDot = CLaserDot::Create( GetAbsOrigin(), GetOwner() ); m_hLaserDot->TurnOff(); m_hLaserDot->SetRenderMode(kRenderWorldGlow); if(HL2MPRules()->IsTeamplay()) { if(pOwner->GetTeamNumber() == TEAM_PINK) m_hLaserDot->SetRenderColor(255,100,255,255); else m_hLaserDot->SetRenderColor(153,255,153,255); } else m_hLaserDot->SetRenderColor(255,0,0,255); UpdateLaserPosition(); #endif }
//----------------------------------------------------------------------------- // Purpose: Same as base reload but doesn't change the owner's next attack time. This // lets us zoom out while reloading. This hack is necessary because our // ItemPostFrame is only called when the owner's next attack time has // expired. // Output : Returns true if the weapon was reloaded, false if no more ammo. //----------------------------------------------------------------------------- bool CWeaponSniperRifle::Reload( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if (!pOwner) { return false; } if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) > 0) { int primary = MIN(GetMaxClip1() - m_iClip1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); int secondary = MIN(GetMaxClip2() - m_iClip2, pOwner->GetAmmoCount(m_iSecondaryAmmoType)); if (primary > 0 || secondary > 0) { // Play reload on different channel as it happens after every fire // and otherwise steals channel away from fire sound WeaponSound(RELOAD); SendWeaponAnim( ACT_VM_RELOAD ); m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration(); m_bInReload = true; } return true; } return false; }
//----------------------------------------------------------------------------- // Purpose: Override so give correct ammo // Input : pOther - the entity that touched me // Output : //----------------------------------------------------------------------------- void CWeapon_SLAM::SlamTouch( CBaseEntity *pOther ) { CBaseCombatCharacter* pBCC = ToBaseCombatCharacter( pOther ); // Can I even pick stuff up? if ( pBCC && !pBCC->IsAllowedToPickupWeapons() ) return; // --------------------------------------------------- // First give weapon to touching entity if allowed // --------------------------------------------------- BaseClass::DefaultTouch(pOther); // ---------------------------------------------------- // Give slam ammo if touching client // ---------------------------------------------------- if (pOther->GetFlags() & FL_CLIENT) { // ------------------------------------------------ // If already owned weapon of this type remove me // ------------------------------------------------ CWeapon_SLAM* oldWeapon = (CWeapon_SLAM*)pBCC->Weapon_OwnsThisType( GetClassname() ); if (oldWeapon != this) { UTIL_Remove( this ); } else { pBCC->GiveAmmo( 1, m_iSecondaryAmmoType ); SetThink(NULL); } } }
void CGETKnife::PickupTouch( CBaseEntity *pOther ) { // Vehicles can touch items + pick them up if ( pOther->GetServerVehicle() ) { pOther = pOther->GetServerVehicle()->GetPassenger(); if ( !pOther ) return; } CBaseCombatCharacter *pPicker = pOther->MyCombatCharacterPointer(); if ( !pPicker ) return; // Must be a valid pickup scenario (no blocking). Though this is a more expensive // check than some that follow, this has to be first because it's the only one // that inhibits firing the output OnCacheInteraction. if ( UTIL_ItemCanBeTouchedByPlayer( this, ToGEPlayer(pPicker) ) == false ) return; // Can I even pick stuff up? if ( !pPicker->IsAllowedToPickupWeapons() ) return; if ( MyTouch( pPicker ) ) { SetTouch( NULL ); SetThink( NULL ); UTIL_Remove( this ); } }
//----------------------------------------------------------------------------- // Purpose: Override so give correct ammo // Input : pOther - the entity that touched me // Output : //----------------------------------------------------------------------------- void CWeaponMolotov::MolotovTouch( CBaseEntity *pOther ) { // --------------------------------------------------- // First give weapon to touching entity if allowed // --------------------------------------------------- BaseClass::DefaultTouch(pOther); // ---------------------------------------------------- // Give molotov ammo if touching client // ---------------------------------------------------- if (pOther->GetFlags() & FL_CLIENT) { // ------------------------------------------------ // If already owned weapon of this type remove me // ------------------------------------------------ CBaseCombatCharacter* pBCC = ToBaseCombatCharacter( pOther ); CWeaponMolotov* oldWeapon = (CWeaponMolotov*)pBCC->Weapon_OwnsThisType( GetClassname() ); if (oldWeapon != this) { UTIL_Remove( this ); } else { pBCC->GiveAmmo( 1, m_iSecondaryAmmoType ); SetThink (NULL); } } }
//----------------------------------------------------------------------------- // Purpose: // Input : inputdata - //----------------------------------------------------------------------------- void CEntityFlame::InputIgnite( inputdata_t &inputdata ) { if (m_target != NULL_STRING) { CBaseEntity *pTarget = NULL; while ((pTarget = gEntList.FindEntityGeneric(pTarget, STRING(m_target), this, inputdata.pActivator)) != NULL) { // Combat characters know how to catch themselves on fire. CBaseCombatCharacter *pBCC = pTarget->MyCombatCharacterPointer(); if (pBCC) { // DVS TODO: consider promoting Ignite to CBaseEntity and doing everything here pBCC->Ignite(m_flLifetime); } // Everything else, we handle here. else { CEntityFlame *pFlame = CEntityFlame::Create(pTarget); if (pFlame) { pFlame->SetLifetime(m_flLifetime); } } } } }
bool CASW_BaseAI_Senses::WaitingUntilSeen( CBaseEntity *pSightEnt ) { if ( GetOuter()->GetSpawnFlags() & SF_NPC_WAIT_TILL_SEEN ) { // asw, wake up if marines see us (not players) if ( pSightEnt && pSightEnt->Classify() == CLASS_ASW_MARINE ) { CBaseCombatCharacter *pBCC = dynamic_cast<CBaseCombatCharacter*>( pSightEnt ); Vector zero = Vector(0,0,0); // don't link this client in the list if the npc is wait till seen and the player isn't facing the npc if (// && pPlayer->FVisible( GetOuter() ) pBCC->FInViewCone( GetOuter() ) && FBoxVisible( pSightEnt, static_cast<CBaseEntity*>(GetOuter()), zero ) ) { // marine sees us, become normal now. GetOuter()->RemoveSpawnFlags( SF_NPC_WAIT_TILL_SEEN ); return false; } } return true; } return false; }
//----------------------------------------------------------------------------- // Purpose: Override so only reload one shell at a time // Input : // Output : //----------------------------------------------------------------------------- bool CWeaponShotgun::Reload( void ) { // Check that StartReload was called first if (!m_bInReload) { Warning("ERROR: Shotgun Reload called incorrectly!\n"); } CBaseCombatCharacter *pOwner = GetOwner(); if ( pOwner == NULL ) return false; if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0) return false; if (m_iClip1 >= GetMaxClip1()) return false; int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; FillClip(); // Play reload on different channel as otherwise steals channel away from fire sound WeaponSound(RELOAD); SendWeaponAnim( ACT_VM_RELOAD ); pOwner->m_flNextAttack = gpGlobals->curtime; m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration(); return true; }
//----------------------------------------------------------------------------- // Purpose: Override so only reload one shell at a time // Input : // Output : //----------------------------------------------------------------------------- bool CWeaponShotgun::StartReload( void ) { if ( m_bNeedPump ) return false; CBaseCombatCharacter *pOwner = GetOwner(); if ( pOwner == NULL ) return false; if (pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0) return false; if (m_iClip1 >= GetMaxClip1()) return false; int j = MIN(1, pOwner->GetAmmoCount(m_iPrimaryAmmoType)); if (j <= 0) return false; SendWeaponAnim( ACT_SHOTGUN_RELOAD_START ); // Make shotgun shell visible SetBodygroup(1,0); pOwner->m_flNextAttack = gpGlobals->curtime; m_flNextPrimaryAttack = gpGlobals->curtime + SequenceDuration(); m_bInReload = true; return true; }
//----------------------------------------------------------------------------- // Purpose: Attempts to kill an NPC if it's within range and other criteria // Input : *pVictim - NPC to assess // **pPhysObj - pointer to the ragdoll created if the NPC is killed // Output : bool - whether or not the NPC was killed and the returned pointer is valid //----------------------------------------------------------------------------- bool CGravityVortexController::KillNPCInRange( CBaseEntity *pVictim, IPhysicsObject **pPhysObj ) { CBaseCombatCharacter *pBCC = pVictim->MyCombatCharacterPointer(); // See if we can ragdoll if ( pBCC != NULL && pBCC->CanBecomeRagdoll() ) { // Don't bother with striders if ( FClassnameIs( pBCC, "npc_strider" ) ) return false; // TODO: Make this an interaction between the NPC and the vortex // Become ragdoll CTakeDamageInfo info( this, this, 1.0f, DMG_GENERIC ); CBaseEntity *pRagdoll = CreateServerRagdoll( pBCC, 0, info, COLLISION_GROUP_INTERACTIVE_DEBRIS, true ); pRagdoll->SetCollisionBounds( pVictim->CollisionProp()->OBBMins(), pVictim->CollisionProp()->OBBMaxs() ); // Necessary to cause it to do the appropriate death cleanup CTakeDamageInfo ragdollInfo( this, this, 10000.0, DMG_GENERIC | DMG_REMOVENORAGDOLL ); pVictim->TakeDamage( ragdollInfo ); // Return the pointer to the ragdoll *pPhysObj = pRagdoll->VPhysicsGetObject(); return true; } // Wasn't able to ragdoll this target *pPhysObj = NULL; return false; }
void CWeaponMine::WeaponIdle( void ) { if(gpGlobals->curtime > m_flNextPrimaryAttack){ CBaseCombatCharacter *pOwner = GetOwner(); if (!pOwner) return; //Si on a une mine à finir de poser if(m_bAttachMine) FinishAttach(); //Sinon si on doit recharger if( m_bNeedReload ) { if (pOwner->GetAmmoCount(m_iSecondaryAmmoType) > 0){ SendWeaponAnim(ACT_SLAM_TRIPMINE_DRAW); m_bNeedReload = false; } #ifndef CLIENT_DLL //Sinon on a pas assez de munitions et on drop l'arme else { pOwner->Weapon_Drop(this); UTIL_Remove(this); } #endif } //Sinon on idle else { SendWeaponAnim(ACT_SLAM_TRIPMINE_IDLE); m_flWallSwitchTime = 0; } } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Ichthyosaur::EnsnareVictim( CBaseEntity *pVictim ) { CBaseCombatCharacter* pBCC = (CBaseCombatCharacter *) pVictim; if ( pBCC && pBCC->DispatchInteraction( g_interactionBarnacleVictimGrab, NULL, this ) ) { if ( pVictim->IsPlayer() ) { CBasePlayer *pPlayer = dynamic_cast< CBasePlayer * >((CBaseEntity *) pVictim); if ( pPlayer ) { m_flHoldTime = MAX( gpGlobals->curtime+3.0f, pPlayer->PlayerDrownTime() - 2.0f ); } } else { m_flHoldTime = gpGlobals->curtime + 4.0f; } m_pVictim = pVictim; m_pVictim->AddSolidFlags( FSOLID_NOT_SOLID ); SetSchedule( SCHED_ICH_DROWN_VICTIM ); } }
//----------------------------------------------------------------------------- // Purpose: // Input : // Output : //----------------------------------------------------------------------------- bool CWeapon_SLAM::CanAttachSLAM( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if (!pOwner) { return false; } Vector vecSrc = pOwner->Weapon_ShootPosition( ); Vector vecAiming = pOwner->BodyDirection2D( ); trace_t tr; Vector vecEnd = vecSrc + (vecAiming * 42); UTIL_TraceLine( vecSrc, vecEnd, MASK_SOLID, pOwner, COLLISION_GROUP_NONE, &tr ); if (tr.fraction < 1.0) { // Don't attach to a living creature if (tr.m_pEnt) { CBaseEntity *pEntity = tr.m_pEnt; CBaseCombatCharacter *pBCC = ToBaseCombatCharacter( pEntity ); if (pBCC) { return false; } } return true; } else { return false; } }
//----------------------------------------------------------------------------- // Purpose: // Input : // Output : //----------------------------------------------------------------------------- void CWeapon_SLAM::SLAMThink( void ) { if (m_flWallSwitchTime <= gpGlobals->curtime) { // If not in tripmine mode we need to check to see if we are close to // a wall. If we are we go into satchel_attach mode CBaseCombatCharacter *pOwner = GetOwner(); if ((m_tSlamState != SLAM_TRIPMINE_READY) && (pOwner && pOwner->GetAmmoCount(m_iSecondaryAmmoType) > 0)) { if (CanAttachSLAM()) { if (m_tSlamState == SLAM_SATCHEL_THROW) { SetSlamState(SLAM_SATCHEL_ATTACH); int iAnim = m_bDetonatorArmed ? ACT_SLAM_THROW_TO_STICKWALL : ACT_SLAM_THROW_TO_STICKWALL_ND; SendWeaponAnim( iAnim ); m_flWallSwitchTime = gpGlobals->curtime + SequenceDuration(); } } else { if (m_tSlamState == SLAM_SATCHEL_ATTACH) { SetSlamState(SLAM_SATCHEL_THROW); int iAnim = m_bDetonatorArmed ? ACT_SLAM_STICKWALL_TO_THROW : ACT_SLAM_STICKWALL_TO_THROW_ND; SendWeaponAnim( iAnim ); m_flWallSwitchTime = gpGlobals->curtime + SequenceDuration(); } } } } SetNextThink( gpGlobals->curtime + 0.1f ); }
//--------------------------------------------------------- // BUGBUG - don't give ammo here. //--------------------------------------------------------- bool CWeaponIRifle::Deploy( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if (pOwner) { pOwner->GiveAmmo( 90, m_iPrimaryAmmoType); } return BaseClass::Deploy(); }
//----------------------------------------------------------------------------- // Purpose: // Input : // Output : //----------------------------------------------------------------------------- void CWeapon_SLAM::StartSatchelAttach( void ) { #ifndef CLIENT_DLL CBaseCombatCharacter *pOwner = GetOwner(); if (!pOwner) { return; } Vector vecSrc = pOwner->Weapon_ShootPosition( ); Vector vecAiming = pOwner->BodyDirection2D( ); trace_t tr; UTIL_TraceLine( vecSrc, vecSrc + (vecAiming * 128), MASK_SOLID, pOwner, COLLISION_GROUP_NONE, &tr ); if (tr.fraction < 1.0) { CBaseEntity *pEntity = tr.m_pEnt; if (pEntity && !(pEntity->GetFlags() & FL_CONVEYOR)) { // Only the player fires this way so we can cast CBasePlayer *pPlayer = ToBasePlayer( pOwner ); // player "shoot" animation pPlayer->SetAnimation( PLAYER_ATTACK1 ); //Tony; need to check the player models ! ToHL2MPPlayer(pPlayer)->DoAnimationEvent( PLAYERANIMEVENT_ATTACK_PRIMARY ); // ----------------------------------------- // Play attach animation // ----------------------------------------- if (m_bDetonatorArmed) { SendWeaponAnim(ACT_SLAM_STICKWALL_ATTACH); } else { SendWeaponAnim(ACT_SLAM_STICKWALL_ND_ATTACH); if (!m_bDetonatorArmed) { m_bDetonatorArmed = true; m_bNeedDetonatorDraw = true; } } m_bNeedReload = true; m_bAttachSatchel = true; m_flNextPrimaryAttack = m_flNextSecondaryAttack = SLAM_REFIRE_DELAY + gpGlobals->curtime + SequenceDuration(); } } #endif }
bool CWeapon_SLAM::Deploy( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if (!pOwner) { return false; } m_bDetonatorArmed = AnyUndetonatedCharges(); SetModel( GetViewModel() ); m_tSlamState = (int)SLAM_SATCHEL_THROW; // ------------------------------ // Pick the right draw animation // ------------------------------ int iActivity; // If detonator is already armed m_bNeedReload = false; if (m_bDetonatorArmed) { if (pOwner->GetAmmoCount(m_iSecondaryAmmoType) <= 0) { iActivity = ACT_SLAM_DETONATOR_DRAW; m_bNeedReload = true; } else if (CanAttachSLAM()) { iActivity = ACT_SLAM_DETONATOR_STICKWALL_DRAW; SetSlamState(SLAM_TRIPMINE_READY); } else { iActivity = ACT_SLAM_DETONATOR_THROW_DRAW; SetSlamState(SLAM_SATCHEL_THROW); } } else { if (CanAttachSLAM()) { iActivity = ACT_SLAM_TRIPMINE_DRAW; SetSlamState(SLAM_TRIPMINE_READY); } else { iActivity = ACT_SLAM_THROW_ND_DRAW; SetSlamState(SLAM_SATCHEL_THROW); } } return DefaultDeploy( (char*)GetViewModel(), (char*)GetWorldModel(), iActivity, (char*)GetAnimPrefix() ); }
void CWeaponMine::MineTouch( CBaseEntity *pOther ) { #ifdef GAME_DLL CBaseCombatCharacter* pBCC = ToBaseCombatCharacter( pOther ); if ( pBCC && !pBCC->IsAllowedToPickupWeapons() ) return; #endif BaseClass::DefaultTouch(pOther); }
//----------------------------------------------------------------------------- // Purpose: Put the rocket back on the end of the rocket launcher after we reload it. //----------------------------------------------------------------------------- void CGEWeaponRocketLauncher::OnReloadOffscreen(void) { BaseClass::OnReloadOffscreen(); CBaseCombatCharacter *pOwner = GetOwner(); if (!pOwner) return; if (pOwner->GetActiveWeapon() == this) SwitchBodygroup(1, 0); }
void CWeaponShotgun::OnReloadOffscreen(void) { BaseClass::OnReloadOffscreen(); CBaseCombatCharacter *pOwner = GetOwner(); if (!pOwner) return; if (pOwner->GetActiveWeapon() == this) CalculateShellVis(true); // Check shell count when we reload, but adjust for the amount of ammo we're about to take out of the clip. }
void CWeaponShotgun::FillClip( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if ( pOwner == NULL ) return; // Add them to the clip m_iClip1++; pOwner->RemoveAmmo( 1, m_iPrimaryAmmoType ); }
void CWeapon_Manhack::WeaponSwitch( void ) { CBaseCombatCharacter *pOwner = GetOwner(); if (pOwner==NULL) return; pOwner->SwitchToNextBestWeapon( pOwner->GetActiveWeapon() ); if (CPropVehicleManhack::GetManhackVehicle() == NULL && pOwner->GetAmmoCount(m_iPrimaryAmmoType) <= 0) { pOwner->ClearActiveWeapon(); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CNPC_Ichthyosaur::ReleaseVictim( void ) { CBaseCombatCharacter *pBCC = (CBaseCombatCharacter *) m_pVictim; pBCC->DispatchInteraction( g_interactionBarnacleVictimReleased, NULL, this ); m_pVictim->RemoveSolidFlags( FSOLID_NOT_SOLID ); m_pVictim = NULL; m_flNextBiteTime = gpGlobals->curtime + 8.0f; m_flHoldTime = gpGlobals->curtime - 0.1f; }
void CBaseCombatWeapon::DestroyItem( void ) { CBaseCombatCharacter *pOwner = m_hOwner.Get(); if ( pOwner ) { // if attached to a player, remove. pOwner->RemovePlayerItem( this ); } Kill( ); }
// Make sure we aren't going to throw the grenade INTO something! void CGEWeaponRocketLauncher::CheckLaunchPosition( const Vector &vecEye, Vector &vecSrc ) { CBaseCombatCharacter *pOwner = GetOwner(); if ( !pOwner ) return; trace_t tr; UTIL_TraceHull( vecEye, vecSrc, -Vector(6,6,6), Vector(6,6,6), pOwner->PhysicsSolidMaskForEntity(), pOwner, pOwner->GetCollisionGroup(), &tr ); if ( tr.DidHit() ) vecSrc = tr.endpos; }
//----------------------------------------------------------------------------- // Purpose: Determine if we can jump to be on the enemy's vehicle // Output : Returns true on success, false on failure. //----------------------------------------------------------------------------- inline bool CAI_PassengerBehaviorZombie::CanBeOnEnemyVehicle( void ) { CBaseCombatCharacter *pEnemy = ToBaseCombatCharacter( GetOuter()->GetEnemy() ); if ( pEnemy != NULL ) { IServerVehicle *pVehicle = pEnemy->GetVehicle(); if ( pVehicle && pVehicle->NPC_HasAvailableSeat( GetRoleName() ) ) return true; } return false; }
//----------------------------------------------------------------------------- // Returns true if the entity may be teleported //----------------------------------------------------------------------------- bool CPointTeleport::EntityMayTeleport( CBaseEntity *pTarget ) { if ( pTarget->GetMoveParent() != NULL ) { // Passengers in a vehicle are allowed to teleport; their behavior handles it CBaseCombatCharacter *pBCC = pTarget->MyCombatCharacterPointer(); if ( pBCC == NULL || ( pBCC != NULL && pBCC->IsInAVehicle() == false ) ) return false; } return true; }