mirror of
https://github.com/mapbase-source/source-sdk-2013.git
synced 2024-12-28 07:45:29 +03:00
Added speed modifier to scanners and rollermines
This commit is contained in:
parent
a1bc5196f2
commit
6d04c46dc0
@ -1278,6 +1278,14 @@ void CNPC_BaseScanner::MoveToTarget( float flInterval, const Vector &vecMoveTarg
|
|||||||
myZAccel = flDist / flInterval;
|
myZAccel = flDist / flInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_flSpeedModifier != 1.0f)
|
||||||
|
{
|
||||||
|
myAccel *= m_flSpeedModifier;
|
||||||
|
//myZAccel *= m_flSpeedModifier;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
MoveInDirection( flInterval, targetDir, myAccel, myZAccel, myDecay );
|
MoveInDirection( flInterval, targetDir, myAccel, myZAccel, myDecay );
|
||||||
|
|
||||||
// calc relative banking targets
|
// calc relative banking targets
|
||||||
|
@ -310,6 +310,16 @@ protected:
|
|||||||
|
|
||||||
bool IsActive() { return m_flActiveTime > gpGlobals->curtime ? false : true; }
|
bool IsActive() { return m_flActiveTime > gpGlobals->curtime ? false : true; }
|
||||||
|
|
||||||
|
inline float GetForwardSpeed() const
|
||||||
|
{
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_flSpeedModifier != 1.0f)
|
||||||
|
return m_flForwardSpeed * m_flSpeedModifier;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return m_flForwardSpeed;
|
||||||
|
}
|
||||||
|
|
||||||
// INPCInteractive Functions
|
// INPCInteractive Functions
|
||||||
virtual bool CanInteractWith( CAI_BaseNPC *pUser ) { return true; }
|
virtual bool CanInteractWith( CAI_BaseNPC *pUser ) { return true; }
|
||||||
virtual bool HasBeenInteractedWith() { return m_bHackedByAlyx; }
|
virtual bool HasBeenInteractedWith() { return m_bHackedByAlyx; }
|
||||||
@ -1313,7 +1323,7 @@ void CNPC_RollerMine::RunTask( const Task_t *pTask )
|
|||||||
Vector vecRight;
|
Vector vecRight;
|
||||||
AngleVectors( QAngle( 0, yaw, 0 ), NULL, &vecRight, NULL );
|
AngleVectors( QAngle( 0, yaw, 0 ), NULL, &vecRight, NULL );
|
||||||
|
|
||||||
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, -m_flForwardSpeed * 5 );
|
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, -GetForwardSpeed() * 5 );
|
||||||
|
|
||||||
TaskComplete();
|
TaskComplete();
|
||||||
return;
|
return;
|
||||||
@ -1323,6 +1333,8 @@ void CNPC_RollerMine::RunTask( const Task_t *pTask )
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
float flForwardSpeed = GetForwardSpeed();
|
||||||
|
|
||||||
float yaw = UTIL_VecToYaw( GetNavigator()->GetCurWaypointPos() - GetLocalOrigin() );
|
float yaw = UTIL_VecToYaw( GetNavigator()->GetCurWaypointPos() - GetLocalOrigin() );
|
||||||
|
|
||||||
Vector vecRight;
|
Vector vecRight;
|
||||||
@ -1362,17 +1374,17 @@ void CNPC_RollerMine::RunTask( const Task_t *pTask )
|
|||||||
vecCompensate.y = -vecVelocity.x;
|
vecCompensate.y = -vecVelocity.x;
|
||||||
vecCompensate.z = 0;
|
vecCompensate.z = 0;
|
||||||
|
|
||||||
m_RollerController.m_vecAngular = WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecCompensate, m_flForwardSpeed * -0.75 );
|
m_RollerController.m_vecAngular = WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecCompensate, flForwardSpeed * -0.75 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_bHackedByAlyx )
|
if( m_bHackedByAlyx )
|
||||||
{
|
{
|
||||||
// Move faster.
|
// Move faster.
|
||||||
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, m_flForwardSpeed * 2.0f );
|
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, flForwardSpeed * 2.0f );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, m_flForwardSpeed );
|
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, flForwardSpeed );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1496,8 +1508,10 @@ void CNPC_RollerMine::RunTask( const Task_t *pTask )
|
|||||||
vecCompensate.z = 0;
|
vecCompensate.z = 0;
|
||||||
VectorNormalize( vecCompensate );
|
VectorNormalize( vecCompensate );
|
||||||
|
|
||||||
m_RollerController.m_vecAngular = WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecCompensate, m_flForwardSpeed * -0.75 );
|
float flForwardSpeed = GetForwardSpeed();
|
||||||
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, m_flForwardSpeed * flTorqueFactor );
|
|
||||||
|
m_RollerController.m_vecAngular = WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecCompensate, flForwardSpeed * -0.75 );
|
||||||
|
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, flForwardSpeed * flTorqueFactor );
|
||||||
|
|
||||||
// Taunt when I get closer
|
// Taunt when I get closer
|
||||||
if( !(m_iSoundEventFlags & ROLLERMINE_SE_TAUNT) && UTIL_DistApprox( GetLocalOrigin(), vecTargetPosition ) <= 400 )
|
if( !(m_iSoundEventFlags & ROLLERMINE_SE_TAUNT) && UTIL_DistApprox( GetLocalOrigin(), vecTargetPosition ) <= 400 )
|
||||||
@ -1615,8 +1629,10 @@ void CNPC_RollerMine::RunTask( const Task_t *pTask )
|
|||||||
vecCompensate.z = 0;
|
vecCompensate.z = 0;
|
||||||
VectorNormalize( vecCompensate );
|
VectorNormalize( vecCompensate );
|
||||||
|
|
||||||
m_RollerController.m_vecAngular = WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecCompensate, m_flForwardSpeed * -0.75 );
|
float flForwardSpeed = GetForwardSpeed();
|
||||||
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, m_flForwardSpeed * flTorqueFactor );
|
|
||||||
|
m_RollerController.m_vecAngular = WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecCompensate, flForwardSpeed * -0.75 );
|
||||||
|
m_RollerController.m_vecAngular += WorldToLocalRotation( SetupMatrixAngles(GetLocalAngles()), vecRight, flForwardSpeed * flTorqueFactor );
|
||||||
|
|
||||||
// Once we're near the player, slow & stop
|
// Once we're near the player, slow & stop
|
||||||
if ( GetAbsOrigin().DistToSqr( vecTargetPosition ) < (ROLLERMINE_RETURN_TO_PLAYER_DIST*2.0) )
|
if ( GetAbsOrigin().DistToSqr( vecTargetPosition ) < (ROLLERMINE_RETURN_TO_PLAYER_DIST*2.0) )
|
||||||
@ -2572,6 +2588,12 @@ float CNPC_RollerMine::RollingSpeed()
|
|||||||
float rollingSpeed = angVel.Length() - 90;
|
float rollingSpeed = angVel.Length() - 90;
|
||||||
rollingSpeed = clamp( rollingSpeed, 1, MAX_ROLLING_SPEED );
|
rollingSpeed = clamp( rollingSpeed, 1, MAX_ROLLING_SPEED );
|
||||||
rollingSpeed *= (1/MAX_ROLLING_SPEED);
|
rollingSpeed *= (1/MAX_ROLLING_SPEED);
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_flSpeedModifier != 1.0f)
|
||||||
|
{
|
||||||
|
rollingSpeed *= m_flSpeedModifier;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return rollingSpeed;
|
return rollingSpeed;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2567,6 +2567,14 @@ void CNPC_CScanner::MoveToTarget( float flInterval, const Vector &vecMoveTarget
|
|||||||
myZAccel = flDist / flInterval;
|
myZAccel = flDist / flInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MAPBASE
|
||||||
|
if (m_flSpeedModifier != 1.0f)
|
||||||
|
{
|
||||||
|
myAccel *= m_flSpeedModifier;
|
||||||
|
//myZAccel *= m_flSpeedModifier;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
MoveInDirection( flInterval, targetDir, myAccel, myZAccel, myDecay );
|
MoveInDirection( flInterval, targetDir, myAccel, myZAccel, myDecay );
|
||||||
|
|
||||||
// calc relative banking targets
|
// calc relative banking targets
|
||||||
|
Loading…
Reference in New Issue
Block a user