File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1304,6 +1304,8 @@ bool Npc::implGoTo(uint64_t dt) {
13041304 } else {
13051305 // use smaller threshold, to avoid edge-looping in script
13061306 dist = MoveAlgo::closeToPointThreshold*0 .5f ;
1307+ if (!mvAlgo.checkLastBounce ())
1308+ dist = MoveAlgo::closeToPointThreshold*1 .5f ;
13071309 if (go2.wp !=nullptr && go2.wp ->useCounter ()>1 )
13081310 dist += 100 ;
13091311 }
Original file line number Diff line number Diff line change @@ -849,10 +849,12 @@ WayPath World::wayTo(const Npc &npc, const WayPoint &end) const {
849849 auto p = npc.position ();
850850
851851 auto begin = npc.currentWayPoint ();
852+ if (begin==&end && MoveAlgo::isClose (npc.position (),end)) {
853+ return WayPath ();
854+ }
852855 if (begin && !begin->isFreePoint () && MoveAlgo::isClose (npc.position (),*begin)) {
853856 return wmatrix->wayTo (&begin,1 ,p,end);
854857 }
855-
856858 auto near = wmatrix->findWayPoint (p, [&npc](const WayPoint &wp) {
857859 if (!npc.canSeeNpc (wp.x ,wp.y +10 ,wp.z ,true ))
858860 return false ;
@@ -866,8 +868,11 @@ WayPath World::wayTo(const Npc &npc, const WayPoint &end) const {
866868
867869 std::vector<const WayPoint*> wpoint;
868870 wpoint.push_back (near);
869- for (auto & i:near->connections ())
870- wpoint.push_back (i.point );
871+ for (auto & i:near->connections ()) {
872+ auto p = i.point ->position ();
873+ if (npc.canSeeNpc (p.x ,p.y +10 ,p.z ,true ))
874+ wpoint.push_back (i.point );
875+ }
871876
872877 return wmatrix->wayTo (wpoint.data (),wpoint.size (),p,end);
873878 }
You can’t perform that action at this time.
0 commit comments