Merge remote-tracking branch 'origin/terencehill/bot_waypoints' into terencehill...
authorterencehill <piuntn@gmail.com>
Sat, 2 Dec 2017 21:36:00 +0000 (22:36 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 2 Dec 2017 21:36:00 +0000 (22:36 +0100)
# Conflicts:
# qcsrc/server/bot/default/navigation.qh

1  2 
defaultServer.cfg
qcsrc/common/triggers/trigger/jumppads.qc
qcsrc/server/autocvars.qh
qcsrc/server/bot/default/havocbot/roles.qc
qcsrc/server/bot/default/navigation.qc
qcsrc/server/mutators/mutator/gamemode_cts.qc

Simple merge
Simple merge
@@@ -89,97 -39,6 +89,97 @@@ void navigation_dynamicgoal_unset(entit
        this.nearestwaypointtimeout = -1;
  }
  
-               vector wm1 = ent.origin + ent.mins - eZ * (PL_MAX_CONST.z - 1);
-               vector wm2 = ent.origin + ent.maxs - eZ * (PL_MIN_CONST.z + 1);
 +// returns point of ent closer to org
 +vector get_closer_dest(entity ent, vector org)
 +{
 +      vector dest = '0 0 0';
 +      if ((ent.classname != "waypoint") || ent.wpisbox)
 +      {
-               vector wm1 = ent.origin + ent.mins - eZ * (PL_MAX_CONST.z - 1);
-               vector wm2 = ent.origin + ent.maxs - eZ * (PL_MIN_CONST.z + 1);
++              vector wm1 = ent.origin + ent.mins;
++              vector wm2 = ent.origin + ent.maxs;
 +              dest.x = bound(wm1.x, org.x, wm2.x);
 +              dest.y = bound(wm1.y, org.y, wm2.y);
 +              dest.z = bound(wm1.z, org.z, wm2.z);
 +      }
 +      else
 +              dest = ent.origin;
 +      return dest;
 +}
 +
 +void set_tracewalk_dest(entity ent, vector org, bool fix_player_dest)
 +{
 +      if ((ent.classname != "waypoint") || ent.wpisbox)
 +      {
-               vector wm1 = ent.origin + ent.mins - eZ * (PL_MAX_CONST.z - 1);
-               vector wm2 = ent.origin + ent.maxs - eZ * (PL_MIN_CONST.z + 1);
++              vector wm1 = ent.origin + ent.mins;
++              vector wm2 = ent.origin + ent.maxs;
 +              if (IS_PLAYER(ent) || IS_MONSTER(ent))
 +              {
 +                      // move destination point out of player bbox otherwise tracebox always fails
 +                      // (if bot_navigation_ignoreplayers is false)
 +                      wm1 += vec2(PL_MIN_CONST) + '-1 -1 0';
 +                      wm2 += vec2(PL_MAX_CONST) + '1 1 0';
 +              }
 +              // set destination point to x and y coords of ent that are closer to org
 +              // z coord is set to ent's min height
 +              tracewalk_dest.x = bound(wm1.x, org.x, wm2.x);
 +              tracewalk_dest.y = bound(wm1.y, org.y, wm2.y);
 +              tracewalk_dest.z = wm1.z;
 +              tracewalk_dest_height = wm2.z - wm1.z; // destination height
 +      }
 +      else
 +      {
 +              tracewalk_dest = ent.origin;
 +              tracewalk_dest_height = 0;
 +      }
 +      if (fix_player_dest && IS_PLAYER(ent) && !IS_ONGROUND(ent))
 +      {
 +              // snap player to the ground
 +              if (org.x == tracewalk_dest.x && org.y == tracewalk_dest.y)
 +              {
 +                      // bot is right under the player
 +                      tracebox(ent.origin, ent.mins, ent.maxs, ent.origin - '0 0 700', MOVE_NORMAL, ent);
 +                      tracewalk_dest = trace_endpos;
 +                      tracewalk_dest_height = 0;
 +              }
 +              else
 +              {
 +                      tracebox(tracewalk_dest, ent.mins, ent.maxs, tracewalk_dest - '0 0 700', MOVE_NORMAL, ent);
 +                      if (!trace_startsolid && tracewalk_dest.z - trace_endpos.z > 0)
 +                      {
 +                              tracewalk_dest_height = tracewalk_dest.z - trace_endpos.z;
 +                              tracewalk_dest.z = trace_endpos.z;
 +                      }
 +              }
 +      }
 +}
 +
 +// returns point of ent closer to org
 +vector set_tracewalk_dest_2(entity ent, vector org)
 +{
 +      vector closer_dest = '0 0 0';
 +      if ((ent.classname != "waypoint") || ent.wpisbox)
 +      {
++              vector wm1 = ent.origin + ent.mins;
++              vector wm2 = ent.origin + ent.maxs;
 +              closer_dest.x = bound(wm1.x, org.x, wm2.x);
 +              closer_dest.y = bound(wm1.y, org.y, wm2.y);
 +              closer_dest.z = bound(wm1.z, org.z, wm2.z);
 +              // set destination point to x and y coords of ent that are closer to org
 +              // z coord is set to ent's min height
 +              tracewalk_dest.x = closer_dest.x;
 +              tracewalk_dest.y = closer_dest.y;
 +              tracewalk_dest.z = wm1.z;
 +              tracewalk_dest_height = wm2.z - wm1.z; // destination height
 +      }
 +      else
 +      {
 +              closer_dest = ent.origin;
 +              tracewalk_dest = closer_dest;
 +              tracewalk_dest_height = 0;
 +      }
 +      return closer_dest;
 +}
 +
  bool navigation_check_submerged_state(entity ent, vector pos)
  {
        bool submerged;