]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move bot roles into the mutator files
authorMario <mario.mario@y7mail.com>
Sun, 9 Mar 2014 21:17:09 +0000 (08:17 +1100)
committerMario <mario.mario@y7mail.com>
Sun, 9 Mar 2014 21:17:09 +0000 (08:17 +1100)
qcsrc/server/bot/havocbot/roles.qc
qcsrc/server/mutators/gamemode_cts.qc
qcsrc/server/mutators/gamemode_race.qc

index 39d6b23b7ff85d86be4494a3d648cca0cce5ddb2..324aa30b08b71351558ba38131c08b38906615cf 100644 (file)
@@ -221,40 +221,6 @@ void havocbot_role_dm()
        }
 }
 
-//Race:
-//go to next checkpoint, and annoy enemies
-.float race_checkpoint;
-void havocbot_role_race()
-{
-       if(self.deadflag != DEAD_NO)
-               return;
-
-       entity e;
-       if (self.bot_strategytime < time)
-       {
-               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
-               navigation_goalrating_start();
-               /*
-               havocbot_goalrating_items(100, self.origin, 10000);
-               havocbot_goalrating_enemyplayers(500, self.origin, 20000);
-               */
-
-               for(e = world; (e = find(e, classname, "trigger_race_checkpoint")) != world; )
-               {
-                       if(e.cnt == self.race_checkpoint)
-                       {
-                               navigation_routerating(e, 1000000, 5000);
-                       }
-                       else if(self.race_checkpoint == -1)
-                       {
-                               navigation_routerating(e, 1000000, 5000);
-                       }
-               }
-
-               navigation_goalrating_end();
-       }
-}
-
 void havocbot_chooserole_dm()
 {
        self.havocbot_role = havocbot_role_dm;
index 33e656807873f086cdcc57eef10da6653427ea05..ab20b0b68b7840d372772e82ee7258226e545dea 100644 (file)
@@ -1,3 +1,32 @@
+// legacy bot roles
+.float race_checkpoint;
+void havocbot_role_cts()
+{
+       if(self.deadflag != DEAD_NO)
+               return;
+
+       entity e;
+       if (self.bot_strategytime < time)
+       {
+               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start();
+
+               for(e = world; (e = find(e, classname, "trigger_race_checkpoint")) != world; )
+               {
+                       if(e.cnt == self.race_checkpoint)
+                       {
+                               navigation_routerating(e, 1000000, 5000);
+                       }
+                       else if(self.race_checkpoint == -1)
+                       {
+                               navigation_routerating(e, 1000000, 5000);
+                       }
+               }
+
+               navigation_goalrating_end();
+       }
+}
+
 void cts_ScoreRules()
 {
        ScoreRules_basics(0, 0, 0, FALSE);
@@ -183,9 +212,9 @@ MUTATOR_HOOKFUNCTION(cts_PlayerDies)
        return FALSE;
 }
 
-MUTATOR_HOOKFUNCTION(cts_HavocBot_ChooseRule)
+MUTATOR_HOOKFUNCTION(cts_BotRoles)
 {
-       self.havocbot_role = havocbot_role_race;
+       self.havocbot_role = havocbot_role_cts;
        return TRUE;
 }
 
@@ -251,7 +280,7 @@ MUTATOR_DEFINITION(gamemode_cts)
        MUTATOR_HOOK(PlayerSpawn, cts_PlayerSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(PutClientInServer, cts_PutClientInServer, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDies, cts_PlayerDies, CBC_ORDER_ANY);
-       MUTATOR_HOOK(HavocBot_ChooseRule, cts_HavocBot_ChooseRule, CBC_ORDER_ANY);
+       MUTATOR_HOOK(HavocBot_ChooseRule, cts_BotRoles, CBC_ORDER_ANY);
        MUTATOR_HOOK(GetPressedKeys, cts_PlayerPostThink, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidThrowCurrentWeapon, cts_ForbidThrowing, CBC_ORDER_ANY);
        MUTATOR_HOOK(FilterItem, cts_FilterItem, CBC_ORDER_ANY);
index e075a4e9547d0f7bf289a54e3b723b631cfe6f7c..3bb705c07db0e9d7b2f516a34574536ff807a4c6 100644 (file)
@@ -1,3 +1,32 @@
+// legacy bot roles
+.float race_checkpoint;
+void havocbot_role_race()
+{
+       if(self.deadflag != DEAD_NO)
+               return;
+
+       entity e;
+       if (self.bot_strategytime < time)
+       {
+               self.bot_strategytime = time + autocvar_bot_ai_strategyinterval;
+               navigation_goalrating_start();
+
+               for(e = world; (e = find(e, classname, "trigger_race_checkpoint")) != world; )
+               {
+                       if(e.cnt == self.race_checkpoint)
+                       {
+                               navigation_routerating(e, 1000000, 5000);
+                       }
+                       else if(self.race_checkpoint == -1)
+                       {
+                               navigation_routerating(e, 1000000, 5000);
+                       }
+               }
+
+               navigation_goalrating_end();
+       }
+}
+
 void race_ScoreRules()
 {
        ScoreRules_basics(race_teams, 0, 0, FALSE);
@@ -191,7 +220,7 @@ MUTATOR_HOOKFUNCTION(race_PlayerDies)
        return FALSE;
 }
 
-MUTATOR_HOOKFUNCTION(race_HavocBot_ChooseRule)
+MUTATOR_HOOKFUNCTION(race_BotRoles)
 {
        self.havocbot_role = havocbot_role_race;
        return TRUE;
@@ -243,7 +272,7 @@ MUTATOR_DEFINITION(gamemode_race)
        MUTATOR_HOOK(PlayerSpawn, race_PlayerSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(PutClientInServer, race_PutClientInServer, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDies, race_PlayerDies, CBC_ORDER_ANY);
-       MUTATOR_HOOK(HavocBot_ChooseRule, race_HavocBot_ChooseRule, CBC_ORDER_ANY);
+       MUTATOR_HOOK(HavocBot_ChooseRule, race_BotRoles, CBC_ORDER_ANY);
        MUTATOR_HOOK(GetPressedKeys, race_PlayerPostThink, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidPlayerScore_Clear, race_ForbidClearPlayerScore, CBC_ORDER_ANY);
        MUTATOR_HOOK(GetTeamCount, race_GetTeamCount, CBC_ORDER_ANY);