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