]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/tturrets/units/unit_flac.qc
Merge remote branch 'origin/master' into samual/menu_updates
[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, 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, 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
33     self.tur_head.frame = self.tur_head.frame + 1;
34     if (self.tur_head.frame >= 4) 
35         self.tur_head.frame = 0;
36
37 }
38
39 void turret_flac_dinit()
40 {
41     if (self.netname == "")      
42         self.netname  = "FLAC Cannon";
43
44     self.turrcaps_flags = TFL_TURRCAPS_RADIUSDMG | TFL_TURRCAPS_FASTPROJ | TFL_TURRCAPS_MISSILEKILL;
45     self.ammo_flags     = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
46     self.aim_flags      = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
47     
48     if (turret_stdproc_init("flac_std", "models/turrets/base.md3", "models/turrets/flac.md3", TID_FLAC) == 0)
49     {
50         remove(self);
51         return;
52     }
53     setsize(self.tur_head,'-32 -32 0','32 32 64');
54
55     self.damage_flags |= TFL_DMG_HEADSHAKE;
56     self.target_select_flags |= TFL_TARGETSELECT_NOTURRETS | TFL_TARGETSELECT_MISSILESONLY;
57     
58     // Our fire routine
59     self.turret_firefunc  = turret_flac_attack;
60
61 }
62 /*QUAKED turret_flac (0 .5 .8) ?
63 */
64
65 void spawnfunc_turret_flac()
66 {
67     precache_model ("models/turrets/base.md3");
68     precache_model ("models/turrets/flac.md3");
69
70     self.think = turret_flac_dinit;
71     self.nextthink = time + 0.5;
72 }
73