Merge branch 'master' into Mario/vaporizer_damage
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / tturrets / units / unit_flac.qc
1 void spawnfunc_turret_flac();
2 void turret_flac_dinit();
3 void turret_flac_attack();
4
5 void turret_flac_projectile_think_explode()
6 {
7     if(self.enemy != world)
8     if(vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 3)
9         setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius);
10
11 #ifdef TURRET_DEBUG
12     float d;
13     d = RadiusDamage (self, self.owner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
14     self.owner.tur_dbg_dmg_t_h = self.owner.tur_dbg_dmg_t_h + d;
15     self.owner.tur_dbg_dmg_t_f = self.owner.tur_dbg_dmg_t_f + self.owner.shot_dmg;
16 #else
17     RadiusDamage (self, self.realowner, self.owner.shot_dmg, self.owner.shot_dmg, self.owner.shot_radius, self, world, self.owner.shot_force, self.totalfrags, world);
18 #endif
19     remove(self);
20 }
21
22 void turret_flac_attack()
23 {
24     entity proj;
25
26     turret_tag_fire_update();
27
28     proj = turret_projectile("weapons/hagar_fire.wav", 5, 0, DEATH_TURRET_FLAC, PROJECTILE_HAGAR, true, true);
29     pointparticles(particleeffectnum("laser_muzzleflash"), self.tur_shotorg, self.tur_shotdir_updated * 1000, 1);
30     proj.think      = turret_flac_projectile_think_explode;
31     proj.nextthink  = time + self.tur_impacttime + (random() * 0.01 - random() * 0.01);
32     proj.missile_flags = MIF_SPLASH | MIF_PROXY;
33
34     self.tur_head.frame = self.tur_head.frame + 1;
35     if (self.tur_head.frame >= 4)
36         self.tur_head.frame = 0;
37
38 }
39
40 void turret_flac_dinit()
41 {
42     if (self.netname == "")
43         self.netname  = "FLAC Cannon";
44
45     self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_FASTPROJ | TFL_TURRCAPS_MISSILEKILL;
46     self.ammo_flags     = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
47     self.aim_flags      = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
48
49     if (turret_stdproc_init("flac_std", "models/turrets/base.md3", "models/turrets/flac.md3", TID_FLAC) == 0)
50     {
51         remove(self);
52         return;
53     }
54     setsize(self.tur_head,'-32 -32 0','32 32 64');
55
56     self.damage_flags |= TFL_DMG_HEADSHAKE;
57     self.target_select_flags |= TFL_TARGETSELECT_NOTURRETS | TFL_TARGETSELECT_MISSILESONLY;
58
59     // Our fire routine
60     self.turret_firefunc  = turret_flac_attack;
61
62 }
63 /*QUAKED turret_flac (0 .5 .8) ?
64 */
65
66 void spawnfunc_turret_flac()
67 {
68     precache_model ("models/turrets/base.md3");
69     precache_model ("models/turrets/flac.md3");
70
71     self.think = turret_flac_dinit;
72     self.nextthink = time + 0.5;
73 }
74