From: Mario Date: Mon, 13 Mar 2017 04:43:08 +0000 (+1000) Subject: Merge branch 'master' into Mario/custom_monster X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e2a1f38d2373e0de4a3d2013a4f1e140289ab484;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into Mario/custom_monster --- e2a1f38d2373e0de4a3d2013a4f1e140289ab484 diff --cc qcsrc/common/monsters/sv_spawner.qc index 000000000,0b34d13e6..af4ce841d mode 000000,100644..100644 --- a/qcsrc/common/monsters/sv_spawner.qc +++ b/qcsrc/common/monsters/sv_spawner.qc @@@ -1,0 -1,26 +1,48 @@@ + #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(); - 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); ++ 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; + }