if(this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
{
this.aistatus |= AI_STATUS_OUT_JUMPPAD;
- navigation_poptouchedgoals(this);
- return;
+ if(navigation_poptouchedgoals(this))
+ return;
}
else if(this.aistatus & AI_STATUS_OUT_JUMPPAD)
{
bool bunnyhop_forbidden = false;
vector destorg = get_closer_dest(this.goalcurrent, this.origin);
-
- // in case bot ends up inside the teleport waypoint without touching
- // the teleport itself, head to the teleport origin
- if(this.goalcurrent.wpisbox && boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin + eZ * this.mins.z, this.origin + eZ * this.maxs.z))
+ if (this.jumppadcount && this.goalcurrent.wpflags & WAYPOINTFLAG_TELEPORT)
+ {
+ // if bot used the jumppad, push towards jumppad origin until jumppad waypoint gets removed
+ destorg = this.goalcurrent.origin;
+ }
+ else if (this.goalcurrent.wpisbox && boxesoverlap(this.goalcurrent.absmin, this.goalcurrent.absmax, this.origin + eZ * this.mins.z, this.origin + eZ * this.maxs.z))
{
+ // if bot is inside the teleport waypoint, head to teleport origin until teleport gets used
bunnyhop_forbidden = true;
destorg = this.goalcurrent.origin;
if(destorg.z > this.origin.z)
this.aistatus &= ~AI_STATUS_WAYPOINT_PERSONAL_GOING;
this.aistatus |= AI_STATUS_WAYPOINT_PERSONAL_REACHED;
}
+ if(this.jumppadcount)
+ {
+ // remove jumppad waypoint after a random delay to prevent bots getting
+ // stuck on certain jumppads that require an extra initial horizontal speed
+ float max_delay = 0.1;
+ if (vdist(vec2(this.velocity), >, 2 * autocvar_sv_maxspeed))
+ max_delay = 0.05;
+ if (time - this.lastteleporttime < random() * max_delay)
+ return removed_goals;
+ }
navigation_poproute(this);
this.lastteleporttime = 0;
++removed_goals;