X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fnavigation.qc;fp=qcsrc%2Fserver%2Fbot%2Fdefault%2Fnavigation.qc;h=01352d0e4d94ba4702fdb727a8818dc1e946d02b;hp=d53922f589a7277e8d30fefe578c9a19097e4016;hb=5d6b967bf27d726370078c61b1b894d2486fb4b3;hpb=dc141acff9b80547084cbb83f52e83a7be95eceb 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)