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