From: terencehill Date: Sat, 28 Sep 2019 10:11:22 +0000 (+0200) Subject: Allow removing waypoints in the air and seeing jumppad/telepport waypoint links ... X-Git-Tag: xonotic-v0.8.5~1259 X-Git-Url: http://git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=5d6b967bf27d726370078c61b1b894d2486fb4b3 Allow removing waypoints in the air and seeing jumppad/telepport waypoint links (at some point somehow a commit of mine broke this feature) --- diff --git a/qcsrc/server/bot/default/navigation.qc b/qcsrc/server/bot/default/navigation.qc index d53922f58..01352d0e4 100644 --- a/qcsrc/server/bot/default/navigation.qc +++ b/qcsrc/server/bot/default/navigation.qc @@ -921,19 +921,33 @@ entity navigation_findnearestwaypoint_withdist_except(entity ent, float walkfrom vector pm1 = ent.origin + ent.mins; vector pm2 = ent.origin + ent.maxs; - // do two scans, because box test is cheaper - IL_EACH(g_waypoints, it != ent && it != except && !(it.wpflags & (WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_JUMP)), + if (autocvar_g_waypointeditor && !IS_BOT_CLIENT(ent)) { - if(boxesoverlap(pm1, pm2, it.absmin, it.absmax)) + // this code allows removing waypoints in the air and seeing jumppad/telepport waypoint links + // FIXME it causes a bug where a waypoint spawned really close to another one (max 16 qu) + // isn't detected as the nearest waypoint + IL_EACH(g_waypoints, it != ent && it != except, { - if(!autocvar_g_waypointeditor && walkfromwp && !ent.navigation_dynamicgoal) + if (boxesoverlap(pm1, pm2, it.absmin, it.absmax)) + return it; + }); + } + else + { + // do two scans, because box test is cheaper + IL_EACH(g_waypoints, it != ent && it != except && !(it.wpflags & (WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_JUMP)), + { + if(boxesoverlap(pm1, pm2, it.absmin, it.absmax)) { - waypoint_clearlinks(ent); // initialize wpXXmincost fields - navigation_item_addlink(it, ent); + if(walkfromwp && !ent.navigation_dynamicgoal) + { + waypoint_clearlinks(ent); // initialize wpXXmincost fields + navigation_item_addlink(it, ent); + } + return it; } - return it; - } - }); + }); + } vector org = ent.origin; if (navigation_testtracewalk)