]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into mand1nga/pathfinding-optimizations
authormand1nga <mand1nga@xonotic.org>
Mon, 15 Aug 2011 04:56:12 +0000 (01:56 -0300)
committermand1nga <mand1nga@xonotic.org>
Mon, 15 Aug 2011 04:56:12 +0000 (01:56 -0300)
1  2 
qcsrc/server/bot/navigation.qc
qcsrc/server/bot/navigation.qh

index 2d66b021327e116231d567c989b2f77c7728d388,749b78fed6546eb7c9460dd88a00cfa2d43b07e3..4f680284eec19ff96b3b6bcfbfa3477a04d9abd7
@@@ -133,8 -133,8 +133,8 @@@ float tracewalk(entity e, vector start
                        // hit something
                        if (trace_fraction < 1)
                        {
-                               // check if we can walk over this obstacle
-                               tracebox(org + stepheightvec, m1, m2, move + stepheightvec, movemode, e);
+                               // check if we can walk over this obstacle, possibly by jumpstepping
+                               tracebox(org + jumpstepheightvec, m1, m2, move + jumpstepheightvec, movemode, e);
                                if (trace_fraction < 1 || trace_startsolid)
                                {
                                        if(autocvar_bot_debug_tracewalk)
@@@ -645,11 -645,7 +645,11 @@@ void navigation_routerating(entity e, f
        if (!e)
                return;
  
 +      if(e.blacklisted)
 +              return;
 +
        o = (e.absmin + e.absmax) * 0.5;
 +
        //print("routerating ", etos(e), " = ", ftos(f), " - ", ftos(rangebias), "\n");
  
        // Evaluate path using jetpack
        }
        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 8b227afd9397899ffe1d4d7d9029221276de6146,8971692de03193c546f0a33ac09eb65709038884..b3b40ce03e55443be1c82e8e362f354381e82483
@@@ -6,6 -6,7 +6,7 @@@ float navigation_bestrating
  float bot_navigation_movemode;
  float navigation_testtracewalk;
  
+ vector jumpstepheightvec;
  vector stepheightvec;
  
  entity botframe_dangerwaypoint;
@@@ -27,8 -28,6 +28,8 @@@ entity navigation_bestgoal
  .float navigation_hasgoals;
  .float lastteleporttime;
  
 +.float blacklisted;
 +
  .entity navigation_jetpack_goal;
  .vector navigation_jetpack_point;