mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-01-11 15:38:12 +00:00
Prevent skipping SetMoveDone call
This commit is contained in:
parent
8ef6cb2427
commit
c041db9909
@ -407,6 +407,13 @@ void CBaseToggle::LinearMove( Vector vecDest, float flSpeed )
|
|||||||
// divide vector length by speed to get time to reach dest
|
// divide vector length by speed to get time to reach dest
|
||||||
float flTravelTime = vecDestDelta.Length() / flSpeed;
|
float flTravelTime = vecDestDelta.Length() / flSpeed;
|
||||||
|
|
||||||
|
if( flTravelTime < 0.05 )
|
||||||
|
{
|
||||||
|
UTIL_SetOrigin( pev, m_vecFinalDest );
|
||||||
|
LinearMoveDone();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// set nextthink to trigger a call to LinearMoveDone when dest is reached
|
// set nextthink to trigger a call to LinearMoveDone when dest is reached
|
||||||
pev->nextthink = pev->ltime + flTravelTime;
|
pev->nextthink = pev->ltime + flTravelTime;
|
||||||
SetThink( &CBaseToggle::LinearMoveDone );
|
SetThink( &CBaseToggle::LinearMoveDone );
|
||||||
|
Loading…
Reference in New Issue
Block a user