this.bot_pickup = true; // allow bots to make use of this ladder
vector top = (this.absmin + this.absmax) / 2;
top.z = this.absmax.z + 1 - PL_MIN_CONST.z;
- float cost = waypoint_getdistancecost_simple(this.absmax.z - this.absmin.z);
+ float cost = waypoint_getlinearcost(this.absmax.z - this.absmin.z);
waypoint_spawnforteleporter_boxes(this, WAYPOINTFLAG_LADDER, this.absmin, this.absmax, top, top, cost);
}
if (tracewalk(this, this.origin, this.mins, this.maxs, v, v_height, bot_navigation_movemode))
{
it.wpnearestpoint = v;
- it.wpcost = waypoint_getdistancecost(this.origin, v) + it.dmg;
+ it.wpcost = waypoint_gettravelcost(this.origin, v) + it.dmg;
it.wpfire = 1;
it.enemy = NULL;
c = c + 1;
if (w.wpflags & WAYPOINTFLAG_TELEPORT)
cost += w.wp00mincost; // assuming teleport has exactly one destination
else
- cost += waypoint_getdistancecost(p, v);
+ cost += waypoint_gettravelcost(p, v);
if (wp.wpcost > cost)
{
wp.wpcost = cost;
if(e.blacklisted)
return;
- rangebias = waypoint_getdistancecost_simple(rangebias);
- f = waypoint_getdistancecost_simple(f);
+ rangebias = waypoint_getlinearcost(rangebias);
+ f = waypoint_getlinearcost(f);
if (IS_PLAYER(e))
{
if (nwp.wpcost < 10000000)
{
//te_wizspike(nwp.wpnearestpoint);
- float cost = nwp.wpcost + waypoint_getdistancecost(nwp.wpnearestpoint, goal_org);
+ float cost = nwp.wpcost + waypoint_gettravelcost(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), ")");
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 = waypoint_getdistancecost_simple(it.bot_dodgerating) - waypoint_getdistancecost(o, v);
+ d = waypoint_getlinearcost(it.bot_dodgerating) - waypoint_gettravelcost(o, v);
if (d > 0)
{
traceline(o, v, true, NULL);
});
}
-float waypoint_getdistancecost_simple(float dist)
+float waypoint_getlinearcost(float dist)
{
if(skill >= autocvar_bot_ai_bunnyhop_skilloffset)
return dist / (autocvar_sv_maxspeed * 1.25);
return dist / autocvar_sv_maxspeed;
}
-float waypoint_getdistancecost(vector from, vector to)
+float waypoint_gettravelcost(vector from, vector to)
{
- float c = waypoint_getdistancecost_simple(vlen(to - from));
+ float c = waypoint_getlinearcost(vlen(to - from));
float height = from.z - to.z;
if(height > jumpheight_vec.z && autocvar_sv_gravity > 0)
{
float height_cost = sqrt(height / (autocvar_sv_gravity / 2));
- c = waypoint_getdistancecost_simple(vlen(vec2(to - from))); // xy distance cost
+ c = waypoint_getlinearcost(vlen(vec2(to - from))); // xy distance cost
if(height_cost > c)
c = height_cost;
}
v2_y = bound(m1_y, v2_y, m2_y);
v2_z = bound(m1_z, v2_z, m2_z);
}
- return waypoint_getdistancecost(v1, v2);
+ return waypoint_gettravelcost(v1, v2);
}
// add a new link to the spawnfunc_waypoint, replacing the furthest link it already has
void waypoint_schedulerelink(entity wp);
float waypoint_getlinkcost(entity from, entity to);
-float waypoint_getdistancecost(vector v1, vector v2);
-float waypoint_getdistancecost_simple(float dist);
+float waypoint_gettravelcost(vector v1, vector v2);
+float waypoint_getlinearcost(float dist);
void waypoint_updatecost_foralllinks();
void waypoint_remove_fromeditor(entity pl);