fix: do not clean non-cmd buttons on IN_SCORE hook.
fix: reset search nodes when receiving team info message. fix: clear bot args on every call to bot client command. add: drone build scenario.
This commit is contained in:
parent
7f9c98aef1
commit
f51d3bf13b
5 changed files with 56 additions and 4 deletions
|
|
@ -436,6 +436,8 @@ void Game::prepareBotArgs (edict_t *ent, String str) {
|
|||
// supply directly the whole string as if you were typing it in the bot's "console". It
|
||||
// is supposed to work exactly like the pfnClientCommand (server-sided client command).
|
||||
|
||||
m_botArgs.clear (); // always clear args
|
||||
|
||||
if (str.empty ()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,10 +409,9 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) {
|
|||
table->pfnCmdStart = [] (const edict_t *player, usercmd_t *cmd, unsigned int random_seed) {
|
||||
auto ent = const_cast <edict_t *> (player);
|
||||
|
||||
// if we're handle pings for bots and clients, clear IN_SCORE button so SV_ShouldUpdatePing engine function return false
|
||||
// and SV_EmitPings will not overwrite our results
|
||||
// if we're handle pings for bots and clients, clear IN_SCORE button so SV_ShouldUpdatePing engine function return false, and SV_EmitPings will not overwrite our results
|
||||
if (game.is (GameFlags::HasFakePings) && cv_show_latency.int_ () == 2) {
|
||||
if ((cmd->buttons & IN_SCORE) || (ent->v.oldbuttons & IN_SCORE)) {
|
||||
if (cmd->buttons & IN_SCORE) {
|
||||
cmd->buttons &= ~IN_SCORE;
|
||||
|
||||
// send our version of pings
|
||||
|
|
|
|||
|
|
@ -329,6 +329,13 @@ void MessageDispatcher::netMsgTeamInfo () {
|
|||
// update player team
|
||||
client.team2 = m_teamInfoCache[m_args[team].chars_]; // update real team
|
||||
client.team = game.is (GameFlags::FreeForAll) ? m_args[index].long_ : client.team2;
|
||||
|
||||
auto bot = bots[client.ent];
|
||||
|
||||
// clear the routes so we're have no error in pathfinding in case team info update (respawn/change team)
|
||||
if (bot) {
|
||||
bot->clearSearchNodes ();
|
||||
}
|
||||
}
|
||||
|
||||
void MessageDispatcher::netMsgBarTime () {
|
||||
|
|
|
|||
|
|
@ -596,7 +596,7 @@ void BotSupport::calculatePings () {
|
|||
}
|
||||
int part = static_cast <int> (average.first * 0.2f);
|
||||
|
||||
int botPing = bot->m_basePing + rg.int_ (average.first - part, average.first + part) + rg.int_ (bot->m_difficulty / 2, bot->m_difficulty);
|
||||
int botPing = bot->index () / 2 + bot->m_basePing + rg.int_ (average.first - part, average.first + part) + rg.int_ (bot->m_difficulty / 2, bot->m_difficulty);
|
||||
int botLoss = rg.int_ (average.second / 2, average.second);
|
||||
|
||||
client.ping = getPingBitmask (client.ent, botLoss, botPing);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue