]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/monsters/monsters.qc
Merge branch 'master' into Mario/monsters
[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, float monsterflags, 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.spawnflags = monsterflags;
24         e.mins = min_s;
25         e.maxs = max_s;
26         e.model = strzone(strcat("models/monsters/", modelname));
27         
28         func(MR_INIT);
29 }
30 float m_null(float dummy) { return 0; }
31 void register_monsters_done()
32 {
33         dummy_monster_info = spawn();
34         dummy_monster_info.classname = "monster_info";
35         dummy_monster_info.monsterid = 0; // you can recognize dummies by this
36         dummy_monster_info.netname = "";
37         dummy_monster_info.monster_name = "Monster";
38         dummy_monster_info.monster_func = m_null;
39         dummy_monster_info.mdl = "";
40         dummy_monster_info.mins = '-0 -0 -0';
41         dummy_monster_info.maxs = '0 0 0';
42         dummy_monster_info.model = "";
43 }
44 entity get_monsterinfo(float id)
45 {
46         entity m;
47         if(id < MON_FIRST || id > MON_LAST)
48                 return dummy_monster_info;
49         m = monster_info[id - 1];
50         if(m)
51                 return m;
52         return dummy_monster_info;
53 }