From c041db99097241996d802fef42e5d4f28e549246 Mon Sep 17 00:00:00 2001 From: mittorn Date: Sat, 4 Aug 2018 20:59:07 +0700 Subject: [PATCH] Prevent skipping SetMoveDone call --- dlls/subs.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/subs.cpp b/dlls/subs.cpp index 2a299ce4..e24a5c08 100644 --- a/dlls/subs.cpp +++ b/dlls/subs.cpp @@ -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 );