]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/tturrets/units/unit_mlrs.qc
Start of uncrusticracy script, and kill trailing whitespace in all sources.
[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     missile.missile_flags = MIF_SPLASH;
24     te_explosion (missile.origin);
25 }
26
27 void turret_mlrs_dinit()
28 {
29     if (self.netname == "")      self.netname  = "MLRS turret";
30
31     self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_MEDPROJ | TFL_TURRCAPS_PLAYERKILL;
32     self.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
33     self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
34
35     if (turret_stdproc_init("mlrs_std", "models/turrets/base.md3", "models/turrets/mlrs.md3", TID_MLRS) == 0)
36     {
37         remove(self);
38         return;
39     }
40
41     self.damage_flags |= TFL_DMG_HEADSHAKE;
42     self.shoot_flags  |= TFL_SHOOT_VOLLYALWAYS;
43     self.volly_counter = self.shot_volly;
44
45     // Our fire routine
46     self.turret_firefunc  = turret_mlrs_attack;
47     self.turret_postthink = turret_mlrs_postthink;
48
49 }
50
51 /*QUAKED turret_mlrs (0 .5 .8) ?
52 */
53
54 void spawnfunc_turret_mlrs()
55 {
56     precache_model ("models/turrets/mlrs.md3");
57     precache_model ("models/turrets/base.md3");
58
59     self.think = turret_mlrs_dinit;
60     self.nextthink = time + 0.5;
61 }
62
63