2
0
mirror of https://github.com/FWGS/hlsdk-xash3d synced 2024-11-22 18:05:23 +01:00

Prevent skipping SetMoveDone call

This commit is contained in:
mittorn 2018-08-04 20:59:07 +07:00 committed by Alibek Omarov
parent 8ef6cb2427
commit c041db9909

View File

@ -407,6 +407,13 @@ void CBaseToggle::LinearMove( Vector vecDest, float flSpeed )
// divide vector length by speed to get time to reach dest
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
pev->nextthink = pev->ltime + flTravelTime;
SetThink( &CBaseToggle::LinearMoveDone );