]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator/gamemode_ca.qc
Merge branch 'master' into Mario/bulldozer
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator / gamemode_ca.qc
index 20330b7579133e14cd3dac28ab0c0c16e9b36b0e..725569bfff6469745c55a56ffcce910131287071 100644 (file)
@@ -1,19 +1,46 @@
 #ifndef GAMEMODE_CA_H
 #define GAMEMODE_CA_H
 
+int autocvar_g_ca_point_limit;
+int autocvar_g_ca_point_leadlimit;
+bool autocvar_g_ca_team_spawns;
+
+void ca_Initialize();
+
+REGISTER_MUTATOR(ca, false)
+{
+       MUTATOR_ONADD
+       {
+               if (time > 1) // game loads at time 1
+                       error("This is a game type and it cannot be added at runtime.");
+               ca_Initialize();
+
+               ActivateTeamplay();
+               SetLimits(autocvar_g_ca_point_limit, autocvar_g_ca_point_leadlimit, -1, -1);
+
+               if (autocvar_g_ca_team_spawns)
+                       have_team_spawns = -1; // request team spawns
+       }
+
+       MUTATOR_ONREMOVE
+       {
+               LOG_INFO("This is a game type and it cannot be removed at runtime.");
+               return -1;
+       }
+
+       return 0;
+}
+
 // should be removed in the future, as other code should not have to care
 .float caplayer; // 0.5 if scheduled to join the next round
 #endif
 
 #ifdef IMPLEMENTATION
 float autocvar_g_ca_damage2score_multiplier;
-int autocvar_g_ca_point_leadlimit;
-int autocvar_g_ca_point_limit;
 float autocvar_g_ca_round_timelimit;
 bool autocvar_g_ca_spectate_enemies;
 int autocvar_g_ca_teams;
 int autocvar_g_ca_teams_override;
-bool autocvar_g_ca_team_spawns;
 float autocvar_g_ca_warmup;
 
 float ca_teams;
@@ -210,7 +237,7 @@ MUTATOR_HOOKFUNCTION(ca, PutClientInServer)
        if(!allowed_to_spawn)
        if(IS_PLAYER(self)) // this is true even when player is trying to join
        {
-               self.classname = "observer";
+               self.classname = STR_OBSERVER;
                if(self.jointime != time) //not when connecting
                if(!self.caplayer)
                {
@@ -236,7 +263,7 @@ MUTATOR_HOOKFUNCTION(ca, reset_map_players)
                }
                if(self.caplayer)
                {
-                       self.classname = "player";
+                       self.classname = STR_PLAYER;
                        self.caplayer = 1;
                        PutClientInServer();
                }
@@ -246,7 +273,7 @@ MUTATOR_HOOKFUNCTION(ca, reset_map_players)
 
 MUTATOR_HOOKFUNCTION(ca, ClientConnect)
 {SELFPARAM();
-       self.classname = "observer";
+       self.classname = STR_OBSERVER;
        return 1;
 }
 
@@ -503,27 +530,4 @@ void ca_Initialize()
        EliminatedPlayers_Init(ca_isEliminated);
 }
 
-REGISTER_MUTATOR(ca, g_ca)
-{
-       ActivateTeamplay();
-       SetLimits(autocvar_g_ca_point_limit, autocvar_g_ca_point_leadlimit, -1, -1);
-
-       if(autocvar_g_ca_team_spawns)
-               have_team_spawns = -1; // request team spawns
-
-       MUTATOR_ONADD
-       {
-               if(time > 1) // game loads at time 1
-                       error("This is a game type and it cannot be added at runtime.");
-               ca_Initialize();
-       }
-
-       MUTATOR_ONREMOVE
-       {
-               LOG_INFO("This is a game type and it cannot be removed at runtime.");
-               return -1;
-       }
-
-       return 0;
-}
 #endif