diff --git a/Nasal/autopush.nas b/Nasal/autopush.nas index 18dbb4f5..d024c7e2 100644 --- a/Nasal/autopush.nas +++ b/Nasal/autopush.nas @@ -42,6 +42,7 @@ var _loop = func() { var time = getprop("/sim/time/elapsed-sec"); var prop = math.min(math.max(_K_p * deltaV, -_F_p), _F_p); var speedup = getprop("/sim/speed-up"); + var deriv = 0; dt = time - _time; # XXX Sanitising dt. Smaller chance of freakout on lag spike. if(dt > 0.0) { diff --git a/Nasal/autopush_route.nas b/Nasal/autopush_route.nas index 606c9ff5..4e57284b 100644 --- a/Nasal/autopush_route.nas +++ b/Nasal/autopush_route.nas @@ -26,9 +26,13 @@ var _D_min = nil; var _add = func(pos) { if (_N) { var (A, S) = courseAndDistance(_user_points.arr[_N - 1], pos); - if (S * NM2M < 3 * _D_min) { + S *= NM2M; + if (S < 3 * _D_min) { gui.popupTip("Too close to the previous point,\ntry again"); return; + }else if (S > 10000.0) { + gui.popupTip("Too far from the previous point,\ntry again"); + return; } } _user_points.add(geo.Coord.new(pos)); @@ -126,7 +130,7 @@ var _clear_waypoint_models = func() { } var _set_view = func() { - if(!getprop("/sim/current-view/internal")){ + if (!getprop("/sim/current-view/internal")){ _view_changed_or_external = 1; return; }