this.classname = "invasion_spawnpoint";
IL_PUSH(g_invasion_spawns, this);
-
- if(autocvar_g_invasion_zombies_only) // precache only if it hasn't been already
- if(this.spawnmob)
- {
- FOREACH(Monsters, it.netname == this.spawnmob,
- {
- it.mr_precache(it);
- });
- }
}
Monster invasion_PickMonster(int supermonster_count)
{
- if(autocvar_g_invasion_zombies_only)
- return MON_ZOMBIE;
-
RandomSelection_Init();
FOREACH(Monsters, it != MON_Null,
{
if((it.spawnflags & MONSTER_TYPE_PASSIVE) || (it.spawnflags & MONSTER_TYPE_FLY) || (it.spawnflags & MONSTER_TYPE_SWIM) || (it.spawnflags & MONSTER_SIZE_QUAKE) || ((it.spawnflags & MON_FLAG_SUPERMONSTER) && supermonster_count >= 1))
continue;
+ if(autocvar_g_invasion_zombies_only && !(it.spawnflags & MONSTER_TYPE_UNDEAD))
+ continue;
RandomSelection_AddEnt(it, 1, 1);
});
setsize(e, mon.mins, mon.maxs);
if(MoveToRandomMapLocation(e, DPCONTENTS_SOLID | DPCONTENTS_CORPSE | DPCONTENTS_PLAYERCLIP, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_BODY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 10, 1024, 256))
- monster = spawnmonster(e, "", mon.m_id, NULL, NULL, e.origin, false, false, 2);
- else return;
+ monster = spawnmonster(e, "", mon.monsterid, NULL, NULL, e.origin, false, false, 2);
+ else
+ {
+ delete(e);
+ return;
+ }
}
else // if spawnmob field falls through (unset), fallback to mon (relying on spawnmonster for that behaviour)
- monster = spawnmonster(spawn(), spawn_point.spawnmob, mon.m_id, spawn_point, spawn_point, spawn_point.origin, false, false, 2);
+ monster = spawnmonster(spawn(), spawn_point.spawnmob, mon.monsterid, spawn_point, spawn_point, spawn_point.origin, false, false, 2);
+
+ if(!monster)
+ return;
if(spawn_point) monster.target2 = spawn_point.target2;
monster.spawnshieldtime = time;
void invasion_Initialize()
{
- if(autocvar_g_invasion_zombies_only) {
- Monster mon = MON_ZOMBIE;
- mon.mr_precache(mon);
- } else
- {
- float i;
- entity mon;
- for(i = MON_FIRST; i <= MON_LAST; ++i)
- {
- mon = get_monsterinfo(i);
- if((mon.spawnflags & MONSTER_TYPE_FLY) || (mon.spawnflags & MONSTER_TYPE_SWIM))
- continue; // flying/swimming monsters not yet supported
-
- mon.mr_precache(mon);
- }
- }
-
InitializeEntity(NULL, invasion_DelayedInit, INITPRIO_GAMETYPE);
}