]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into Mario/custom_monster
authorMario <mario@smbclan.net>
Mon, 13 Mar 2017 04:43:08 +0000 (14:43 +1000)
committerMario <mario@smbclan.net>
Mon, 13 Mar 2017 04:43:08 +0000 (14:43 +1000)
1  2 
qcsrc/common/monsters/sv_spawner.qc

index 0000000000000000000000000000000000000000,0b34d13e659633a1892e10db93771a761ad4b629..af4ce841d4ae2543dd7da1449b8e27562f48edc5
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,26 +1,48 @@@
 -      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);
+ #include "sv_spawn.qh"
++bool autocvar_g_monster_spawner_copyfields = false; // just incase this gets too nasty
++
++.bool use_trigger_origin;
++
+ 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();
++      if(autocvar_g_monster_spawner_copyfields)
++      {
++              copyentity(this, e);
++              // we don't NEED to reset these, but might as well
++              e.classname = "monster";
++              e.use = func_null;
++              e.count = 0;
++      }
++      else
++      {
++              e.noalign = this.noalign;
++              e.angles = this.angles;
++              e.monster_skill = this.monster_skill;
++      }
++
++      vector org = this.origin;
++      if(this.use_trigger_origin)
++      {
++              org = trigger.origin; // TODO: doesn't support brushes
++              e.angles = trigger.angles;
++      }
++      e = spawnmonster(e, this.spawnmob, 0, this, this, org, false, true, this.monster_moveflags);
+ }
+ spawnfunc(monster_spawner)
+ {
+       if(!autocvar_g_monsters || !this.spawnmob || this.spawnmob == "") { delete(this); return; }
+       this.use = spawner_use;
+ }