1 float spawnmonster_checkinlist(string monster, string list)
3 string l = strcat(" ", list, " ");
5 if(strstrofs(l, strcat(" ", monster, " "), 0) >= 0)
11 entity spawnmonster (string monster, entity spawnedby, entity own, vector orig, float respwn, float moveflag)
13 if not(autocvar_g_monsters)
15 if(spawnedby.flags & FL_CLIENT)
16 sprint(spawnedby, "Monsters are disabled. Enable g_monsters to spawn monsters\n");
20 if(spawnedby.vehicle) // no vehicle player spawning...
23 if(!spawncode_first_load)
25 initialize_field_db();
26 spawncode_first_load = TRUE;
31 e.spawnflags = MONSTERFLAG_SPAWNED;
34 e.spawnflags |= MONSTERFLAG_NORESPAWN;
38 if not(spawnmonster_checkinlist(monster, monsterlist()))
41 e.realowner = spawnedby;
44 e.monster_moveflags = moveflag;
46 if (spawnedby.classname == "monster_swarm")
47 e.monster_owner = own;
48 else if(spawnedby.flags & FL_CLIENT)
50 if(teamplay && autocvar_g_monsters_teams)
51 e.team = spawnedby.team; // colors handled in spawn code
54 e.colormap = spawnedby.colormap;
56 if(autocvar_g_monsters_owners)
57 e.monster_owner = own; // using owner makes the monster non-solid for its master
59 e.angles = spawnedby.angles;
62 if(autocvar_g_monsters_giants_only)
63 e.spawnflags |= MONSTERFLAG_GIANT;
65 monster = strcat("$ spawnfunc_monster_", monster);
67 target_spawn_edit_entity(e, monster, world, world, world, world, world);