trigger_init(this);
func_ladder_link(this);
+ vector top = (this.absmin + this.absmax) / 2;
+ top.z = this.absmax.z + 1 - PL_MIN_CONST.z;
+ float height = this.absmax.z - this.absmin.z;
+ waypoint_spawnforteleporter_boxes(this, WAYPOINTFLAG_LADDER, this.absmin, this.absmax, top, top, height);
}
spawnfunc(func_ladder)
#ifdef SVQC
void trigger_push_link(entity this);
void trigger_push_updatelink(entity this);
+bool trigger_push_testorigin(entity e, entity targ, entity jp, vector org)
+{
+ setorigin(e, org);
+ tracetoss(e, e);
+ if(trace_startsolid)
+ return false;
+ if(e.move_movetype == MOVETYPE_NONE)
+ {
+ tracebox(trace_endpos, e.mins, e.maxs, trace_endpos - eZ * 1500, true, jp);
+ return true;
+ }
+ return false;
+}
#endif
void trigger_push_findtarget(entity this)
{
++n;
#ifdef SVQC
entity e = spawn();
- setorigin(e, org);
setsize(e, PL_MIN_CONST, PL_MAX_CONST);
e.velocity = trigger_push_calculatevelocity(org, t, this.height);
- tracetoss(e, e);
- if(e.move_movetype == MOVETYPE_NONE)
- waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+ vector best_target = '0 0 0';
+ vector best_org = '0 0 0';
+ vector best_vel = '0 0 0';
+ bool valid_best_target = false;
+ if (trigger_push_testorigin(e, t, this, org))
+ {
+ best_target = trace_endpos;
+ best_org = org;
+ best_vel = e.velocity;
+ valid_best_target = true;
+ }
+
+ vector new_org;
+ vector dist = t.origin - org;
+ if (dist.x || dist.y) // if not perfectly vertical
+ {
+ // test trajectory with different starting points, sometimes the trajectory
+ // starting from the jumppad origin can't reach the real destination
+ // and destination waypoint ends up near the jumppad itself
+ vector flatdir = normalize(dist - eZ * dist.z);
+ vector ofs = flatdir * 0.5 * min(fabs(this.absmax.x - this.absmin.x), fabs(this.absmax.y - this.absmin.y));
+ new_org = org + ofs;
+ e.velocity = trigger_push_calculatevelocity(new_org, t, this.height);
+ if (trigger_push_testorigin(e, t, this, new_org) && (!valid_best_target || trace_endpos.z > best_target.z + 50))
+ {
+ best_target = trace_endpos;
+ best_org = new_org;
+ best_vel = e.velocity;
+ valid_best_target = true;
+ }
+ new_org = org - ofs;
+ e.velocity = trigger_push_calculatevelocity(new_org, t, this.height);
+ if (trigger_push_testorigin(e, t, this, new_org) && (!valid_best_target || trace_endpos.z > best_target.z + 50))
+ {
+ best_target = trace_endpos;
+ best_org = new_org;
+ best_vel = e.velocity;
+ valid_best_target = true;
+ }
+ }
+ if (valid_best_target)
+ {
+ float distxy = (vlen((best_target - eZ * best_target.z) - (best_org - eZ * best_org.z)));
+ float velxy = vlen(best_vel - eZ * best_vel.z);
+ waypoint_spawnforteleporter(this, best_target, distxy / velxy);
+ }
delete(e);
#endif
}
const int WAYPOINTFLAG_PROTECTED = BIT(18); // Useless WP detection never kills these.
const int WAYPOINTFLAG_USEFUL = BIT(17); // Useless WP detection temporary flag.
const int WAYPOINTFLAG_DEAD_END = BIT(16); // Useless WP detection temporary flag.
+const int WAYPOINTFLAG_LADDER = BIT(15);
entity kh_worldkeylist;
.entity kh_worldkeynext;
bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode);
-void waypoint_remove(entity e);
+void waypoint_remove_fromeditor(entity pl);
+void waypoint_remove(entity wp);
void waypoint_saveall();
void waypoint_schedulerelinkall();
void waypoint_schedulerelink(entity wp);
void waypoint_spawnforitem_force(entity e, vector org);
void waypoint_spawnforteleporter(entity e, vector destination, float timetaken);
void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken);
+void waypoint_spawn_fromeditor(entity pl);
entity waypoint_spawn(vector m1, vector m2, float f);
+void waypoint_unreachable(entity pl);
.entity goalcurrent;
void navigation_clearroute(entity this);
void bot_calculate_stepheightvec()
{
stepheightvec = autocvar_sv_stepheight * '0 0 1';
- jumpstepheightvec = stepheightvec +
- ((autocvar_sv_jumpvelocity * autocvar_sv_jumpvelocity) / (2 * autocvar_sv_gravity)) * '0 0 0.85';
- // 0.75 factor is for safety to make the jumps easy
+ jumpheight_vec = (autocvar_sv_jumpvelocity ** 2) / (2 * autocvar_sv_gravity) * '0 0 1';
+ jumpstepheightvec = stepheightvec + jumpheight_vec * 0.85; // reduce it a bit to make the jumps easy
}
float bot_fixcount()
botframe_spawnedwaypoints = true;
waypoint_loadall();
if(!waypoint_load_links())
- waypoint_schedulerelinkall();
+ waypoint_schedulerelinkall(); // link all the autogenerated waypoints (teleporters)
}
if (bot_list)
destorg.x = bound(m1_x, destorg.x, m2_x);
destorg.y = bound(m1_y, destorg.y, m2_y);
destorg.z = bound(m1_z, destorg.z, m2_z);
+
+ // in case bot ends up inside the teleport waypoint without touching
+ // the teleport itself, head to the teleport origin
+ if(destorg == this.origin)
+ destorg = this.goalcurrent.origin;
+
diff = destorg - this.origin;
//dist = vlen(diff);
dir = normalize(diff);
float stepdist;
float ignorehazards;
float swimming;
- entity tw_ladder = NULL;
if(autocvar_bot_debug_tracewalk)
{
tracebox(org + jumpstepheightvec, m1, m2, move + jumpstepheightvec, movemode, e);
if (trace_fraction < 1 || trace_startsolid)
{
+ bool ladder_found = false;
+ FOREACH_ENTITY_CLASS("func_ladder", true,
+ {
+ if(boxesoverlap(org + jumpheight_vec + m1 + '-1 -1 -1', org + jumpheight_vec + m2 + '1 1 1', it.absmin, it.absmax))
+ if(boxesoverlap(end, end, it.absmin + (m1 - eZ * m1.z - '1 1 0'), it.absmax + (m2 - eZ * m2.z + '1 1 0')))
+ ladder_found = true; // can't return here ("Loop mutex held by tracewalk" error)
+ });
+ if(ladder_found)
+ {
+ if(autocvar_bot_debug_tracewalk)
+ debugnodestatus(end, DEBUG_NODE_SUCCESS);
+
+ //print("tracewalk: ", vtos(start), " can reach ", vtos(end), "\n");
+ return true;
+ }
+
if(autocvar_bot_debug_tracewalk)
debugnodestatus(trace_endpos, DEBUG_NODE_WARNING);
- FOREACH_ENTITY_CLASS("func_ladder", true,
- { it.solid = SOLID_BSP; });
-
traceline( org, move, movemode, e);
- FOREACH_ENTITY_CLASS("func_ladder", true,
- { it.solid = SOLID_TRIGGER; });
-
if ( trace_ent.classname == "door_rotating" || trace_ent.classname == "door")
{
vector nextmove;
move = nextmove;
}
}
- else if (trace_ent.classname == "func_ladder")
- {
- tw_ladder = trace_ent;
- vector ladder_bottom = trace_endpos - dir * m2.x;
- vector ladder_top = ladder_bottom;
- ladder_top.z = trace_ent.absmax.z + (-m1.z + 1);
- tracebox(ladder_bottom, m1, m2, ladder_top, movemode, e);
- if (trace_fraction < 1 || trace_startsolid)
- {
- if(autocvar_bot_debug_tracewalk)
- debugnodestatus(trace_endpos, DEBUG_NODE_FAIL);
-
- return false; // failed
- }
- org = ladder_top + dir * m2.x;
- move = org + dir * stepdist;
- continue;
- }
else
{
if(autocvar_bot_debug_tracewalk)
org = trace_endpos;
}
-
- if(tw_ladder && org.z < tw_ladder.absmax.z)
- {
- // stop tracewalk if destination height is lower than the top of the ladder
- // otherwise bot can't easily figure out climbing direction
- if(autocvar_bot_debug_tracewalk)
- debugnodestatus(org, DEBUG_NODE_FAIL);
-
- return false;
- }
}
//print("tracewalk: ", vtos(start), " did not arrive at ", vtos(end), " but at ", vtos(org), "\n");
entity best = NULL;
vector v;
+ if(!autocvar_g_waypointeditor && !ent.navigation_dynamicgoal)
+ {
+ waypoint_clearlinks(ent); // initialize wpXXmincost fields
+ IL_EACH(g_waypoints, it != ent,
+ {
+ if(it.wpisbox)
+ {
+ vector wm1 = it.absmin;
+ vector wm2 = it.absmax;
+ v.x = bound(wm1_x, org.x, wm2_x);
+ v.y = bound(wm1_y, org.y, wm2_y);
+ v.z = bound(wm1_z, org.z, wm2_z);
+ }
+ else
+ v = it.origin;
+ if(navigation_waypoint_will_link(v, org, ent, walkfromwp, 1050))
+ navigation_item_addlink(it, ent);
+ });
+ }
+
// box check failed, try walk
IL_EACH(g_waypoints, it != ent,
{
if (tracewalk(this, this.origin, this.mins, this.maxs, v, bot_navigation_movemode))
{
it.wpnearestpoint = v;
- it.wpcost = vlen(v - this.origin) + it.dmg;
+ it.wpcost = waypoint_getdistancecost(this.origin, v) + it.dmg;
it.wpfire = 1;
it.enemy = NULL;
c = c + 1;
}
// updates a path link if a spawnfunc_waypoint link is better than the current one
-void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost2, vector p)
+void navigation_markroutes_checkwaypoint(entity w, entity wp, float cost, vector p)
{
vector m1;
vector m2;
}
else
v = wp.origin;
- cost2 = cost2 + vlen(v - p);
- if (wp.wpcost > cost2)
+ if (w.wpflags & WAYPOINTFLAG_TELEPORT)
+ cost += w.wp00mincost; // assuming teleport has exactly one destination
+ else
+ cost += waypoint_getdistancecost(p, v);
+ if (wp.wpcost > cost)
{
- wp.wpcost = cost2;
+ wp.wpcost = cost;
wp.enemy = w;
wp.wpfire = 1;
wp.wpnearestpoint = v;
cost = it.wpcost; // cost to walk from it to home
p = it.wpnearestpoint;
entity wp = it;
- IL_EACH(g_waypoints, true,
+ IL_EACH(g_waypoints, it != wp,
{
- if(wp != it.wp00) if(wp != it.wp01) if(wp != it.wp02) if(wp != it.wp03)
- if(wp != it.wp04) if(wp != it.wp05) if(wp != it.wp06) if(wp != it.wp07)
- if(wp != it.wp08) if(wp != it.wp09) if(wp != it.wp10) if(wp != it.wp11)
- if(wp != it.wp12) if(wp != it.wp13) if(wp != it.wp14) if(wp != it.wp15)
- if(wp != it.wp16) if(wp != it.wp17) if(wp != it.wp18) if(wp != it.wp19)
- if(wp != it.wp20) if(wp != it.wp21) if(wp != it.wp22) if(wp != it.wp23)
- if(wp != it.wp24) if(wp != it.wp25) if(wp != it.wp26) if(wp != it.wp27)
- if(wp != it.wp28) if(wp != it.wp29) if(wp != it.wp30) if(wp != it.wp31)
+ if(!waypoint_islinked(it, wp))
continue;
cost2 = cost + it.dmg;
navigation_markroutes_checkwaypoint(wp, it, cost2, p);
if(e.blacklisted)
return;
+ rangebias = waypoint_getdistancecost_simple(rangebias);
+ f = waypoint_getdistancecost_simple(f);
+
if (IS_PLAYER(e))
{
bool rate_wps = false;
}
}
- vector o = (e.absmin + e.absmax) * 0.5;
+ vector goal_org = (e.absmin + e.absmax) * 0.5;
//print("routerating ", etos(e), " = ", ftos(f), " - ", ftos(rangebias), "\n");
if(g_jetpack)
if(this.items & IT_JETPACK)
if(autocvar_bot_ai_navigation_jetpack)
- if(vdist(this.origin - o, >, autocvar_bot_ai_navigation_jetpack_mindistance))
+ if(vdist(this.origin - goal_org, >, autocvar_bot_ai_navigation_jetpack_mindistance))
{
vector pointa, pointb;
pointa = trace_endpos - '0 0 1';
// Point B
- traceline(o, o + '0 0 65535', MOVE_NORMAL, e);
+ traceline(goal_org, goal_org + '0 0 65535', MOVE_NORMAL, e);
pointb = trace_endpos - '0 0 1';
// Can I see these two points from the sky?
{
nwp = navigation_findnearestwaypoint(e, true);
if(nwp)
+ {
e.nearestwaypoint = nwp;
+
+ vector m1 = nwp.absmin, m2 = nwp.absmax;
+ m1.x = nwp.origin.x; m1.y = nwp.origin.y;
+ m2.x = nwp.origin.x; m2.y = nwp.origin.y;
+ vector ve = (e.absmin - e.absmax) * 0.5;
+ ve.x = bound(m1.x, ve.x, m2.x);
+ ve.y = bound(m1.y, ve.y, m2.y);
+ ve.z = bound(m1.z, ve.z, m2.z);
+
+ m1 = e.absmin; m2 = e.absmax;
+ m1.x = e.origin.x; m1.y = e.origin.y;
+ m2.x = e.origin.x; m2.y = e.origin.y;
+ vector vnwp = nwp.origin;
+ vnwp.x = bound(m1.x, vnwp.x, m2.x);
+ vnwp.y = bound(m1.y, vnwp.y, m2.y);
+ vnwp.z = bound(m1.z, vnwp.z, m2.z);
+ e.nearestwaypoint_dist = vlen(ve - vnwp);
+ }
else
{
LOG_DEBUG("FAILED to find a nearest waypoint to '", e.classname, "' #", etos(e));
if (nwp.wpcost < 10000000)
{
//te_wizspike(nwp.wpnearestpoint);
- LOG_DEBUG(e.classname, " ", ftos(f), "/(1+", ftos((nwp.wpcost + vlen(e.origin - nwp.wpnearestpoint))), "/", ftos(rangebias), ") = ");
- f = f * rangebias / (rangebias + (nwp.wpcost + vlen(o - nwp.wpnearestpoint)));
+ float cost = nwp.wpcost + waypoint_getdistancecost(nwp.wpnearestpoint, goal_org);
+ LOG_DEBUG(e.classname, " ", ftos(f), "/(1+", ftos(cost), "/", ftos(rangebias), ") = ");
+ f = f * rangebias / (rangebias + cost);
LOG_DEBUG("considering ", e.classname, " (with rating ", ftos(f), ")");
if (navigation_bestrating < f)
{
if(nearest_wp && nearest_wp.enemy)
{
// often path can be optimized by not adding the nearest waypoint
- if(tracewalk(this, nearest_wp.enemy.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), (this.goalentity.absmin + this.goalentity.absmax) * 0.5, bot_navigation_movemode))
+ if (this.goalentity.nearestwaypoint_dist < 8
+ || (!this.goalentity.navigation_dynamicgoal && navigation_item_islinked(nearest_wp.enemy, this.goalentity))
+ || (this.goalentity.navigation_dynamicgoal && tracewalk(this, nearest_wp.enemy.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), (this.goalentity.absmin + this.goalentity.absmax) * 0.5, bot_navigation_movemode)))
e = nearest_wp.enemy;
}
IL_EACH(g_waypoints, true,
{
danger = 0;
- m1 = it.mins;
- m2 = it.maxs;
+ m1 = it.absmin;
+ m2 = it.absmax;
IL_EACH(g_bot_dodge, it.bot_dodge,
{
v = it.origin;
v.y = bound(m1_y, v.y, m2_y);
v.z = bound(m1_z, v.z, m2_z);
o = (it.absmin + it.absmax) * 0.5;
- d = it.bot_dodgerating - vlen(o - v);
+ d = waypoint_getdistancecost_simple(it.bot_dodgerating) - waypoint_getdistancecost(o, v);
if (d > 0)
{
traceline(o, v, true, NULL);
vector jumpstepheightvec;
vector stepheightvec;
+vector jumpheight_vec;
entity navigation_bestgoal;
.entity goalstack20, goalstack21, goalstack22, goalstack23;
.entity goalstack24, goalstack25, goalstack26, goalstack27;
.entity goalstack28, goalstack29, goalstack30, goalstack31;
+
.entity nearestwaypoint;
+.float nearestwaypoint_dist;
+.float nearestwaypointtimeout;
+
+/*
+// item it is linked from waypoint it.wpXX (INCOMING link)
+// links are sorted by their cost (wpXXmincost)
+.entity wp00, wp01, wp02, wp03, wp04, wp05, wp06, wp07, wp08, wp09, wp10, wp11, wp12, wp13, wp14, wp15;
+.entity wp16, wp17, wp18, wp19, wp20, wp21, wp22, wp23, wp24, wp25, wp26, wp27, wp28, wp29, wp30, wp31;
+
+.float wp00mincost, wp01mincost, wp02mincost, wp03mincost, wp04mincost, wp05mincost, wp06mincost, wp07mincost;
+.float wp08mincost, wp09mincost, wp10mincost, wp11mincost, wp12mincost, wp13mincost, wp14mincost, wp15mincost;
+.float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost;
+.float wp24mincost, wp25mincost, wp26mincost, wp27mincost, wp28mincost, wp29mincost, wp30mincost, wp31mincost;
+*/
+
+#define navigation_item_islinked(from_wp, to_item) waypoint_islinked(to_item, from_wp)
+#define navigation_item_addlink(from_wp, to_item) \
+ waypoint_addlink_customcost(to_item, from_wp, waypoint_getlinkcost(from_wp, to_item))
+
.entity wp_goal_prev0;
.entity wp_goal_prev1;
-.float nearestwaypointtimeout;
.float lastteleporttime;
.float blacklisted;
#include <common/constants.qh>
#include <common/net_linked.qh>
+#include <common/physics/player.qh>
#include <lib/warpzone/common.qh>
#include <lib/warpzone/util_server.qh>
+.entity spawnpointmodel;
+void waypoint_unreachable(entity pl)
+{
+ IL_EACH(g_waypoints, true,
+ {
+ it.colormod = '0.5 0.5 0.5';
+ it.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
+ });
+ entity e2 = navigation_findnearestwaypoint(pl, false);
+ navigation_markroutes(pl, e2);
+
+ int j = 0;
+ int m = 0;
+ IL_EACH(g_waypoints, it.wpcost >= 10000000,
+ {
+ LOG_INFO("unreachable: ", etos(it), " ", vtos(it.origin), "\n");
+ it.colormod_z = 8;
+ it.effects |= EF_NODEPTHTEST | EF_BLUE;
+ j++;
+ m++;
+ });
+ if (j) LOG_INFOF("%d waypoints cannot be reached from here in any way (marked with blue light)\n", j);
+ navigation_markroutes_inverted(e2);
+
+ j = 0;
+ IL_EACH(g_waypoints, it.wpcost >= 10000000,
+ {
+ LOG_INFO("cannot reach me: ", etos(it), " ", vtos(it.origin), "\n");
+ it.colormod_x = 8;
+ if (!(it.effects & EF_NODEPTHTEST)) // not already reported before
+ m++;
+ it.effects |= EF_NODEPTHTEST | EF_RED;
+ j++;
+ });
+ if (j) LOG_INFOF("%d waypoints cannot walk to here in any way (marked with red light)\n", j);
+ if (m) LOG_INFOF("%d waypoints have been marked total\n", m);
+
+ j = 0;
+ IL_EACH(g_spawnpoints, true,
+ {
+ if (navigation_findnearestwaypoint(it, false))
+ {
+ if(it.spawnpointmodel)
+ {
+ delete(it.spawnpointmodel);
+ it.spawnpointmodel = NULL;
+ }
+ }
+ else
+ {
+ if(!it.spawnpointmodel)
+ {
+ tracebox(it.origin, PL_MIN_CONST, PL_MAX_CONST, it.origin - '0 0 512', MOVE_NOMONSTERS, NULL);
+ entity e = new(spawnpointmodel);
+ vector org = trace_endpos + eZ;
+ setorigin(e, org);
+ e.solid = SOLID_TRIGGER;
+ it.spawnpointmodel = e;
+ }
+ LOG_INFO("spawn without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
+ it.spawnpointmodel.effects |= EF_NODEPTHTEST;
+ _setmodel(it.spawnpointmodel, pl.model);
+ it.spawnpointmodel.frame = pl.frame;
+ it.spawnpointmodel.skin = pl.skin;
+ it.spawnpointmodel.colormap = pl.colormap;
+ it.spawnpointmodel.colormod = pl.colormod;
+ it.spawnpointmodel.glowmod = pl.glowmod;
+ setsize(it.spawnpointmodel, PL_MIN_CONST, PL_MAX_CONST);
+ j++;
+ }
+ });
+ if (j) LOG_INFOF("%d spawnpoints have no nearest waypoint (marked by player model)\n", j);
+
+ j = 0;
+ IL_EACH(g_items, true,
+ {
+ it.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
+ it.colormod = '0.5 0.5 0.5';
+ });
+ IL_EACH(g_items, true,
+ {
+ if (navigation_findnearestwaypoint(it, false))
+ continue;
+ LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
+ it.effects |= EF_NODEPTHTEST | EF_RED;
+ it.colormod_x = 8;
+ j++;
+ });
+ if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked away from (marked with red light)\n", j);
+
+ j = 0;
+ IL_EACH(g_items, true,
+ {
+ if (navigation_findnearestwaypoint(it, true))
+ continue;
+ LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
+ it.effects |= EF_NODEPTHTEST | EF_BLUE;
+ it.colormod_z = 8;
+ j++;
+ });
+ if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked to (marked with blue light)\n", j);
+}
+
+vector waypoint_getSymmetricalOrigin(vector org, int ctf_flags)
+{
+ vector new_org = org;
+ if (fabs(autocvar_g_waypointeditor_symmetrical) == 1)
+ {
+ vector map_center = havocbot_middlepoint;
+ if (autocvar_g_waypointeditor_symmetrical == -1)
+ map_center = autocvar_g_waypointeditor_symmetrical_origin;
+
+ new_org = Rotate(org - map_center, 360 * DEG2RAD / ctf_flags) + map_center;
+ }
+ else if (fabs(autocvar_g_waypointeditor_symmetrical) == 2)
+ {
+ float m = havocbot_symmetryaxis_equation.x;
+ float q = havocbot_symmetryaxis_equation.y;
+ if (autocvar_g_waypointeditor_symmetrical == -2)
+ {
+ m = autocvar_g_waypointeditor_symmetrical_axis.x;
+ q = autocvar_g_waypointeditor_symmetrical_axis.y;
+ }
+
+ new_org.x = (1 / (1 + m*m)) * ((1 - m*m) * org.x + 2 * m * org.y - 2 * m * q);
+ new_org.y = (1 / (1 + m*m)) * (2 * m * org.x + (m*m - 1) * org.y + 2 * q);
+ }
+ new_org.z = org.z;
+ return new_org;
+}
+
void waypoint_setupmodel(entity wp)
{
if (autocvar_g_waypointeditor)
{
if(!(f & WAYPOINTFLAG_PERSONAL))
{
- IL_EACH(g_waypoints, boxesoverlap(m1, m2, it.absmin, it.absmax),
+ vector em1 = m1;
+ vector em2 = m2;
+ if (m1 == m2)
+ {
+ em1 = m1 - '8 8 8';
+ em2 = m2 + '8 8 8';
+ }
+ IL_EACH(g_waypoints, boxesoverlap(em1, em2, it.absmin, it.absmax),
{
return it;
});
return w;
}
+void waypoint_spawn_fromeditor(entity pl)
+{
+ entity e;
+ vector org = pl.origin;
+ int ctf_flags = havocbot_symmetryaxis_equation.z;
+ bool sym = ((autocvar_g_waypointeditor_symmetrical > 0 && ctf_flags >= 2)
+ || (autocvar_g_waypointeditor_symmetrical < 0));
+ int order = ctf_flags;
+ if(autocvar_g_waypointeditor_symmetrical_order >= 2)
+ {
+ order = autocvar_g_waypointeditor_symmetrical_order;
+ ctf_flags = order;
+ }
+
+ if(!PHYS_INPUT_BUTTON_CROUCH(pl))
+ {
+ // snap waypoint to item's origin if close enough
+ IL_EACH(g_items, true,
+ {
+ vector item_org = (it.absmin + it.absmax) * 0.5;
+ item_org.z = it.absmin.z - PL_MIN_CONST.z;
+ if(vlen(item_org - org) < 30)
+ {
+ org = item_org;
+ break;
+ }
+ });
+ }
+
+ LABEL(add_wp);
+ e = waypoint_spawn(org, org, 0);
+ waypoint_schedulerelink(e);
+ bprint(strcat("Waypoint spawned at ", vtos(org), "\n"));
+ if(sym)
+ {
+ org = waypoint_getSymmetricalOrigin(e.origin, ctf_flags);
+ if (vdist(org - pl.origin, >, 32))
+ {
+ if(order > 2)
+ order--;
+ else
+ sym = false;
+ goto add_wp;
+ }
+ }
+}
+
+void waypoint_remove(entity wp)
+{
+ // tell all waypoints linked to wp that they need to relink
+ IL_EACH(g_waypoints, it != wp,
+ {
+ if (waypoint_islinked(it, wp))
+ waypoint_removelink(it, wp);
+ });
+ delete(wp);
+}
+
+void waypoint_remove_fromeditor(entity pl)
+{
+ entity e = navigation_findnearestwaypoint(pl, false);
+
+ int ctf_flags = havocbot_symmetryaxis_equation.z;
+ bool sym = ((autocvar_g_waypointeditor_symmetrical > 0 && ctf_flags >= 2)
+ || (autocvar_g_waypointeditor_symmetrical < 0));
+ int order = ctf_flags;
+ if(autocvar_g_waypointeditor_symmetrical_order >= 2)
+ {
+ order = autocvar_g_waypointeditor_symmetrical_order;
+ ctf_flags = order;
+ }
+
+ LABEL(remove_wp);
+ if (!e) return;
+ if (e.wpflags & WAYPOINTFLAG_GENERATED) return;
+
+ if (e.wphardwired)
+ {
+ LOG_INFO("^1Warning: ^7Removal of hardwired waypoints is not allowed in the editor. Please remove links from/to this waypoint (", vtos(e.origin), ") by hand from maps/", mapname, ".waypoints.hardwired\n");
+ return;
+ }
+
+ entity wp_sym = NULL;
+ if (sym)
+ {
+ vector org = waypoint_getSymmetricalOrigin(e.origin, ctf_flags);
+ FOREACH_ENTITY_CLASS("waypoint", !(it.wpflags & WAYPOINTFLAG_GENERATED), {
+ if(vdist(org - it.origin, <, 3))
+ {
+ wp_sym = it;
+ break;
+ }
+ });
+ }
+
+ bprint(strcat("Waypoint removed at ", vtos(e.origin), "\n"));
+ waypoint_remove(e);
+
+ if (sym && wp_sym)
+ {
+ e = wp_sym;
+ if(order > 2)
+ order--;
+ else
+ sym = false;
+ goto remove_wp;
+ }
+}
+
void waypoint_removelink(entity from, entity to)
{
if (from == to || (from.wpflags & WAYPOINTFLAG_NORELINK))
return false;
}
-// add a new link to the spawnfunc_waypoint, replacing the furthest link it already has
-void waypoint_addlink(entity from, entity to)
+float waypoint_getdistancecost_simple(float dist)
{
- float c;
+ return dist / autocvar_sv_maxspeed;
+}
- if (from == to)
- return;
- if (from.wpflags & WAYPOINTFLAG_NORELINK)
- return;
+float waypoint_getdistancecost(vector from, vector to)
+{
+ float c = waypoint_getdistancecost_simple(vlen(to - from));
- if (waypoint_islinked(from, to))
- return;
+ float height = from.z - to.z;
+ if(height > 0 && autocvar_sv_gravity > 0)
+ {
+ float height_cost = sqrt(height / (autocvar_sv_gravity / 2));
+ float xydist = vlen(vec2(to - from));
+ float xydist_cost = xydist / autocvar_sv_maxspeed;
+ if(max(height_cost, xydist_cost) < c)
+ c = max(height_cost, xydist_cost);
+ }
+ return c;
+}
- if (to.wpisbox || from.wpisbox)
+float waypoint_getlinkcost(entity from, entity to)
+{
+ vector v1 = from.origin;
+ vector v2 = to.origin;
+ if (from.wpisbox)
{
- // if either is a box we have to find the nearest points on them to
- // calculate the distance properly
- vector v1, v2, m1, m2;
- v1 = from.origin;
- m1 = to.absmin;
- m2 = to.absmax;
+ vector m1 = to.absmin, m2 = to.absmax;
v1_x = bound(m1_x, v1_x, m2_x);
v1_y = bound(m1_y, v1_y, m2_y);
v1_z = bound(m1_z, v1_z, m2_z);
- v2 = to.origin;
- m1 = from.absmin;
- m2 = from.absmax;
+ }
+ if (to.wpisbox)
+ {
+ vector m1 = from.absmin, m2 = from.absmax;
v2_x = bound(m1_x, v2_x, m2_x);
v2_y = bound(m1_y, v2_y, m2_y);
v2_z = bound(m1_z, v2_z, m2_z);
- v2 = to.origin;
- c = vlen(v2 - v1);
}
- else
- c = vlen(to.origin - from.origin);
+ return waypoint_getdistancecost(v1, v2);
+}
+
+// add a new link to the spawnfunc_waypoint, replacing the furthest link it already has
+// if c == -1 automatically determine cost of the link
+void waypoint_addlink_customcost(entity from, entity to, float c)
+{
+ if (from == to || waypoint_islinked(from, to))
+ return;
+ if (c == -1 && (from.wpflags & WAYPOINTFLAG_NORELINK))
+ return;
+
+ if(c == -1)
+ c = waypoint_getlinkcost(from, to);
if (from.wp31mincost < c) return;
if (from.wp30mincost < c) {from.wp31 = to;from.wp31mincost = c;return;} from.wp31 = from.wp30;from.wp31mincost = from.wp30mincost;
from.wp00 = to;from.wp00mincost = c;return;
}
+void waypoint_addlink(entity from, entity to)
+{
+ waypoint_addlink_customcost(from, to, -1);
+}
+
// relink this spawnfunc_waypoint
// (precompile a list of all reachable waypoints from this spawnfunc_waypoint)
// (SLOW!)
//waypoint_schedulerelink(this);
}
-void waypoint_remove(entity wp)
-{
- // tell all waypoints linked to wp that they need to relink
- IL_EACH(g_waypoints, it != wp,
- {
- if (waypoint_islinked(it, wp))
- waypoint_removelink(it, wp);
- });
- delete(wp);
-}
-
-void waypoint_removeall()
-{
- IL_EACH(g_waypoints, true,
- {
- delete(it);
- });
-}
-
// tell all waypoints to relink
// actually this is useful only to update relink_* stats
void waypoint_schedulerelinkall()
}
// Load waypoint links from file
-float waypoint_load_links()
+bool waypoint_load_links()
{
string filename, s;
float file, tokens, c = 0, found;
waypoint_spawnforitem_force(e, e.origin);
}
-void waypoint_spawnforteleporter_boxes(entity e, vector org1, vector org2, vector destination1, vector destination2, float timetaken)
+void waypoint_spawnforteleporter_boxes(entity e, int teleport_flag, vector org1, vector org2, vector destination1, vector destination2, float timetaken)
{
entity w;
entity dw;
- w = waypoint_spawn(org1, org2, WAYPOINTFLAG_GENERATED | WAYPOINTFLAG_TELEPORT | WAYPOINTFLAG_NORELINK);
+ w = waypoint_spawn(org1, org2, WAYPOINTFLAG_GENERATED | teleport_flag | WAYPOINTFLAG_NORELINK);
dw = waypoint_spawn(destination1, destination2, WAYPOINTFLAG_GENERATED);
// one way link to the destination
w.wp00 = dw;
{
org = waypoint_fixorigin(org);
destination = waypoint_fixorigin(destination);
- waypoint_spawnforteleporter_boxes(e, org, org, destination, destination, timetaken);
+ waypoint_spawnforteleporter_boxes(e, WAYPOINTFLAG_TELEPORT, org, org, destination, destination, timetaken);
}
void waypoint_spawnforteleporter(entity e, vector destination, float timetaken)
{
destination = waypoint_fixorigin(destination);
- waypoint_spawnforteleporter_boxes(e, e.absmin, e.absmax, destination, destination, timetaken);
+ waypoint_spawnforteleporter_boxes(e, WAYPOINTFLAG_TELEPORT, e.absmin, e.absmax, destination, destination, timetaken);
}
entity waypoint_spawnpersonal(entity this, vector position)
te_lightning2(NULL, wp1.origin, wp2.origin);
}
+void waypoint_showlinks_to(entity wp, int display_type)
+{
+ IL_EACH(g_waypoints, it != wp,
+ {
+ if (waypoint_islinked(it, wp))
+ waypoint_showlink(it, wp, display_type);
+ });
+}
+
+void waypoint_showlinks_from(entity wp, int display_type)
+{
+ waypoint_showlink(wp.wp00, wp, display_type); waypoint_showlink(wp.wp16, wp, display_type);
+ waypoint_showlink(wp.wp01, wp, display_type); waypoint_showlink(wp.wp17, wp, display_type);
+ waypoint_showlink(wp.wp02, wp, display_type); waypoint_showlink(wp.wp18, wp, display_type);
+ waypoint_showlink(wp.wp03, wp, display_type); waypoint_showlink(wp.wp19, wp, display_type);
+ waypoint_showlink(wp.wp04, wp, display_type); waypoint_showlink(wp.wp20, wp, display_type);
+ waypoint_showlink(wp.wp05, wp, display_type); waypoint_showlink(wp.wp21, wp, display_type);
+ waypoint_showlink(wp.wp06, wp, display_type); waypoint_showlink(wp.wp22, wp, display_type);
+ waypoint_showlink(wp.wp07, wp, display_type); waypoint_showlink(wp.wp23, wp, display_type);
+ waypoint_showlink(wp.wp08, wp, display_type); waypoint_showlink(wp.wp24, wp, display_type);
+ waypoint_showlink(wp.wp09, wp, display_type); waypoint_showlink(wp.wp25, wp, display_type);
+ waypoint_showlink(wp.wp10, wp, display_type); waypoint_showlink(wp.wp26, wp, display_type);
+ waypoint_showlink(wp.wp11, wp, display_type); waypoint_showlink(wp.wp27, wp, display_type);
+ waypoint_showlink(wp.wp12, wp, display_type); waypoint_showlink(wp.wp28, wp, display_type);
+ waypoint_showlink(wp.wp13, wp, display_type); waypoint_showlink(wp.wp29, wp, display_type);
+ waypoint_showlink(wp.wp14, wp, display_type); waypoint_showlink(wp.wp30, wp, display_type);
+ waypoint_showlink(wp.wp15, wp, display_type); waypoint_showlink(wp.wp31, wp, display_type);
+}
+
void botframe_showwaypointlinks()
{
if (time < botframe_waypointeditorlightningtime)
if (head)
{
te_lightning2(NULL, head.origin, it.origin);
- waypoint_showlink(head.wp00, head, display_type);
- waypoint_showlink(head.wp01, head, display_type);
- waypoint_showlink(head.wp02, head, display_type);
- waypoint_showlink(head.wp03, head, display_type);
- waypoint_showlink(head.wp04, head, display_type);
- waypoint_showlink(head.wp05, head, display_type);
- waypoint_showlink(head.wp06, head, display_type);
- waypoint_showlink(head.wp07, head, display_type);
- waypoint_showlink(head.wp08, head, display_type);
- waypoint_showlink(head.wp09, head, display_type);
- waypoint_showlink(head.wp10, head, display_type);
- waypoint_showlink(head.wp11, head, display_type);
- waypoint_showlink(head.wp12, head, display_type);
- waypoint_showlink(head.wp13, head, display_type);
- waypoint_showlink(head.wp14, head, display_type);
- waypoint_showlink(head.wp15, head, display_type);
- waypoint_showlink(head.wp16, head, display_type);
- waypoint_showlink(head.wp17, head, display_type);
- waypoint_showlink(head.wp18, head, display_type);
- waypoint_showlink(head.wp19, head, display_type);
- waypoint_showlink(head.wp20, head, display_type);
- waypoint_showlink(head.wp21, head, display_type);
- waypoint_showlink(head.wp22, head, display_type);
- waypoint_showlink(head.wp23, head, display_type);
- waypoint_showlink(head.wp24, head, display_type);
- waypoint_showlink(head.wp25, head, display_type);
- waypoint_showlink(head.wp26, head, display_type);
- waypoint_showlink(head.wp27, head, display_type);
- waypoint_showlink(head.wp28, head, display_type);
- waypoint_showlink(head.wp29, head, display_type);
- waypoint_showlink(head.wp30, head, display_type);
- waypoint_showlink(head.wp31, head, display_type);
+ if(PHYS_INPUT_BUTTON_CROUCH(it))
+ waypoint_showlinks_to(head, display_type);
+ else
+ waypoint_showlinks_from(head, display_type);
}
}
});
it.wpflags |= WAYPOINTFLAG_USEFUL;
if (it.wpflags & WAYPOINTFLAG_TELEPORT)
it.wpflags |= WAYPOINTFLAG_USEFUL;
+ if (it.wpflags & WAYPOINTFLAG_LADDER)
+ it.wpflags |= WAYPOINTFLAG_USEFUL;
if (it.wpflags & WAYPOINTFLAG_PROTECTED)
it.wpflags |= WAYPOINTFLAG_USEFUL;
// b) WP is closest WP for an item/spawnpoint/other entity
float botframe_loadedforcedlinks;
float botframe_cachedwaypointlinks;
+// waypoint wp links to waypoint wp.wpXX (OUTGOING link)
+// links are sorted by their cost (wpXXmincost)
.entity wp00, wp01, wp02, wp03, wp04, wp05, wp06, wp07, wp08, wp09, wp10, wp11, wp12, wp13, wp14, wp15;
.entity wp16, wp17, wp18, wp19, wp20, wp21, wp22, wp23, wp24, wp25, wp26, wp27, wp28, wp29, wp30, wp31;
-// itemscore = (howmuchmoreIwant / howmuchIcanwant) / itemdistance
.float wp00mincost, wp01mincost, wp02mincost, wp03mincost, wp04mincost, wp05mincost, wp06mincost, wp07mincost;
.float wp08mincost, wp09mincost, wp10mincost, wp11mincost, wp12mincost, wp13mincost, wp14mincost, wp15mincost;
.float wp16mincost, wp17mincost, wp18mincost, wp19mincost, wp20mincost, wp21mincost, wp22mincost, wp23mincost;
*/
spawnfunc(waypoint);
+void waypoint_removelink(entity from, entity to);
+bool waypoint_islinked(entity from, entity to);
+void waypoint_addlink_customcost(entity from, entity to, float c);
void waypoint_addlink(entity from, entity to);
void waypoint_think(entity this);
void waypoint_clearlinks(entity wp);
void waypoint_schedulerelink(entity wp);
-void waypoint_remove(entity e);
-void waypoint_removeall();
+float waypoint_getlinkcost(entity from, entity to);
+float waypoint_getdistancecost(vector v1, vector v2);
+float waypoint_getdistancecost_simple(float dist);
+
+void waypoint_remove_fromeditor(entity pl);
+void waypoint_remove(entity wp);
void waypoint_schedulerelinkall();
void waypoint_load_links_hardwired();
void waypoint_save_links();
void botframe_showwaypointlinks();
float waypoint_loadall();
-float waypoint_load_links();
+bool waypoint_load_links();
+void waypoint_spawn_fromeditor(entity pl);
entity waypoint_spawn(vector m1, vector m2, float f);
entity waypoint_spawnpersonal(entity this, vector position);
+void waypoint_unreachable(entity pl);
+
vector waypoint_fixorigin(vector position);
void botframe_autowaypoints();
bool tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode) { return false; }
-void waypoint_remove(entity e) { }
+void waypoint_remove_fromeditor(entity pl) { }
+void waypoint_remove(entity wp) { }
void waypoint_saveall() { }
void waypoint_schedulerelinkall() { }
void waypoint_schedulerelink(entity wp) { }
void waypoint_spawnforitem_force(entity e, vector org) { }
void waypoint_spawnforteleporter(entity e, vector destination, float timetaken) { }
void waypoint_spawnforteleporter_v(entity e, vector org, vector destination, float timetaken) { }
+void waypoint_spawn_fromeditor(entity pl) { }
entity waypoint_spawn(vector m1, vector m2, float f) { return NULL; }
#endif
sprint(this, "all waypoints cleared\n");
}
-vector waypoint_getSymmetricalOrigin(vector org, int ctf_flags)
-{
- vector new_org = org;
- if (fabs(autocvar_g_waypointeditor_symmetrical) == 1)
- {
- vector map_center = havocbot_middlepoint;
- if (autocvar_g_waypointeditor_symmetrical == -1)
- map_center = autocvar_g_waypointeditor_symmetrical_origin;
-
- new_org = Rotate(org - map_center, 360 * DEG2RAD / ctf_flags) + map_center;
- }
- else if (fabs(autocvar_g_waypointeditor_symmetrical) == 2)
- {
- float m = havocbot_symmetryaxis_equation.x;
- float q = havocbot_symmetryaxis_equation.y;
- if (autocvar_g_waypointeditor_symmetrical == -2)
- {
- m = autocvar_g_waypointeditor_symmetrical_axis.x;
- q = autocvar_g_waypointeditor_symmetrical_axis.y;
- }
-
- new_org.x = (1 / (1 + m*m)) * ((1 - m*m) * org.x + 2 * m * org.y - 2 * m * q);
- new_org.y = (1 / (1 + m*m)) * (2 * m * org.x + (m*m - 1) * org.y + 2 * q);
- }
- new_org.z = org.z;
- return new_org;
-}
-
IMPULSE(navwaypoint_spawn)
{
if (!autocvar_g_waypointeditor) return;
- entity e;
- vector org = this.origin;
- int ctf_flags = havocbot_symmetryaxis_equation.z;
- bool sym = ((autocvar_g_waypointeditor_symmetrical > 0 && ctf_flags >= 2)
- || (autocvar_g_waypointeditor_symmetrical < 0));
- int order = ctf_flags;
- if(autocvar_g_waypointeditor_symmetrical_order >= 2)
- {
- order = autocvar_g_waypointeditor_symmetrical_order;
- ctf_flags = order;
- }
-
- LABEL(add_wp);
- e = waypoint_spawn(org, org, 0);
- waypoint_schedulerelink(e);
- bprint(strcat("Waypoint spawned at ", vtos(org), "\n"));
- if(sym)
- {
- org = waypoint_getSymmetricalOrigin(e.origin, ctf_flags);
- if (vdist(org - this.origin, >, 32))
- {
- if(order > 2)
- order--;
- else
- sym = false;
- goto add_wp;
- }
- }
+ waypoint_spawn_fromeditor(this);
}
IMPULSE(navwaypoint_remove)
{
if (!autocvar_g_waypointeditor) return;
- entity e = navigation_findnearestwaypoint(this, false);
- int ctf_flags = havocbot_symmetryaxis_equation.z;
- bool sym = ((autocvar_g_waypointeditor_symmetrical > 0 && ctf_flags >= 2)
- || (autocvar_g_waypointeditor_symmetrical < 0));
- int order = ctf_flags;
- if(autocvar_g_waypointeditor_symmetrical_order >= 2)
- {
- order = autocvar_g_waypointeditor_symmetrical_order;
- ctf_flags = order;
- }
-
- LABEL(remove_wp);
- if (!e) return;
- if (e.wpflags & WAYPOINTFLAG_GENERATED) return;
-
- if (e.wphardwired)
- {
- LOG_INFO("^1Warning: ^7Removal of hardwired waypoints is not allowed in the editor. Please remove links from/to this waypoint (", vtos(e.origin), ") by hand from maps/", mapname, ".waypoints.hardwired\n");
- return;
- }
-
- entity wp_sym = NULL;
- if (sym)
- {
- vector org = waypoint_getSymmetricalOrigin(e.origin, ctf_flags);
- FOREACH_ENTITY_CLASS("waypoint", !(it.wpflags & WAYPOINTFLAG_GENERATED), {
- if(vdist(org - it.origin, <, 3))
- {
- wp_sym = it;
- break;
- }
- });
- }
- bprint(strcat("Waypoint removed at ", vtos(e.origin), "\n"));
- waypoint_remove(e);
- if (sym && wp_sym)
- {
- e = wp_sym;
- if(order > 2)
- order--;
- else
- sym = false;
- goto remove_wp;
- }
+ waypoint_remove_fromeditor(this);
}
IMPULSE(navwaypoint_relink)
IMPULSE(navwaypoint_unreachable)
{
if (!autocvar_g_waypointeditor) return;
- IL_EACH(g_waypoints, true,
- {
- it.colormod = '0.5 0.5 0.5';
- it.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
- });
- entity e2 = navigation_findnearestwaypoint(this, false);
- navigation_markroutes(this, e2);
-
- int j, m;
-
- j = 0;
- m = 0;
- IL_EACH(g_waypoints, it.wpcost >= 10000000,
- {
- LOG_INFO("unreachable: ", etos(it), " ", vtos(it.origin), "\n");
- it.colormod_z = 8;
- it.effects |= EF_NODEPTHTEST | EF_BLUE;
- ++j;
- ++m;
- });
- if (j) LOG_INFOF("%d waypoints cannot be reached from here in any way (marked with blue light)\n", j);
- navigation_markroutes_inverted(e2);
-
- j = 0;
- IL_EACH(g_waypoints, it.wpcost >= 10000000,
- {
- LOG_INFO("cannot reach me: ", etos(it), " ", vtos(it.origin), "\n");
- it.colormod_x = 8;
- if (!(it.effects & EF_NODEPTHTEST)) // not already reported before
- ++m;
- it.effects |= EF_NODEPTHTEST | EF_RED;
- ++j;
- });
- if (j) LOG_INFOF("%d waypoints cannot walk to here in any way (marked with red light)\n", j);
- if (m) LOG_INFOF("%d waypoints have been marked total\n", m);
-
- j = 0;
- IL_EACH(g_spawnpoints, true,
- {
- vector org = it.origin;
- tracebox(it.origin, PL_MIN_CONST, PL_MAX_CONST, it.origin - '0 0 512', MOVE_NOMONSTERS, NULL);
- setorigin(it, trace_endpos);
- if (navigation_findnearestwaypoint(it, false))
- {
- setorigin(it, org);
- it.effects &= ~EF_NODEPTHTEST;
- it.model = "";
- }
- else
- {
- setorigin(it, org);
- LOG_INFO("spawn without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
- it.effects |= EF_NODEPTHTEST;
- _setmodel(it, this.model);
- it.frame = this.frame;
- it.skin = this.skin;
- it.colormod = '8 0.5 8';
- setsize(it, '0 0 0', '0 0 0');
- ++j;
- }
- });
- if (j) LOG_INFOF("%d spawnpoints have no nearest waypoint (marked by player model)\n", j);
-
- j = 0;
- IL_EACH(g_items, true,
- {
- it.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
- it.colormod = '0.5 0.5 0.5';
- });
- IL_EACH(g_items, true,
- {
- if (navigation_findnearestwaypoint(it, false)) continue;
- LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
- it.effects |= EF_NODEPTHTEST | EF_RED;
- it.colormod_x = 8;
- ++j;
- });
- if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked away from (marked with red light)\n", j);
-
- j = 0;
- IL_EACH(g_items, true,
- {
- if (navigation_findnearestwaypoint(it, true)) continue;
- LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
- it.effects |= EF_NODEPTHTEST | EF_BLUE;
- it.colormod_z = 8;
- ++j;
- });
- if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked to (marked with blue light)\n", j);
+ waypoint_unreachable(this);
}