]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Avoid searching the nearest wapoint for items that remain always on the same place...
authormand1nga <mand1nga@xonotic.org>
Sat, 13 Aug 2011 03:27:38 +0000 (00:27 -0300)
committermand1nga <mand1nga@xonotic.org>
Sat, 13 Aug 2011 03:27:38 +0000 (00:27 -0300)
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/navigation.qh

index 258d3d1770fe1c023991106bd15bb7bd063be40e..ee1d60ffa4422c989d23d8400e9a7225e1b7a79a 100644 (file)
@@ -644,6 +644,9 @@ void navigation_routerating(entity e, float f, float rangebias)
        if (!e)
                return;
 
+       if(e.blacklisted)
+               return;
+
        //print("routerating ", etos(e), " = ", ftos(f), " - ", ftos(rangebias), "\n");
 
        // Evaluate path using jetpack
@@ -745,14 +748,48 @@ void navigation_routerating(entity e, float f, float rangebias)
        }
        else
        {
+               float search;
+
+               search = TRUE;
+
+               if(e.flags & FL_ITEM)
+               {
+                       if not(e.flags & FL_WEAPON)
+                       if(e.nearestwaypoint)
+                               search = FALSE;
+               }
+               else if (e.flags & FL_WEAPON)
+               {
+                       if(e.classname != "droppedweapon")
+                       if(e.nearestwaypoint)
+                               search = FALSE;
+               }
+
+               if(search)
                if (time > e.nearestwaypointtimeout)
                {
                        nwp = navigation_findnearestwaypoint(e, TRUE);
                        if(nwp)
                                e.nearestwaypoint = nwp;
                        else
+                       {
                                dprint("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e), "\n");
 
+                               if(e.flags & FL_ITEM)
+                                       e.blacklisted = TRUE;
+                               else if (e.flags & FL_WEAPON)
+                               {
+                                       if(e.classname != "droppedweapon")
+                                               e.blacklisted = TRUE;
+                               }
+
+                               if(e.blacklisted)
+                               {
+                                       dprint("The entity '", e.classname, "' is going to be excluded from path finding during this match\n");
+                                       return;
+                               }
+                       }
+
                        // TODO: Cleaner solution, probably handling this timeout from ctf.qc
                        if(e.classname=="item_flag_team")
                                e.nearestwaypointtimeout = time + 2;
index 0a9bf14010d17176eab4a7740b9b997f2facd622..8b227afd9397899ffe1d4d7d9029221276de6146 100644 (file)
@@ -27,6 +27,8 @@ entity navigation_bestgoal;
 .float navigation_hasgoals;
 .float lastteleporttime;
 
+.float blacklisted;
+
 .entity navigation_jetpack_goal;
 .vector navigation_jetpack_point;