//----------------------------------------------------------------------------- // Purpose: Attach to the vehicle if we're able //----------------------------------------------------------------------------- bool CAI_PassengerBehaviorZombie::AttachToVehicle( void ) { // Must be able to enter the vehicle if ( m_hVehicle->NPC_CanEnterVehicle( GetOuter(), false ) == false ) return false; // Reserve the seat if ( ReserveEntryPoint( VEHICLE_SEAT_ANY ) == false ) return false; // Use the best one we've found int nSequence = FindEntrySequence(); if ( nSequence == -1 ) return false; // Take the transition sequence SetTransitionSequence( nSequence ); // Get in the vehicle EnterVehicle(); // Start our scripted sequence with any other passengers // Find Alyx // TODO: Iterate through the list of passengers in the vehicle and find one we can interact with CNPC_Alyx *pAlyx = CNPC_Alyx::GetAlyx(); if ( pAlyx ) { // Tell Alyx to play along! pAlyx->ForceVehicleInteraction( GetOuter()->GetSequenceName( nSequence ), GetOuter() ); } return true; }
void Unit::ConvertToVehicle(CreatureProto *cp, bool skip_non_vehicle, bool is_mount) { if( cp == NULL || ( skip_non_vehicle == true && cp->vehicleId==0 ) ) return; m_vehicle_data = new Vehicle( this ); m_vehicle_data->proto = cp; //the main thing m_vehicle_data->LoadFromDB(); //set local variables based on vehicle type m_vehicle_data->IsMount = is_mount; //unmounting controller kicks our the rest of the passangers if( is_mount ) EnterVehicle( m_vehicle_data, 0 ); m_vehicle_data->LoadStaticPassengers(); //attach units to it in case he has. Crap, what if we are not added to world yet ? Well you should convert a vehicle after adding to world :P }