//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropCrane::EnterVehicle( CBaseCombatCharacter *pPassenger ) { if ( pPassenger == NULL ) return; CBasePlayer *pPlayer = ToBasePlayer( pPassenger ); if ( pPlayer != NULL ) { // Remove any player who may be in the vehicle at the moment if ( m_hPlayer ) { ExitVehicle( VEHICLE_ROLE_DRIVER ); } m_hPlayer = pPlayer; m_playerOn.FireOutput( pPlayer, this, 0 ); m_hPlayer->RumbleEffect( RUMBLE_FLAT_BOTH, 0, RUMBLE_FLAG_LOOP ); m_hPlayer->RumbleEffect( RUMBLE_FLAT_BOTH, 10, RUMBLE_FLAG_UPDATE_SCALE ); m_ServerVehicle.SoundStart(); } else { // NPCs not yet supported - jdw Assert( 0 ); } }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropCannon::EnterVehicle( CBaseCombatCharacter *pPassenger ) { if ( pPassenger == NULL ) return; CBasePlayer *pPlayer = ToBasePlayer( pPassenger ); if ( pPlayer != NULL ) { // Remove any player who may be in the vehicle at the moment if ( m_hPlayer ) { ExitVehicle( VEHICLE_ROLE_DRIVER ); } m_hPlayer = pPlayer; m_playerOn.FireOutput( pPlayer, this, 0 ); //m_ServerVehicle.SoundStart(); } else { // NPCs not supported yet - jdw Assert( 0 ); } }
void QUA_helicopter::EnterVehicle( CBaseCombatCharacter *pPlayer ) { if ( !pPlayer ) return; // Ojo, a ver como hacemos para que nadie pueda quitar // el strider a nadie. if ( m_hPlayer ) { ExitVehicle(VEHICLE_ROLE_DRIVER); } //m_hPlayer = pPlayer; //m_playerOn.FireOutput( pPlayer, this, 0 ); m_pServerVehicle.SoundStart(); }
//----------------------------------------------------------------------------- // Purpose: //----------------------------------------------------------------------------- void CPropVehicleDriveable::EnterVehicle( CBasePlayer *pPlayer ) { if ( !pPlayer ) return; // Remove any player who may be in the vehicle at the moment ExitVehicle(VEHICLE_DRIVER); m_VehiclePhysics.ReleaseHandbrake(); m_hPlayer = pPlayer; m_savedViewOffset = pPlayer->GetViewOffset(); pPlayer->SetViewOffset( vec3_origin ); m_playerOn.FireOutput( pPlayer, this, 0 ); StartEngine(); // Start Thinking SetNextThink( gpGlobals->curtime ); m_VehiclePhysics.GetVehicle()->OnVehicleEnter(); }
bool Unit::EnterVehicle(Vehicle * vehicle, int8 preferedseat) { if( vehicle == NULL || vehicle->HasAllProtoAvailable() == false ) return false; RemoveAurasByInterruptFlag(AURA_INTERRUPT_ON_MOUNT | AURA_INTERRUPT_ON_INVINCIBLE); if( preferedseat == VEHICLE_PASSENGER_SLOT_INVALID ) // Lovely, freedom of choice { for (int8 i=0; i < vehicle->GetOccupancyLimit(); i++) if( vehicle->m_vehicleEntry->m_seatID[i] != 0 && vehicle->GetPassenger(i) == NULL ) { preferedseat = i; break; } } if(preferedseat < MAX_PASSENGERS) { if( preferedseat > vehicle->GetOccupancyLimit()) { return false; } } else { return false; } ExitVehicle(); if( vehicle->GetPassenger(preferedseat) == NULL ) // There's some room available here { vehicle->AddPassenger(this, preferedseat); return true; } return false; }
//----------------------------------------------------------------------------- // Purpose: // NOTE: Doesn't call the base call enter vehicle on purpose! //----------------------------------------------------------------------------- void CPropVehicleManhack::EnterVehicle( CBaseCombatCharacter *pPassenger ) { if ( pPassenger == NULL ) return; DevMsg("CPropVehicleManhack: EnterVehicl(...)\n"); CBasePlayer *pPlayer = ToBasePlayer( pPassenger ); if ( pPlayer != NULL ) { // Remove any player who may be in the vehicle at the moment if ( m_hPlayer ) { ExitVehicle( VEHICLE_ROLE_DRIVER ); } m_hPlayer = pPlayer; m_bHadDriver = true; if (GetNumberOfHacks(false)>1 && m_iHintTimesShown < 2) { m_iHintTimesShown++; m_iHintNoSwapTimesShown++; UTIL_HudHintText( pPlayer, "#HLSS_Hint_ManhackSwap" ); } else if (m_iHintNoSwapTimesShown < 2) { m_iHintNoSwapTimesShown++; UTIL_HudHintText( pPlayer, "#HLSS_Hint_ManhackExit" ); } else UTIL_HudHintText( pPlayer, "" ); pPlayer->SetViewOffset( vec3_origin ); pPlayer->ShowCrosshair( false ); CHL2_Player *pHL2Player = dynamic_cast<CHL2_Player*>( pPlayer ); if ( pHL2Player ) { if ( pHL2Player->IsSprinting() ) { pHL2Player->StopSprinting(); } if ( pHL2Player->FlashlightIsOn() ) { pHL2Player->FlashlightTurnOff(); } } CNPC_Manhack *pManhack = dynamic_cast<CNPC_Manhack*>((CBaseEntity*)m_hManhack); if (pManhack!=NULL) { pManhack->SetControllable(true); if (manhack_dont_draw.GetBool()) { pManhack->AddEffects( EF_NODRAW ); pManhack->ShowRedGlow(false); } m_vecLastEyeTarget = pManhack->GetManhackView(); m_vecLastEyePos = pManhack->GetManhackView(); m_vecTargetSpeed = pManhack->GetAbsVelocity(); m_vecFlyingDirection = pManhack->GetAbsVelocity(); } //We want to see and feel the "vehicle" in manhack mode //SetRenderMode(kRenderNormal); RemoveEffects( EF_NODRAW ); SetSolid(SOLID_BBOX); RemoveSolidFlags( FSOLID_NOT_SOLID ); if (m_bDriverDucked) { SetCollisionBounds( Vector(-16,-16,0), Vector(16,16,45) ); int nSequence = LookupSequence( "crouch" ); DevMsg("Player is ducking\n"); // Set to the desired anim, or default anim if the desired is not present if ( nSequence > ACTIVITY_NOT_AVAILABLE ) { SetCycle( 0 ); m_flAnimTime = gpGlobals->curtime; ResetSequence( nSequence ); ResetClientsideFrame(); } else { // Not available try to get default anim Msg( "Manhack Controller %s: missing crouch sequence\n", GetDebugName() ); SetSequence( 0 ); } } else { SetCollisionBounds( Vector(-16,-16,0), Vector(16,16,72) ); int nSequence = LookupSequence( "idle" ); // Set to the desired anim, or default anim if the desired is not present if ( nSequence > ACTIVITY_NOT_AVAILABLE ) { SetCycle( 0 ); m_flAnimTime = gpGlobals->curtime; ResetSequence( nSequence ); ResetClientsideFrame(); } } // Start Thinking SetNextThink( gpGlobals->curtime ); } else { // NPCs not yet supported - jdw Assert( 0 ); } }