//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropVehicleViewController::InputForcePlayerIn( inputdata_t &inputdata )
{
	CBasePlayer *pPlayer = UTIL_PlayerByIndex(1);
	if ( !pPlayer )
		return;

	ResetUseKey( pPlayer );

	// Get the entry animation from the input
	int iEntryAnim = ACTIVITY_NOT_AVAILABLE;
	if ( inputdata.value.StringID() != NULL_STRING )
	{
		iEntryAnim = LookupSequence( inputdata.value.String() );
		if ( iEntryAnim == ACTIVITY_NOT_AVAILABLE )
		{
			Warning("vehicle_viewcontroller %s could not find specified entry animation %s\n", STRING(GetEntityName()), inputdata.value.String() );
			return;
		}
	}

	// Make sure we successfully got in the vehicle
	if ( pPlayer->GetInVehicle( GetServerVehicle(), VEHICLE_ROLE_DRIVER ) == false )
	{
		// The player was unable to enter the vehicle and the output has failed
		Assert( 0 );
		return;
	}

	// Setup the "enter" vehicle sequence
	SetCycle( 0 );
	m_flAnimTime = gpGlobals->curtime;
	ResetSequence( iEntryAnim );
	ResetClientsideFrame();
	m_bEnterAnimOn = true;
}
예제 #2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropVehicleDriveable::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	CBasePlayer *pPlayer = ToBasePlayer( pActivator );
	if ( !pPlayer )
		return;

	ResetUseKey( pPlayer );

	// Find out which hitbox the player's eyepoint is within
	int iEntryAnim = m_pServerVehicle->GetEntryAnimForPoint( pPlayer->EyePosition() );

	// Are we in an entrypoint zone? 
	if ( iEntryAnim != ACTIVITY_NOT_AVAILABLE )
	{
		// Check to see if this vehicle can be controlled or if it's locked
		if ( CanControlVehicle() && CanEnterVehicle(pPlayer) )
		{
			pPlayer->GetInVehicle( GetServerVehicle(), VEHICLE_DRIVER);

			// Setup the "enter" vehicle sequence and skip the animation if it isn't present.
			m_flCycle = 0;
			m_flAnimTime = gpGlobals->curtime;
			ResetSequence( iEntryAnim );
			ResetClientsideFrame();
			m_bEnterAnimOn = true;
		}
	}
}
예제 #3
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropCrane::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{
	CBasePlayer *pPlayer = ToBasePlayer( pActivator );
	if ( !pPlayer )
		return;

	ResetUseKey( pPlayer );

	GetServerVehicle()->HandlePassengerEntry( pPlayer, (value>0) );
}
예제 #4
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropCrane::ExitVehicle( int nRole )
{
	CBasePlayer *pPlayer = m_hPlayer;
	if ( !pPlayer )
		return;

	m_hPlayer = NULL;
	ResetUseKey( pPlayer );
	m_playerOff.FireOutput( pPlayer, this, 0 );
	m_bEnterAnimOn = false;

	m_ServerVehicle.SoundShutdown( 1.0 );
}
void QUA_helicopter::ExitVehicle( int iRole )
{
	CBasePlayer *pPlayer = m_hPlayer;
	if ( !pPlayer )
		return;

	m_hPlayer = NULL;
	ResetUseKey( pPlayer );
	//m_playerOff.FireOutput( pPlayer, this, 0 );
	//m_bEnterAnimOn = false;

	m_pServerVehicle.SoundShutdown( 1.0 );
}
예제 #6
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropVehicleManhack::ExitVehicle( int nRole )
{
	CBasePlayer *pPlayer = m_hPlayer;
	if ( !pPlayer )
		return;

	m_hPlayer = NULL;
	ResetUseKey( pPlayer );


	//We have to snap the eye angles because otherwise the player will look into the same direction that the manhack just did
	Vector vehicleEyeOrigin;
	QAngle vehicleEyeAngles;
	GetAttachment( "vehicle_driver_eyes", vehicleEyeOrigin, vehicleEyeAngles );
	vehicleEyeAngles.x = 0;
	vehicleEyeAngles.y = 0;
	//pPlayer->SetAbsAngles( vehicleEyeAngles );
	//pPlayer->SnapEyeAngles( vehicleEyeAngles );
	pPlayer->SetAbsAngles(GetAbsAngles());
	pPlayer->SnapEyeAngles(GetAbsAngles());
	pPlayer->SetAbsOrigin(GetAbsOrigin());

	if (m_bDriverDucked)
	{
		pPlayer->m_nButtons |= IN_DUCK;
		pPlayer->AddFlag( FL_DUCKING );
		pPlayer->m_Local.m_bDucked = true;
		pPlayer->m_Local.m_bDucking = true;
		pPlayer->m_Local.m_flDucktime = 0.0f;
		pPlayer->SetViewOffset( VEC_DUCK_VIEW );
		pPlayer->SetCollisionBounds( VEC_DUCK_HULL_MIN, VEC_DUCK_HULL_MAX );
	}

	DevMsg("Yes, this did get updated\n");

	CNPC_Manhack *pManhack = dynamic_cast<CNPC_Manhack*>((CBaseEntity*)m_hManhack);
	if (pManhack!=NULL)
	{
		pManhack->SetControllable(false);

		//pManhack->SetRenderMode(kRenderNormal);
		pManhack->RemoveEffects( EF_NODRAW );

		pManhack->ShowRedGlow(true);
	}
}
예제 #7
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropVehicleDriveable::ExitVehicle( int iRole )
{
	CBasePlayer *pPlayer = m_hPlayer;
	if ( !pPlayer )
		return;

	m_hPlayer = NULL;
	ResetUseKey( pPlayer );
	pPlayer->SetViewOffset( m_savedViewOffset );

	m_playerOff.FireOutput( pPlayer, this, 0 );

	// clear out the fire buttons
	m_attackaxis.Set( 0, pPlayer, this );
	m_attack2axis.Set( 0, pPlayer, this );

	m_nSpeed = 0;
	m_flThrottle = 0.0f;

	StopEngine();

	m_VehiclePhysics.GetVehicle()->OnVehicleExit();
}
// HAY UN FALLO AQUI. DEBUGGEAR Y EXAMINAR QUE PASA, PERO NO DEBERIA FALLAR COMO EN EL STRIDER
void QUA_helicopter::Use(CBaseEntity *pActivator,CBaseEntity *pCaller,USE_TYPE useType,float value) {
	
	CBasePlayer *pPlayer = ToBasePlayer( pActivator );
	if ( !pPlayer )
		return;

	// Si ya hay un jugador, y el que lo usa no es el conductor
	// entonces olvidate de usarme, chavalote.
	if (m_hPlayer && pPlayer!=m_hPlayer) 
		return;

	if (pPlayer->m_lifeState!=LIFE_ALIVE)
		return;
	// Si se esta agachando, esta subiendo, esta haciendo lo de la pata
	// o esta disparando el cañon, entonces ni sale ni entra.
	
	
	ResetUseKey( pPlayer );

	GetServerVehicle()->HandlePassengerEntry( pPlayer, (value>0) );
	//EmitSound( "NPC_Strider.Alert" );
	
}