]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/sv_spawner.qc
Fixed spawner.qc having improper filename.
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / sv_spawner.qc
diff --git a/qcsrc/common/monsters/sv_spawner.qc b/qcsrc/common/monsters/sv_spawner.qc
new file mode 100644 (file)
index 0000000..0b34d13
--- /dev/null
@@ -0,0 +1,26 @@
+#include "sv_spawn.qh"
+
+void spawner_use(entity this, entity actor, entity trigger)
+{
+       int moncount = 0;
+       IL_EACH(g_monsters, it.realowner == this,
+       {
+               ++moncount;
+       });
+
+       if(moncount >= this.count)
+               return;
+
+       entity e = spawn();
+       e.noalign = this.noalign;
+       e.angles = this.angles;
+       e.monster_skill = this.monster_skill;
+       e = spawnmonster(e, this.spawnmob, 0, this, this, this.origin, false, true, this.monster_moveflags);
+}
+
+spawnfunc(monster_spawner)
+{
+       if(!autocvar_g_monsters || !this.spawnmob || this.spawnmob == "") { delete(this); return; }
+
+       this.use = spawner_use;
+}