if (this.deadflag == DEAD_DEAD)
{
PHYS_INPUT_BUTTON_JUMP(this) = true; // press jump to respawn
- this.bot_strategytime = 0;
+ navigation_goalrating_timeout_force(this);
}
}
else if(this.aistatus & AI_STATUS_STUCK)
else if(this.bot_forced_team==4)
this.team = NUM_TEAM_4;
else
- JoinBestTeam(this, false, true);
+ JoinBestTeam(this, true);
havocbot_setupbot(this);
}
{
botframe_spawnedwaypoints = true;
waypoint_loadall();
- if(!waypoint_load_links())
- waypoint_schedulerelinkall(); // link all the autogenerated waypoints (teleporters)
+ waypoint_load_links();
}
if (bot_list)
// frame, which causes choppy framerates)
if (bot_strategytoken_taken)
{
+ // give goal token to the first bot without goals; if all bots don't have
+ // any goal (or are dead/frozen) simply give it to the next one
bot_strategytoken_taken = false;
- if (bot_strategytoken)
- bot_strategytoken = bot_strategytoken.nextbot;
- if (!bot_strategytoken)
- bot_strategytoken = bot_list;
+ entity bot_strategytoken_save = bot_strategytoken;
+ while (true)
+ {
+ if (bot_strategytoken)
+ bot_strategytoken = bot_strategytoken.nextbot;
+ if (!bot_strategytoken)
+ bot_strategytoken = bot_list;
+
+ if (!(IS_DEAD(bot_strategytoken) || STAT(FROZEN, bot_strategytoken))
+ && !bot_strategytoken.goalcurrent)
+ break;
+
+ if (!bot_strategytoken_save) // break loop if all the bots are dead or frozen
+ break;
+ if (bot_strategytoken == bot_strategytoken_save)
+ bot_strategytoken_save = NULL; // looped through all the bots
+ }
}
if (botframe_nextdangertime < time)