2 .float uzi_bulletcounter;
3 void W_Uzi_Attack (void)
7 if (cvar("g_use_ammunition"))
9 if (self.uzi_bulletcounter == 1)
10 self.ammo_nails = self.ammo_nails - cvar("g_balance_uzi_first_ammo");
12 self.ammo_nails = self.ammo_nails - cvar("g_balance_uzi_sustained_ammo");
14 W_SetupShot (self, '15 8 -8', TRUE, 0, "weapons/uzi_fire.ogg");
15 if (!cvar("g_norecoil"))
17 self.punchangle_x = random () - 0.5;
18 self.punchangle_y = random () - 0.5;
21 // this attack_finished just enforces a cooldown at the end of a burst
22 self.attack_finished = time + cvar("g_balance_uzi_first_refire");
24 if (self.uzi_bulletcounter == 1)
25 fireBullet (w_shotorg, w_shotdir, cvar("g_balance_uzi_first_spread"), cvar("g_balance_uzi_first_damage"), IT_UZI, (self.uzi_bulletcounter & 3) == 0);
27 fireBullet (w_shotorg, w_shotdir, cvar("g_balance_uzi_sustained_spread"), cvar("g_balance_uzi_sustained_damage"), IT_UZI, (self.uzi_bulletcounter & 3) == 0);
30 setorigin (flash, w_shotorg + v_forward * 17);
31 setmodel (flash, "models/uziflash.md3");
32 flash.angles = vectoangles (w_shotdir);
33 flash.angles_z=flash.v_angle_z + random () * 180;
36 SUB_SetFade (flash, time, 0.2);
37 flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
40 if (cvar("g_casings") >= 2)
41 SpawnCasing (w_shotorg + v_forward * 10, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3);
47 if (self.button0 && self.weapon == self.switchweapon)
49 if (!weapon_action(self.weapon, WR_CHECKAMMO2))
51 self.switchweapon = w_getbestweapon(self);
52 if (self.switchweapon != self.weapon)
53 self.cnt = self.weapon;
57 self.attack_finished = time + cvar("g_balance_uzi_refire");
58 self.uzi_bulletcounter = self.uzi_bulletcounter + 1;
60 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), uzi_fire1_02);
63 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), w_ready);
66 float(float req) w_uzi =
69 self.button0 = bot_aim(1000000, 0, 0.001, FALSE);
70 else if (req == WR_THINK)
73 if (weapon_prepareattack(0, cvar("g_balance_uzi_refire")))
75 self.uzi_bulletcounter = 1;
77 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), uzi_fire1_02);
80 if (weapon_prepareattack(1, cvar("g_balance_uzi_refire")))
82 self.uzi_bulletcounter = 1;
84 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), w_ready);
87 else if (req == WR_SETUP)
88 weapon_setup(WEP_UZI, "uzi", IT_NAILS);
89 else if (req == WR_CHECKAMMO1)
90 return self.ammo_nails >= cvar("g_balance_uzi_first_ammo");
91 else if (req == WR_CHECKAMMO2)
92 return self.ammo_nails >= cvar("g_balance_uzi_sustained_ammo");