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 5.5 -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.weapon != self.switchweapon) // abort immediately if switching
54 if (!weapon_action(self.weapon, WR_CHECKAMMO2))
56 self.switchweapon = w_getbestweapon(self);
57 if (self.switchweapon != self.weapon)
58 self.cnt = self.weapon;
62 self.attack_finished = time + cvar("g_balance_uzi_refire");
63 self.uzi_bulletcounter = self.uzi_bulletcounter + 1;
65 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), uzi_fire1_02);
68 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), w_ready);
71 float(float req) w_uzi =
74 if(vlen(self.origin-self.enemy.origin)<750)
75 self.button0 = bot_aim(1000000, 0, 0.001, FALSE);
78 self.button3 = bot_aim(1000000, 0, 0.001, FALSE);
80 else if (req == WR_THINK)
83 if (weapon_prepareattack(0, cvar("g_balance_uzi_refire")))
85 self.uzi_bulletcounter = 1;
87 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), uzi_fire1_02);
90 if (weapon_prepareattack(1, cvar("g_balance_uzi_refire")))
92 self.uzi_bulletcounter = 1;
94 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), w_ready);
97 else if (req == WR_SETUP)
98 weapon_setup(WEP_UZI, "uzi", IT_NAILS);
99 else if (req == WR_CHECKAMMO1)
100 return self.ammo_nails >= cvar("g_balance_uzi_first_ammo");
101 else if (req == WR_CHECKAMMO2)
102 return self.ammo_nails >= cvar("g_balance_uzi_sustained_ammo");