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
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
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;
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()
{