From: terencehill Date: Sun, 29 Oct 2017 17:30:00 +0000 (+0100) Subject: Bot AI: don't rate again items already rated with a higher ratingscale (currently... X-Git-Tag: xonotic-v0.8.5~2378^2~34 X-Git-Url: https://de.git.xonotic.org/?a=commitdiff_plain;h=4819cd87186846da4df5e276f2c3303c761530b2;p=xonotic%2Fxonotic-data.pk3dir.git Bot AI: don't rate again items already rated with a higher ratingscale (currently bots playing certain CTF roles rate items twice with different rating scale and range) --- diff --git a/qcsrc/server/bot/default/havocbot/roles.qc b/qcsrc/server/bot/default/havocbot/roles.qc index df5e19d98..56133862b 100644 --- a/qcsrc/server/bot/default/havocbot/roles.qc +++ b/qcsrc/server/bot/default/havocbot/roles.qc @@ -9,6 +9,8 @@ #include "../bot.qh" #include "../navigation.qh" +.float bot_ratingscale; +.float bot_ratingscale_time; .float max_armorvalue; .float havocbot_role_timeout; @@ -113,6 +115,13 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float IL_EACH(g_items, it.bot_pickup, { + // ignore if bot already rated this item with a higher ratingscale + // NOTE: this code assumes each bot rates items in a different frame + if(it.bot_ratingscale_time == time && ratingscale < it.bot_ratingscale) + continue; + it.bot_ratingscale_time = time; + it.bot_ratingscale = ratingscale; + if(!it.solid) { if(!autocvar_bot_ai_timeitems) @@ -163,9 +172,8 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float if(!havocbot_goalrating_item_pickable_check_players(this, org, it, o)) continue; - - rating = it.bot_pickupevalfunc(this, it); + rating = it.bot_pickupevalfunc(this, it); if(rating > 0) navigation_routerating(this, it, rating * ratingscale, 2000); });