Merge remote-tracking branch 'origin/divVerent/allow-override-item-model'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / tturrets / units / unit_machinegun.qc
1 void spawnfunc_turret_machinegun();
2 void turret_machinegun_std_init();
3 void turret_machinegun_attack();
4
5 //.float bulletcounter;
6 void turret_machinegun_attack()
7 {
8     fireBallisticBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, self.shot_speed, 5, self.shot_dmg, 0, self.shot_force, DEATH_TURRET_MACHINEGUN, 0, 1, autocvar_g_balance_uzi_bulletconstant);
9     endFireBallisticBullet();
10
11     UziFlash();
12     setattachment(self.muzzle_flash, self.tur_head, "tag_fire");
13 }
14
15
16 void turret_machinegun_std_init()
17 {
18     if (self.netname == "")      self.netname     = "Machinegun Turret";
19
20     self.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;
21     self.turrcaps_flags = TFL_TURRCAPS_PLAYERKILL;
22     self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
23     
24         if not (autocvar_g_antilag_bullets)
25                 self.turrcaps_flags |= TFL_TURRCAPS_HITSCAN;
26
27     if (turret_stdproc_init("machinegun_std", "models/turrets/base.md3", "models/turrets/machinegun.md3", TID_MACHINEGUN) == 0)
28     {
29         remove(self);
30         return;
31     }
32
33     self.damage_flags |= TFL_DMG_HEADSHAKE;
34
35     // Our fire routine
36     self.turret_firefunc  = turret_machinegun_attack;
37
38 }
39
40
41 /*QUAKED turret_machinegun (0 .5 .8) ?
42 * machinegun turret. does what you'd expect
43 */
44 void spawnfunc_turret_machinegun()
45 {
46     precache_model ("models/turrets/machinegun.md3");
47     precache_model ("models/turrets/base.md3");
48     precache_sound ("weapons/uzi_fire.wav");
49
50     self.think = turret_machinegun_std_init;
51     self.nextthink = time + 0.5;
52 }
53