]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/gamemode_ca.qc
Merge branch 'master' into TimePath/deathtypes
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_ca.qc
index a0f238358455a271a80a45d996ecf9c07fe16f36..42aa4a29e77f000832c406a49620331d9010c850 100644 (file)
@@ -1,6 +1,7 @@
-float total_players;
-float redalive, bluealive, yellowalive, pinkalive;
-.float redalive_stat, bluealive_stat, yellowalive_stat, pinkalive_stat;
+#include "gamemode_ca.qh"
+
+#include "gamemode.qh"
+
 float ca_teams;
 float allowed_to_spawn;
 
@@ -161,7 +162,7 @@ float ca_isEliminated(entity e)
 }
 
 MUTATOR_HOOKFUNCTION(ca_PlayerSpawn)
-{
+{SELFPARAM();
        self.caplayer = 1;
        if(!warmup_stage)
                eliminatedPlayers.SendFlags |= 1;
@@ -169,7 +170,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerSpawn)
 }
 
 MUTATOR_HOOKFUNCTION(ca_PutClientInServer)
-{
+{SELFPARAM();
        if(!allowed_to_spawn)
        if(IS_PLAYER(self)) // this is true even when player is trying to join
        {
@@ -186,9 +187,11 @@ MUTATOR_HOOKFUNCTION(ca_PutClientInServer)
 }
 
 MUTATOR_HOOKFUNCTION(ca_reset_map_players)
-{
-       FOR_EACH_CLIENT(self)
+{SELFPARAM();
+       entity e;
+       FOR_EACH_CLIENT(e)
        {
+               setself(e);
                self.killcount = 0;
                if(!self.caplayer && IS_BOT_CLIENT(self))
                {
@@ -206,7 +209,7 @@ MUTATOR_HOOKFUNCTION(ca_reset_map_players)
 }
 
 MUTATOR_HOOKFUNCTION(ca_ClientConnect)
-{
+{SELFPARAM();
        self.classname = "observer";
        return 1;
 }
@@ -224,7 +227,7 @@ MUTATOR_HOOKFUNCTION(ca_GetTeamCount)
 }
 
 entity ca_LastPlayerForTeam()
-{
+{SELFPARAM();
        entity pl, last_pl = world;
        FOR_EACH_PLAYER(pl)
        {
@@ -251,7 +254,7 @@ void ca_LastPlayerForTeam_Notify()
 }
 
 MUTATOR_HOOKFUNCTION(ca_PlayerDies)
-{
+{SELFPARAM();
        ca_LastPlayerForTeam_Notify();
        if(!allowed_to_spawn)
                self.respawn_flags =  RESPAWN_SILENT;
@@ -261,7 +264,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDies)
 }
 
 MUTATOR_HOOKFUNCTION(ca_ClientDisconnect)
-{
+{SELFPARAM();
        if(self.caplayer == 1)
                ca_LastPlayerForTeam_Notify();
        return 1;
@@ -273,7 +276,7 @@ MUTATOR_HOOKFUNCTION(ca_ForbidPlayerScore_Clear)
 }
 
 MUTATOR_HOOKFUNCTION(ca_MakePlayerObserver)
-{
+{SELFPARAM();
        if(self.caplayer == 1)
                ca_LastPlayerForTeam_Notify();
        if(self.killindicator_teamchange == -2)
@@ -315,7 +318,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage)
 {
        if(IS_PLAYER(frag_target))
        if(frag_target.deadflag == DEAD_NO)
-       if(frag_target == frag_attacker || SAME_TEAM(frag_target, frag_attacker) || frag_deathtype == DEATH_FALL)
+       if(frag_target == frag_attacker || SAME_TEAM(frag_target, frag_attacker) || frag_deathtype == DEATH_FALL.m_id)
                frag_damage = 0;
 
        frag_mirrordamage = 0;
@@ -324,7 +327,7 @@ MUTATOR_HOOKFUNCTION(ca_PlayerDamage)
 }
 
 MUTATOR_HOOKFUNCTION(ca_FilterItem)
-{
+{SELFPARAM();
        if(autocvar_g_powerups <= 0)
        if(self.flags & FL_POWERUP)
                return true;
@@ -351,6 +354,12 @@ MUTATOR_HOOKFUNCTION(ca_PlayerRegen)
        return true;
 }
 
+MUTATOR_HOOKFUNCTION(ca_CountFrags)
+{
+       // announce remaining frags
+       return true;
+}
+
 void ca_Initialize()
 {
        allowed_to_spawn = true;
@@ -392,6 +401,7 @@ MUTATOR_DEFINITION(gamemode_ca)
        MUTATOR_HOOK(FilterItem, ca_FilterItem, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDamage_SplitHealthArmor, ca_PlayerDamage_SplitHealthArmor, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerRegen, ca_PlayerRegen, CBC_ORDER_ANY);
+       MUTATOR_HOOK(Scores_CountFragsRemaining, ca_CountFrags, CBC_ORDER_ANY);
 
        MUTATOR_ONADD
        {
@@ -402,7 +412,7 @@ MUTATOR_DEFINITION(gamemode_ca)
 
        MUTATOR_ONREMOVE
        {
-               print("This is a game type and it cannot be removed at runtime.");
+               LOG_INFO("This is a game type and it cannot be removed at runtime.");
                return -1;
        }