Merge branch 'master' into Mario/monsters
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / mutators / gamemode_onslaught.qc
index b5b6594..8048916 100644 (file)
@@ -1644,11 +1644,48 @@ MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
     return 0;
 }
 
+MUTATOR_HOOKFUNCTION(ons_MonsterThink)
+{
+       entity e = find(world, targetname, self.target);
+       if (e != world)
+               self.team = e.team;
+               
+       self.SendFlags |= MSF_STATUS; // update team
+
+       return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(ons_MonsterSpawn)
+{
+       entity e, ee = world;
+       
+       if(self.targetname)
+       {
+               e = find(world,target,self.targetname);
+               if(e != world)
+               {
+                       self.team = e.team;
+                       self.SendFlags |= MSF_STATUS;
+                       ee = e;
+               }
+       }
+       
+       if(ee)
+       {
+        activator = ee;
+        self.use();
+    }
+
+       return FALSE;
+}
+
 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(MonsterMove, ons_MonsterThink, CBC_ORDER_ANY);
+       MUTATOR_HOOK(MonsterSpawn, ons_MonsterSpawn, CBC_ORDER_ANY);
        //MUTATOR_HOOK(Spawn_Score, ons_Spawn_Score, CBC_ORDER_ANY);
 
        MUTATOR_ONADD