]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/mutators/mutator_superspec.qc
Hook: merge offhand and weapon behaviour
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / mutator_superspec.qc
index 1bb5872a0f4c7717df92686dd0ec29b88ebfe2c3..32e81319dfe87dda5d6eeaa680aed00836bd77ae 100644 (file)
@@ -100,7 +100,6 @@ float superspec_filteritem(entity _for, entity _item)
 
 MUTATOR_HOOKFUNCTION(superspec_ItemTouch)
 {SELFPARAM();
-       entity _oldself = self;
        entity _item = self;
 
        entity e;
@@ -118,7 +117,7 @@ MUTATOR_HOOKFUNCTION(superspec_ItemTouch)
                                {
                                        _spectate(other);
 
-                                       setself(_oldself);
+                                       setself(this);
                                        return MUT_ITEMTOUCH_CONTINUE;
                                }
                        }
@@ -148,7 +147,7 @@ MUTATOR_HOOKFUNCTION(superspec_ItemTouch)
                }
        }
 
-       setself(_oldself);
+       setself(this);
 
        return MUT_ITEMTOUCH_CONTINUE;
 }
@@ -389,15 +388,18 @@ MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
                        return true;
 
                entity _player;
-               float _team = 0;
-               float found = false;
+               int _team = 0;
+               bool found = false;
 
                if(cmd_argc == 2)
                {
-                       if(argv(1) == "red")
-                               _team = NUM_TEAM_1;
-                       else
-                               _team = NUM_TEAM_2;
+                       switch(argv(1))
+                       {
+                               case "red": _team = NUM_TEAM_1; break;
+                               case "blue": _team = NUM_TEAM_2; break;
+                               case "yellow": if(ctf_teams >= 3) _team = NUM_TEAM_3; break;
+                               case "pink": if(ctf_teams >= 4) _team = NUM_TEAM_4; break;
+                       }
                }
 
                FOR_EACH_PLAYER(_player)