From: terencehill Date: Mon, 26 Dec 2016 00:17:32 +0000 (+0100) Subject: Custom weapon priorities for bots: improve rating scale calculation by excluding... X-Git-Tag: xonotic-v0.8.2~343^2~10 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c04fad1835716f01e4d90fb72d173a9a367636f5;p=xonotic%2Fxonotic-data.pk3dir.git Custom weapon priorities for bots: improve rating scale calculation by excluding not usable weapons (weapons are still overrated but not as much as before) --- diff --git a/qcsrc/common/t_items.qc b/qcsrc/common/t_items.qc index e904a2b3f..6ee8869e4 100644 --- a/qcsrc/common/t_items.qc +++ b/qcsrc/common/t_items.qc @@ -947,24 +947,22 @@ float weapon_pickupevalfunc(entity player, entity item) { // Find the highest position on any range int position = -1; + int wep_count = 0; + int wpn = item.weapon; for (int j = 0; j < WEP_LAST ; ++j){ - if( - bot_weapons_far[j] == item.weapon || - bot_weapons_mid[j] == item.weapon || - bot_weapons_close[j] == item.weapon - ) - { - position = j; - break; - } + if (position == -1) + if (bot_weapons_far[j] == wpn || bot_weapons_mid[j] == wpn || bot_weapons_close[j] == wpn) + position = wep_count; + if (bot_weapons_far[j] > 0 || bot_weapons_mid[j] > 0 || bot_weapons_close[j] > 0) + wep_count++; } // Rate it if (position >= 0 ) { - position = WEP_LAST - position; + position = wep_count - position; // item.bot_pickupbasevalue is overwritten here - return (BOT_PICKUP_RATING_LOW + ( (BOT_PICKUP_RATING_HIGH - BOT_PICKUP_RATING_LOW) * (position / WEP_LAST ))) * c; + return (BOT_PICKUP_RATING_LOW + ( (BOT_PICKUP_RATING_HIGH - BOT_PICKUP_RATING_LOW) * (position / wep_count) )) * c; } }