From: terencehill Date: Thu, 14 Jun 2018 11:00:40 +0000 (+0200) Subject: Bot waypoints: fix waypoint link creation ignoring botclip surfaces. Apply the same... X-Git-Tag: xonotic-v0.8.5~2059 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=862e4b2e6a3e1a771b406e634a1de880b8d3159c;p=xonotic%2Fxonotic-data.pk3dir.git Bot waypoints: fix waypoint link creation ignoring botclip surfaces. Apply the same logic to the debug command "sv_cmd trace walk" --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index 9334f011a..9c3bae8e7 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -246,6 +246,7 @@ vector resurface_limited(vector org, float lim, vector m1) // rough simulation of walking from one point to another to test if a path // can be traveled, used for waypoint linking and havocbot // if end_height is > 0 destination is any point in the vertical segment [end, end + end_height * eZ] +// INFO: the command sv_cmd trace walk is useful to test this function in game bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float end_height, float movemode) { if(autocvar_bot_debug_tracewalk) @@ -1838,7 +1839,7 @@ void navigation_unstuck(entity this) float d = vlen2(this.origin - bot_waypoint_queue_goal.origin); LOG_DEBUG(this.netname, " evaluating ", bot_waypoint_queue_goal.classname, " with distance ", ftos(d)); set_tracewalk_dest(bot_waypoint_queue_goal, this.origin, false); - if (tracewalk(bot_waypoint_queue_goal, this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), + if (tracewalk(this, this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), tracewalk_dest, tracewalk_dest_height, bot_navigation_movemode)) { if( d > bot_waypoint_queue_bestgoalrating) diff --git a/qcsrc/server/bot/default/waypoints.qc b/qcsrc/server/bot/default/waypoints.qc index bc29b31da..b673ecf8c 100644 --- a/qcsrc/server/bot/default/waypoints.qc +++ b/qcsrc/server/bot/default/waypoints.qc @@ -567,6 +567,9 @@ void waypoint_think(entity this) bot_calculate_stepheightvec(); + int dphitcontentsmask_save = this.dphitcontentsmask; + this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; + bot_navigation_movemode = ((autocvar_bot_navigation_ignoreplayers) ? MOVE_NOMONSTERS : MOVE_NORMAL); //dprint("waypoint_think wpisbox = ", ftos(this.wpisbox), "\n"); @@ -619,7 +622,7 @@ void waypoint_think(entity this) relink_walkculled += 0.5; else { - if (tracewalk(it, ev, PL_MIN_CONST, PL_MAX_CONST, sv2, sv2_height, MOVE_NOMONSTERS)) + if (tracewalk(this, ev, PL_MIN_CONST, PL_MAX_CONST, sv2, sv2_height, MOVE_NOMONSTERS)) waypoint_addlink(it, this); else relink_walkculled += 0.5; @@ -628,6 +631,7 @@ void waypoint_think(entity this) }); navigation_testtracewalk = 0; this.wplinked = true; + this.dphitcontentsmask = dphitcontentsmask_save; } void waypoint_clearlinks(entity wp) diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 29b300885..2903f5535 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -1571,10 +1571,13 @@ void GameCommand_trace(float request, float argc) if (argc == 4 || argc == 5) { e = nextent(NULL); + int dphitcontentsmask_save = e.dphitcontentsmask; + e.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP | DPCONTENTS_BOTCLIP; if (tracewalk(e, stov(argv(2)), e.mins, e.maxs, stov(argv(3)), stof(argv(4)), MOVE_NORMAL)) LOG_INFO("can walk"); else LOG_INFO("cannot walk"); + e.dphitcontentsmask = dphitcontentsmask_save; return; } }