]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make cmd followfc change to the other fc if we are already spectating a fc
authorterencehill <piuntn@gmail.com>
Sat, 15 Jun 2013 17:00:24 +0000 (19:00 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 15 Jun 2013 17:00:24 +0000 (19:00 +0200)
qcsrc/server/mutators/mutator_superspec.qc

index e5d2e8348606f5950182c89858a9fecd92a433be..96c9f25305534a38d1aba3c695d4b18f0e97a451 100644 (file)
@@ -380,6 +380,7 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
 
                entity _player;
                float _team = 0;
+               float found = FALSE;
 
                if(cmd_argc == 2)
                {
@@ -392,10 +393,16 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                FOR_EACH_PLAYER(_player)
                {
                        if(_player.flagcarried && (_player.team == _team || _team == 0))
+                       {
+                               found = TRUE;
+                               if(_team == 0 && IS_SPEC(self) && self.enemy == _player)
+                                       continue; // already spectating a fc, try to find the other fc
                                return _spectate(_player);
+                       }
                }
 
-               superspec_msg("", "", self, "No active flag carrier\n", 1);
+               if(!found)
+                       superspec_msg("", "", self, "No active flag carrier\n", 1);
                return TRUE;
        }