]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/server/tturrets/units/unit_machinegun.qc
make it compile
[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
9     entity flash;
10
11     sound (self, CHAN_WEAPON, "weapons/uzi_fire.wav", VOL_BASE, ATTN_NORM);
12     fireBallisticBullet (self.tur_shotorg, self.tur_shotdir_updated,self.shot_spread, self.shot_speed, 5, self.shot_dmg, 0, self.shot_force, DEATH_TURRET, 0, 1, cvar("g_balance_uzi_bulletconstant"));
13     endFireBallisticBullet();
14
15     //w_deathtypestring = "had an alergic reaction due to 10 kilos of led";
16     te_smallflash(self.tur_shotorg);
17
18     // muzzle flash for 3rd person view
19     flash = spawn();
20     setmodel(flash, "models/uziflash.md3"); // precision set below
21     setattachment(flash, self.tur_head, "tag_fire");
22     flash.think = W_Uzi_Flash_Go;
23     flash.nextthink = time + 0.02;
24     flash.frame = 2;
25     flash.angles_z = flash.v_angle_z + random() * 180;
26     flash.alpha = 1;
27     flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
28 }
29
30
31 void turret_machinegun_std_init()
32 {
33     if (self.netname == "")      self.netname     = "Machinegun Turret";
34
35     self.ammo_flags = TFL_AMMO_BULLETS | TFL_AMMO_RECHARGE | TFL_AMMO_RECIVE;
36     self.turrcaps_flags = TFL_TURRCAPS_PLAYERKILL;
37     self.aim_flags = TFL_AIM_LEAD | TFL_AIM_SHOTTIMECOMPENSATE;
38     
39         if not (cvar("g_antilag_bullets"))
40                 self.turrcaps_flags |= TFL_TURRCAPS_HITSCAN;
41
42     if (turret_stdproc_init("machinegun_std",0,"models/turrets/base.md3","models/turrets/machinegun.md3") == 0)
43     {
44         remove(self);
45         return;
46     }
47
48     self.damage_flags |= TFL_DMG_HEADSHAKE;
49
50     if (!turret_tag_fire_update())
51         dprint("Warning: Turret ",self.classname, " faild to initialize md3 tags\n");
52
53     // Our fire routine
54     self.turret_firefunc  = turret_machinegun_attack;
55
56 }
57
58
59 /*QUAKED turret_machinegun (0 .5 .8) ?
60 * machinegun turret. does what you'd expect
61 */
62 void spawnfunc_turret_machinegun()
63 {
64     precache_model ("models/turrets/machinegun.md3");
65     precache_model ("models/turrets/base.md3");
66     precache_sound ("weapons/uzi_fire.wav");
67
68     self.think = turret_machinegun_std_init;
69     self.nextthink = time + 0.5;
70 }
71