From: terencehill Date: Fri, 23 Nov 2018 15:48:43 +0000 (+0100) Subject: Bot AI: fix bots ignoring loot if thrown by killed players they were directly chasing X-Git-Tag: xonotic-v0.8.5~1705^2~8 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=89b641c415446985b8559be54fb9c3a8c0825bd9;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: fix bots ignoring loot if thrown by killed players they were directly chasing --- diff --git a/qcsrc/server/bot/default/havocbot/havocbot.qc b/qcsrc/server/bot/default/havocbot/havocbot.qc index bed291905..bb6c15c52 100644 --- a/qcsrc/server/bot/default/havocbot/havocbot.qc +++ b/qcsrc/server/bot/default/havocbot/havocbot.qc @@ -794,8 +794,26 @@ void havocbot_movetogoal(entity this) // don't remove if not visible if (checkpvs(this.origin + this.view_ofs, this.goalcurrent)) { - navigation_goalrating_timeout_force(this); - return; + if (IS_DEAD(this.goalcurrent)) + { + IL_EACH(g_items, it.enemy == this.goalcurrent && Item_IsLoot(it), + { + if (vdist(it.origin - this.goalcurrent.death_origin, <, 50)) + { + navigation_clearroute(this); + navigation_pushroute(this, it); + // loot can't be immediately rated since it isn't on ground yet + // it will be rated after a second when on ground, meanwhile head to it + navigation_goalrating_timeout_expire(this, 1); + return; + } + }); + } + if (!Item_IsLoot(this.goalcurrent)) + { + navigation_goalrating_timeout_force(this); + return; + } } } else if (!(STAT(FROZEN, this.goalentity)) && this.bot_tracewalk_time < time)