]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix another gamemode specific check
authorMario <mario@smbclan.net>
Wed, 14 Oct 2015 13:34:38 +0000 (23:34 +1000)
committerMario <mario@smbclan.net>
Wed, 14 Oct 2015 13:34:38 +0000 (23:34 +1000)
qcsrc/server/bot/bot.qc
qcsrc/server/mutators/events.qh
qcsrc/server/mutators/gamemode_ca.qc
qcsrc/server/mutators/gamemode_lms.qc

index 3b2af5d92c41141ed4f08cab410c20d6324b6abb..95262bcfa11769bef068c13b9be84cafa7fc3633 100644 (file)
@@ -572,13 +572,19 @@ float bot_fixcount()
        activerealplayers = 0;
        realplayers = 0;
 
-       FOR_EACH_REALCLIENT(head)
+       if(!MUTATOR_CALLHOOK(Bot_FixCount, activerealplayers, realplayers))
        {
-               if(IS_PLAYER(head) || g_lms || head.caplayer == 1)
-                       ++activerealplayers;
-               ++realplayers;
+               FOR_EACH_REALCLIENT(head)
+               {
+                       if(IS_PLAYER(head))
+                               ++activerealplayers;
+                       ++realplayers;
+               }
        }
 
+       activerealplayers = bot_activerealplayers;
+       realplayers = bot_realplayers;
+
        // add/remove bots if needed to make sure there are at least
        // minplayers+bot_number, or remove all bots if no one is playing
        // But don't remove bots immediately on level change, as the real players
index 5ab1258e6eec2541e47216972ea532253e591525..04ac5c28fcf1e46e001e7f7c0ef38110ea9e1e45 100644 (file)
@@ -692,4 +692,15 @@ enum {
     MUT_SPECPREV_RETURN, // return this flag to make the function return (handled entirely by mutator)
     MUT_SPECPREV_FOUND // return this flag to make the function continue without default functions (handled mostly by mutator)
 };
+
+/** called when player triggered kill (or is changing teams), return error to not do anything */
+#define EV_Bot_FixCount(i, o) \
+    /**/ i(int, bot_activerealplayers) \
+    /**/ o(int, bot_activerealplayers) \
+    /**/ i(int, bot_realplayers) \
+    /**/ o(int, bot_realplayers) \
+    /**/
+int bot_activerealplayers;
+int bot_realplayers;
+MUTATOR_HOOKABLE(Bot_FixCount, EV_Bot_FixCount);
 #endif
index dc6dca02148e1d1728e65c17161c4a479eaec521..eb883118749f4df962eccb03b3ebc73e4e51bb8b 100644 (file)
@@ -430,6 +430,19 @@ MUTATOR_HOOKFUNCTION(ca, SpectatePrev)
        return MUT_SPECPREV_FOUND;
 }
 
+MUTATOR_HOOKFUNCTION(ca, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
+{
+       entity head;
+       FOR_EACH_REALCLIENT(head)
+       {
+               if(IS_PLAYER(head) || head.caplayer == 1)
+                       ++bot_activerealplayers;
+               ++bot_realplayers;
+       }
+
+       return true;
+}
+
 void ca_Initialize()
 {
        allowed_to_spawn = true;
index 9660fcee7dcc8b22adae186852d619a087fa951f..e9297d88b57b554e1cca0702b6103dd160327410 100644 (file)
@@ -200,6 +200,18 @@ MUTATOR_HOOKFUNCTION(lms, ItemTouch)
        return MUT_ITEMTOUCH_CONTINUE;
 }
 
+MUTATOR_HOOKFUNCTION(lms, Bot_FixCount, CBC_ORDER_EXCLUSIVE)
+{
+       entity head;
+       FOR_EACH_REALCLIENT(head)
+       {
+               ++bot_activerealplayers;
+               ++bot_realplayers;
+       }
+
+       return true;
+}
+
 // scoreboard stuff
 void lms_ScoreRules()
 {