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