Merge branch 'master' into Mario/turrets
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_onslaught.qc
index d1f20f7..9ad1191 100644 (file)
@@ -1657,6 +1657,29 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
     return 0;
 }
 
+MUTATOR_HOOKFUNCTION(ons_TurretSpawn)
+{
+       entity e, ee = world;
+       if(self.targetname)
+       {
+               e = find(world, target, self.targetname);
+
+               if(e != world)
+               {
+                       self.team = e.team;
+                       ee = e;
+               }
+       }
+       
+       if(ee)
+       {
+               activator = ee;
+               self.use();
+       }
+
+       return FALSE;
+}
+
 MUTATOR_HOOKFUNCTION(ons_MonsterThink)
 {
        entity e = find(world, targetname, self.target);
@@ -1673,15 +1696,6 @@ MUTATOR_HOOKFUNCTION(ons_MonsterSpawn)
        if(self.targetname)
        {
                e = find(world,target,self.targetname);
-               if(e != world)
-               {
-                       self.team = e.team;
-                       ee = e;
-               }
-       }
-
-       if(ee)
-       {
         activator = ee;
         self.use();
     }
@@ -1694,6 +1708,7 @@ MUTATOR_DEFINITION(gamemode_onslaught)
        MUTATOR_HOOK(BuildMutatorsPrettyString, ons_BuildMutatorsPrettyString, CBC_ORDER_ANY);
        MUTATOR_HOOK(BuildMutatorsString, ons_BuildMutatorsString, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerSpawn, ons_PlayerSpawn, CBC_ORDER_ANY);
+       MUTATOR_HOOK(TurretSpawn, ons_TurretSpawn, CBC_ORDER_ANY);
        MUTATOR_HOOK(MonsterMove, ons_MonsterThink, CBC_ORDER_ANY);
        MUTATOR_HOOK(MonsterSpawn, ons_MonsterSpawn, CBC_ORDER_ANY);
        //MUTATOR_HOOK(Spawn_Score, ons_Spawn_Score, CBC_ORDER_ANY);