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