.float bot_moveskill; // moving technique
.float bot_pickup;
.float(entity player, entity item) bot_pickupevalfunc;
-.float bot_strategytime;
.string cleanname;
.float havocbot_role_timeout;
+.void(entity this) havocbot_role;
+.void(entity this) havocbot_previous_role;
.float isbot; // true if this client is actually a bot
.float lastteleporttime;
+ .vector lastteleport_origin;
.float navigation_hasgoals;
.float nearestwaypointtimeout;
.entity nearestwaypoint;
if(IS_DEAD(this))
return;
- if (this.bot_strategytime < time)
+ if (navigation_goalrating_timeout(this))
{
- this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
navigation_goalrating_start(this);
+ bool raw_touch_check = true;
+ int cp = this.race_checkpoint;
+
+ LABEL(search_racecheckpoints)
IL_EACH(g_racecheckpoints, true,
{
- if(it.cnt == this.race_checkpoint)
- navigation_routerating(this, it, 1000000, 5000);
- else if(this.race_checkpoint == -1)
+ if(it.cnt == cp || cp == -1)
+ {
+ // redirect bot to next goal if it touched the waypoint of an untouchable checkpoint
+ // e.g. checkpoint in front of Stormkeep's warpzone
+ // the same workaround is applied in Race game mode
+ if (raw_touch_check && vdist(this.origin - it.nearestwaypoint.origin, <, 30))
+ {
+ cp = race_NextCheckpoint(cp);
+ raw_touch_check = false;
+ goto search_racecheckpoints;
+ }
navigation_routerating(this, it, 1000000, 5000);
+ }
});
navigation_goalrating_end(this);
if(IS_DEAD(this))
return;
- if (this.bot_strategytime < time)
+ if (navigation_goalrating_timeout(this))
{
- this.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
navigation_goalrating_start(this);
+ bool raw_touch_check = true;
+ int cp = this.race_checkpoint;
+
+ LABEL(search_racecheckpoints)
IL_EACH(g_racecheckpoints, true,
{
- if(it.cnt == this.race_checkpoint)
- navigation_routerating(this, it, 1000000, 5000);
- else if(this.race_checkpoint == -1)
+ if(it.cnt == cp || cp == -1)
+ {
+ // redirect bot to next goal if it touched the waypoint of an untouchable checkpoint
+ // e.g. checkpoint in front of Stormkeep's warpzone
+ // the same workaround is applied in CTS game mode
+ if (raw_touch_check && vdist(this.origin - it.nearestwaypoint.origin, <, 30))
+ {
+ cp = race_NextCheckpoint(cp);
+ raw_touch_check = false;
+ goto search_racecheckpoints;
+ }
navigation_routerating(this, it, 1000000, 5000);
- }
});
navigation_goalrating_end(this);