]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/tturrets/units/unit_mlrs.qc
get rid of some unused turret codepaths & options for better preformance
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / tturrets / units / unit_mlrs.qc
1 void spawnfunc_turret_mlrs();
2 void turret_mlrs_dinit();
3 void turret_mlrs_attack();
4
5 void turret_mlrs_postthink()
6 {
7     // 0 = full, 6 = empty
8     self.tur_head.frame = bound(0, 6 - floor(0.1 + self.ammo / self.shot_dmg), 6);
9     if(self.tur_head.frame < 0)
10     {
11         dprint("ammo:",ftos(self.ammo),"\n");
12         dprint("shot_dmg:",ftos(self.shot_dmg),"\n");
13     }
14 }
15
16 void turret_mlrs_attack()
17 {
18     entity missile;
19     
20     turret_tag_fire_update();    
21     missile = turret_projectile("weapons/rocket_fire.wav", 6, 10, DEATH_TURRET_MLRS, PROJECTILE_ROCKET, TRUE, TRUE);
22     missile.nextthink = time + max(self.tur_impacttime,(self.shot_radius * 2) / self.shot_speed);
23     te_explosion (missile.origin);    
24 }
25
26 void turret_mlrs_dinit()
27 {
28     if (self.netname == "")      self.netname  = "MLRS turret";
29
30     self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL;
31     self.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
32     self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
33
34     if (turret_stdproc_init("mlrs_std", "models/turrets/base.md3", "models/turrets/mlrs.md3", TID_MLRS) == 0)
35     {
36         remove(self);
37         return;
38     }
39
40     self.damage_flags |= TFL_DMG_HEADSHAKE;
41     self.shoot_flags  |= TFL_SHOOT_VOLLYALWAYS;
42     self.volly_counter = self.shot_volly;
43
44     // Our fire routine
45     self.turret_firefunc  = turret_mlrs_attack;
46     self.turret_postthink = turret_mlrs_postthink;
47
48 }
49
50 /*QUAKED turret_mlrs (0 .5 .8) ?
51 */
52
53 void spawnfunc_turret_mlrs()
54 {
55     precache_model ("models/turrets/mlrs.md3");
56     precache_model ("models/turrets/base.md3");
57
58     self.think = turret_mlrs_dinit;
59     self.nextthink = time + 0.5;
60 }
61
62