X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fbot%2Fdefault%2Fhavocbot%2Froles.qc;h=e469436014e1e030cc7dd1fc3bad16e61ad9fb11;hb=f84d4c215d826d9b035e1ba79a22af077f123f55;hp=df5e19d98652328242a2d2d69d0cdfe6950c5c3b;hpb=b9caa91942ad07b3f31faf0f9e347b6f3c0ba708;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/bot/default/havocbot/roles.qc b/qcsrc/server/bot/default/havocbot/roles.qc index df5e19d98..e46943601 100644 --- a/qcsrc/server/bot/default/havocbot/roles.qc +++ b/qcsrc/server/bot/default/havocbot/roles.qc @@ -2,6 +2,7 @@ #include #include +#include #include "havocbot.qh" #include "../cvars.qh" @@ -9,6 +10,8 @@ #include "../bot.qh" #include "../navigation.qh" +.float bot_ratingscale; +.float bot_ratingscale_time; .float max_armorvalue; .float havocbot_role_timeout; @@ -113,6 +116,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) @@ -140,7 +150,7 @@ void havocbot_goalrating_items(entity this, float ratingscale, vector org, float continue; // Check if the item can be picked up safely - if(it.classname == "droppedweapon") + if(Item_IsLoot(it)) { if(!IS_ONGROUND(it)) continue; @@ -163,9 +173,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); });