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