]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/monsters/sv_spawn.qc
Make the target entity a parameter instead of spawning it, so the monster's spawn...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / sv_spawn.qc
index 9e87e488e624323d336ee9cfcedb36ec651b1ba9..056379dbc41f0a88c9e9f7f03026f694bd511778 100644 (file)
@@ -8,10 +8,8 @@
     #include <server/autocvars.qh>
     #include <server/defs.qh>
 #endif
-entity spawnmonster (string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag)
+entity spawnmonster (entity e, string monster, int monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool invincible, int moveflag)
 {
-       entity e = spawn();
-
        e.spawnflags = MONSTERFLAG_SPAWNED;
 
        if(!respwn) { e.spawnflags |= MONSTERFLAG_NORESPAWN; }
@@ -22,7 +20,7 @@ entity spawnmonster (string monster, int monster_id, entity spawnedby, entity ow
        if(monster == "random")
        {
                RandomSelection_Init(); 
-               FOREACH(Monsters, it != MON_Null,
+               FOREACH(Monsters, it != MON_Null && !(it.spawnflags & MONSTER_TYPE_PASSIVE),
                {
                        RandomSelection_AddEnt(it, 1, 1);
                });
@@ -62,7 +60,7 @@ entity spawnmonster (string monster, int monster_id, entity spawnedby, entity ow
        }
 
        // Monster_Spawn checks if monster is valid
-       Monster_Spawn(e, monster_id);
+       Monster_Spawn(e, false, monster_id);
 
        return e;
 }