]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/havocbot/roles.qc
Merge branch 'terencehill/menu_weaponarena_selection_fix' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / havocbot / roles.qc
index 7e3ddbb4340dd820253fccc87b5d2d2449ae2af1..c56f70598e60b696e4f18c7a70d6f20cce995633 100644 (file)
@@ -1,3 +1,10 @@
+#include "../../_all.qh"
+
+#include "havocbot.qh"
+#include "role_keyhunt.qh"
+
+#include "../bot.qh"
+#include "../navigation.qh"
 
 .float max_armorvalue;
 .float havocbot_role_timeout;
@@ -12,7 +19,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
        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);
+       head = findchainfloat(bot_pickup, true);
 
        while (head)
        {
@@ -30,7 +37,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(o, o + '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)
@@ -57,7 +64,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
 
                if(teamplay)
                {
-                       discard = FALSE;
+                       discard = false;
 
                        FOR_EACH_PLAYER(player)
                        {
@@ -77,7 +84,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
 
                                        friend_distance = d;
 
-                                       discard = TRUE;
+                                       discard = true;
 
                                        if( head.health && player.health > self.health )
                                                continue;
@@ -104,7 +111,7 @@ void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
                                        if (head.ammo_plasma && player.ammo_plasma > self.ammo_plasma)
                                                continue;
 
-                                       discard = FALSE;
+                                       discard = false;
                                }
                                else
                                {
@@ -152,8 +159,9 @@ void havocbot_goalrating_controlpoints(float ratingscale, vector org, float srad
 void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius)
 {
        entity head;
-       float t, noteam, distance;
-       noteam = ((self.team == 0) || !teamplay); // fteqcc sucks
+       int t;
+       float distance;
+       noref bool noteam = ((self.team == 0) || !teamplay);
 
        if (autocvar_bot_nofire)
                return;
@@ -184,7 +192,7 @@ void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradi
                        // not falling
                        if((head.flags & FL_ONGROUND) == 0)
                        {
-                               traceline(head.origin, head.origin + '0 0 -1500', TRUE, world);
+                               traceline(head.origin, head.origin + '0 0 -1500', true, world);
                                t = pointcontents(trace_endpos + '0 0 1');
                                if( t != CONTENT_SOLID )
                                if(t & CONTENT_WATER || t & CONTENT_SLIME || t & CONTENT_LAVA)
@@ -203,12 +211,9 @@ void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradi
        }
 }
 
-// choose a role according to the situation
-void havocbot_role_dm();
-
-//DM:
-//go to best items
-void havocbot_role_dm()
+// legacy bot role for standard gamemodes
+// go to best items
+void havocbot_role_generic()
 {
        if(self.deadflag != DEAD_NO)
                return;
@@ -224,21 +229,19 @@ void havocbot_role_dm()
        }
 }
 
-void havocbot_chooserole_dm()
+void havocbot_chooserole_generic()
 {
-       self.havocbot_role = havocbot_role_dm;
+       self.havocbot_role = havocbot_role_generic;
 }
 
 void havocbot_chooserole()
 {
-       dprint("choosing a role...\n");
+       LOG_TRACE("choosing a role...\n");
        self.bot_strategytime = 0;
-       if (MUTATOR_CALLHOOK(HavocBot_ChooseRole))
+       if (MUTATOR_CALLHOOK(HavocBot_ChooseRole, self))
                return;
        else if (g_keyhunt)
                havocbot_chooserole_kh();
-       else if (g_onslaught)
-               havocbot_chooserole_ons();
-       else // assume anything else is deathmatch
-               havocbot_chooserole_dm();
+       else
+               havocbot_chooserole_generic();
 }