Xonotic
sv_spawner.qc File Reference
+ Include dependency graph for sv_spawner.qc:

Go to the source code of this file.

Functions

void spawner_use (entity this, entity actor, entity trigger)
 
 spawnfunc (monster_spawner)
 

Function Documentation

◆ spawner_use()

void spawner_use ( entity  this,
entity  actor,
entity  trigger 
)

Definition at line 6 of file sv_spawner.qc.

References angles, count, entity(), g_monsters, IL_EACH, monster_moveflags, monster_skill, noalign, origin, skin, spawn(), spawnmob, and spawnmonster().

Referenced by spawnfunc().

7 {
8  int moncount = 0;
9  IL_EACH(g_monsters, it.realowner == this,
10  {
11  ++moncount;
12  });
13 
14  if(moncount >= this.count)
15  return;
16 
17  entity e = spawn();
18  e.noalign = this.noalign;
19  e.angles = this.angles;
20  e.monster_skill = this.monster_skill;
21  e.skin = this.skin;
22  e = spawnmonster(e, this.spawnmob, MON_Null, this, this, this.origin, false, true, this.monster_moveflags);
23 }
#define IL_EACH(this, cond, body)
entity spawnmonster(entity e, string monster, Monster monster_id, entity spawnedby, entity own, vector orig, bool respwn, bool removeifinvalid, int moveflag)
Definition: sv_spawn.qc:14
skin
Definition: ent_cs.qc:143
entity() spawn
origin
Definition: ent_cs.qc:114
string spawnmob
Definition: sv_spawner.qh:3
float noalign
Definition: items.qh:42
int monster_skill
Definition: sv_monsters.qh:96
int monster_moveflags
Definition: sv_monsters.qh:47
float count
Definition: powerups.qc:22
vector angles
Definition: csprogsdefs.qc:104
IntrusiveList g_monsters
Definition: sv_monsters.qh:144
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ spawnfunc()

spawnfunc ( monster_spawner  )

Definition at line 25 of file sv_spawner.qc.

References autocvar_g_monsters, spawner_use(), spawnmob, and use.

26 {
27  if(!autocvar_g_monsters || !this.spawnmob || this.spawnmob == "") { delete(this); return; }
28 
29  this.use = spawner_use;
30 }
void spawner_use(entity this, entity actor, entity trigger)
Definition: sv_spawner.qc:6
string spawnmob
Definition: sv_spawner.qh:3
float autocvar_g_monsters
Definition: sv_monsters.qh:5
#define use
Definition: csprogsdefs.qh:50
+ Here is the call graph for this function: