]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Bot AI: don't leave item to teammate if bot is closer than him and really close to...
authorterencehill <piuntn@gmail.com>
Thu, 12 Oct 2017 13:43:11 +0000 (15:43 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 12 Oct 2017 13:43:11 +0000 (15:43 +0200)
qcsrc/server/bot/default/havocbot/roles.qc

index 3b9ac3d5683a72e82f71fb341a14fcc7892fac0d..54129e25d2d5bcf40b9a8ed88cd2d0a28a9c330a 100644 (file)
@@ -97,8 +97,10 @@ bool havocbot_goalrating_item_pickable_check_players(entity this, vector org, en
        });
 
        // Rate the item only if no one needs it, or if an enemy is closer to it
-       if ((enemy_distance < friend_distance && vlen2(item_org - org) < enemy_distance) ||
-               (friend_distance > autocvar_bot_ai_friends_aware_pickup_radius ** 2))
+       dist = vlen2(item_org - org);
+       if ((enemy_distance < friend_distance && dist < enemy_distance) ||
+               (friend_distance > autocvar_bot_ai_friends_aware_pickup_radius ** 2) ||
+               (dist < friend_distance && dist < 200 ** 2))
                return true;
        return false;
 };