3 // TURRET PLUGIN SYSTEM
4 entity turret_info[TUR_MAXCOUNT];
5 entity dummy_turret_info;
7 void turrets_common_precache()
9 precache_sound (W_Sound("rocket_impact"));
10 precache_model ("models/turrets/base-gib1.md3");
11 precache_model ("models/turrets/base-gib2.md3");
12 precache_model ("models/turrets/base-gib3.md3");
13 precache_model ("models/turrets/base-gib4.md3");
14 precache_model ("models/turrets/head-gib1.md3");
15 precache_model ("models/turrets/head-gib2.md3");
16 precache_model ("models/turrets/head-gib3.md3");
17 precache_model ("models/turrets/head-gib4.md3");
18 precache_model ("models/turrets/base.md3");
19 precache_model ("models/turrets/rocket.md3");
21 precache_model ("models/turrets/c512.md3");
22 precache_model ("models/marker.md3");
25 precache_sound(W_Sound("rocket_impact"));
29 precache_model ("models/turrets/c512.md3");
30 precache_model ("models/pathlib/goodsquare.md3");
31 precache_model ("models/pathlib/badsquare.md3");
32 precache_model ("models/pathlib/square.md3");
33 precache_model ("models/pathlib/edge.md3");
37 void register_turret(float id, float(float) func, float turretflags, vector min_s, vector max_s, string modelname, string headmodelname, string shortname, string mname)
40 turret_info[id - 1] = e = spawn();
41 e.classname = "turret_info";
43 e.netname = shortname;
44 e.turret_name = mname;
47 e.cvar_basename = shortname;
48 e.spawnflags = turretflags;
51 e.model = strzone(strcat("models/turrets/", modelname));
52 e.head_model = strzone(strcat("models/turrets/", headmodelname));
55 turrets_common_precache();
58 float t_null(float dummy) { return 0; }
59 void register_turrets_done()
61 dummy_turret_info = spawn();
62 dummy_turret_info.classname = "turret_info";
63 dummy_turret_info.turretid = 0; // you can recognize dummies by this
64 dummy_turret_info.netname = "";
65 dummy_turret_info.turret_name = "Turret";
66 dummy_turret_info.turret_func = t_null;
67 dummy_turret_info.mdl = "";
68 dummy_turret_info.mins = '-0 -0 -0';
69 dummy_turret_info.maxs = '0 0 0';
70 dummy_turret_info.model = "";
72 entity get_turretinfo(float id)
75 if(id < TUR_FIRST || id > TUR_LAST)
76 return dummy_turret_info;
77 m = turret_info[id - 1];
80 return dummy_turret_info;