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