]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/monsters.qc
Merge branch 'master' into Mario/weapons
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / monsters / monsters.qc
1 #include "all.qh"
2
3 // MONSTER PLUGIN SYSTEM
4 entity monster_info[MON_MAXCOUNT];
5 entity dummy_monster_info;
6
7 void register_monster(float id, float(float) func, float monsterflags, vector min_s, vector max_s, string modelname, string shortname, string mname)
8 {
9         entity e;
10         monster_info[id - 1] = e = spawn();
11         e.classname = "monster_info";
12         e.monsterid = id;
13         e.netname = shortname;
14         e.monster_name = mname;
15         e.monster_func = func;
16         e.mdl = modelname;
17         e.spawnflags = monsterflags;
18         e.mins = min_s;
19         e.maxs = max_s;
20         e.model = strzone(strcat("models/monsters/", modelname));
21 }
22 float m_null(float dummy) { return 0; }
23 void register_monsters_done()
24 {
25         dummy_monster_info = spawn();
26         dummy_monster_info.classname = "monster_info";
27         dummy_monster_info.monsterid = 0; // you can recognize dummies by this
28         dummy_monster_info.netname = "";
29         dummy_monster_info.monster_name = "Monster";
30         dummy_monster_info.monster_func = m_null;
31         dummy_monster_info.mdl = "";
32         dummy_monster_info.mins = '-0 -0 -0';
33         dummy_monster_info.maxs = '0 0 0';
34         dummy_monster_info.model = "";
35 }
36 entity get_monsterinfo(float id)
37 {
38         entity m;
39         if(id < MON_FIRST || id > MON_LAST)
40                 return dummy_monster_info;
41         m = monster_info[id - 1];
42         if(m)
43                 return m;
44         return dummy_monster_info;
45 }