2 .float uzi_bulletcounter;
3 float() FlashCustomize = { return other == self.owner; };
5 void W_Uzi_Attack (void)
9 if (cvar("g_use_ammunition"))
11 if (self.uzi_bulletcounter == 1)
12 self.ammo_nails = self.ammo_nails - cvar("g_balance_uzi_first_ammo");
14 self.ammo_nails = self.ammo_nails - cvar("g_balance_uzi_sustained_ammo");
16 W_SetupShot (self, '15 5.5 -8', TRUE, 0, "weapons/uzi_fire.ogg");
17 if (!cvar("g_norecoil"))
19 self.punchangle_x = random () - 0.5;
20 self.punchangle_y = random () - 0.5;
23 // this attack_finished just enforces a cooldown at the end of a burst
24 self.attack_finished = time + cvar("g_balance_uzi_first_refire");
26 if (self.uzi_bulletcounter == 1)
27 fireBullet (w_shotorg, w_shotdir, cvar("g_balance_uzi_first_spread"), cvar("g_balance_uzi_first_damage"), IT_UZI, (self.uzi_bulletcounter & 3) == 0);
29 fireBullet (w_shotorg, w_shotdir, cvar("g_balance_uzi_sustained_spread"), cvar("g_balance_uzi_sustained_damage"), IT_UZI, (self.uzi_bulletcounter & 3) == 0);
33 setorigin(flash, '53 5 0');
34 setmodel(flash, "models/uziflash.md3");
35 setattachment(flash, self.weaponentity, "bone01");
37 flash.customizeentityforclient = FlashCustomize;
38 flash.angles_z = flash.v_angle_z + random() * 180;
41 SUB_SetFade(flash, time, 0.2);
42 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
45 if (cvar("g_casings") >= 2)
46 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);
52 if(self.weapon != self.switchweapon) // abort immediately if switching
59 if (!weapon_action(self.weapon, WR_CHECKAMMO2))
61 self.switchweapon = w_getbestweapon(self);
62 if (self.switchweapon != self.weapon)
63 self.cnt = self.weapon;
67 self.attack_finished = time + cvar("g_balance_uzi_refire");
68 self.uzi_bulletcounter = self.uzi_bulletcounter + 1;
70 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), uzi_fire1_02);
73 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), w_ready);
76 float(float req) w_uzi =
79 if(vlen(self.origin-self.enemy.origin)<750)
80 self.button0 = bot_aim(1000000, 0, 0.001, FALSE);
83 self.button3 = bot_aim(1000000, 0, 0.001, FALSE);
85 else if (req == WR_THINK)
88 if (weapon_prepareattack(0, cvar("g_balance_uzi_refire")))
90 self.uzi_bulletcounter = 1;
92 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), uzi_fire1_02);
95 if (weapon_prepareattack(1, cvar("g_balance_uzi_refire")))
97 self.uzi_bulletcounter = 1;
99 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), w_ready);
102 else if (req == WR_SETUP)
103 weapon_setup(WEP_UZI, "uzi", IT_NAILS);
104 else if (req == WR_CHECKAMMO1)
105 return self.ammo_nails >= cvar("g_balance_uzi_first_ammo");
106 else if (req == WR_CHECKAMMO2)
107 return self.ammo_nails >= cvar("g_balance_uzi_sustained_ammo");