#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; }
if(monster == "random")
{
RandomSelection_Init();
- FOREACH(Monsters, it != MON_Null,
+ FOREACH(Monsters, it != MON_Null && !(it.spawnflags & MONSTER_TYPE_PASSIVE),
{
- RandomSelection_Add(it, 0, string_null, 1, 1);
+ RandomSelection_AddEnt(it, 1, 1);
});
monster_id = RandomSelection_chosen_ent.monsterid;
}
// Monster_Spawn checks if monster is valid
- Monster_Spawn(e, monster_id);
+ Monster_Spawn(e, false, monster_id);
return e;
}