]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/sv_spawner.qc
98222f6ac9b37e68531db26c8eca575ab0d1a118
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / sv_spawner.qc
1 #include "sv_monsters.qh"
2 #include "sv_spawner.qh"
3 #include "sv_spawn.qh"
4
5 void spawner_use(entity this, entity actor, entity trigger)
6 {
7         int moncount = 0;
8         IL_EACH(g_monsters, it.realowner == this,
9         {
10                 ++moncount;
11         });
12
13         if(moncount >= this.count)
14                 return;
15
16         entity e = spawn();
17         e.noalign = this.noalign;
18         e.angles = this.angles;
19         e.monster_skill = this.monster_skill;
20         e.skin = this.skin;
21         e = spawnmonster(e, this.spawnmob, MON_Null, this, this, this.origin, false, true, this.monster_moveflags);
22 }
23
24 spawnfunc(monster_spawner)
25 {
26         if(!autocvar_g_monsters || !this.spawnmob || this.spawnmob == "") { delete(this); return; }
27
28         this.use = spawner_use;
29 }