]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
A few more fixes
authormand1nga <mand1nga@xonotic.org>
Mon, 8 Aug 2011 20:40:50 +0000 (17:40 -0300)
committermand1nga <mand1nga@xonotic.org>
Mon, 8 Aug 2011 20:40:50 +0000 (17:40 -0300)
qcsrc/server/bot/havocbot/roles.qc

index ac52c698f6cdb10c6387799898f9f400ebc5ef54..18699a7bd6f310001cc50e3ac359d250a55f6e5a 100644 (file)
@@ -10,12 +10,14 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
        local entity head;
        local entity player;
        local float rating, d, discard, distance, friend_distance, enemy_distance;
+       vector o;
        ratingscale = ratingscale * 0.0001; // items are rated around 10000 already
        head = findchainfloat(bot_pickup, TRUE);
 
        while (head)
        {
-               distance = vlen(head.origin - org);
+               o = (head.absmin + head.absmax) * 0.5;
+               distance = vlen(o - org);
                friend_distance = 10000; enemy_distance = 10000;
                rating = 0;
 
@@ -28,7 +30,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
                // Check if the item can be picked up safely
                if(head.classname == "droppedweapon")
                {
-                       traceline(head.origin, head.origin + '0 0 -1500', TRUE, world);
+                       traceline(o, o + '0 0 -1500', TRUE, world);
 
                        d = pointcontents(trace_endpos + '0 0 1');
                        if(d & CONTENT_WATER || d & CONTENT_SLIME || d & CONTENT_LAVA)
@@ -63,7 +65,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
                                if ( self == player || player.deadflag )
                                        continue;
 
-                               d = vlen(player.origin - head.origin); // distance between player and item
+                               d = vlen(player.origin - o); // distance between player and item
 
                                if ( player.team == self.team )
                                {
@@ -131,7 +133,7 @@ void havocbot_goalrating_controlpoints(float ratingscale, vector org, float srad
        head = findchain(classname, "dom_controlpoint");
        while (head)
        {
-               if (vlen(head.origin - org) < sradius)
+               if (vlen(( ( head.absmin + head.absmax ) * 0.5 ) - org) < sradius)
                {
                        if(head.cnt > -1) // this is just being fought for
                                navigation_routerating(head, ratingscale, 5000);