3 void() uzi_deselect_01;
8 if (self.ammo_nails >= cvar("g_balance_uzi_first_ammo"))
15 if (self.ammo_nails >= cvar("g_balance_uzi_sustained_ammo"))
20 void(float req) w_uzi =
24 else if (req == WR_FIRE1 || req == WR_FIRE2)
25 weapon_prepareattack(uzi_check, uzi_check, uzi_fire1_01, cvar("g_balance_uzi_refire"));
26 else if (req == WR_RAISE)
28 else if (req == WR_UPDATECOUNTS)
29 self.currentammo = self.ammo_nails;
30 else if (req == WR_DROP)
32 else if (req == WR_SETUP)
33 weapon_setup(WEP_UZI, "w_uzi.zym", IT_NAILS);
34 else if (req == WR_CHECKAMMO)
35 weapon_hasammo = uzi_check();
38 .float uzi_bulletcounter;
39 void W_Uzi_Attack (void)
44 trueaim = W_TrueAim();
47 sound (self, CHAN_WEAPON, "weapons/uzi_fire.ogg", 1, ATTN_NORM);
48 if (self.items & IT_STRENGTH)
49 sound (self, CHAN_AUTO, "weapons/strength_fire.ogg", 1, ATTN_NORM);
51 if (cvar("g_use_ammunition"))
53 if (self.uzi_bulletcounter == 1)
54 self.ammo_nails = self.ammo_nails - cvar("g_balance_uzi_first_ammo");
56 self.ammo_nails = self.ammo_nails - cvar("g_balance_uzi_sustained_ammo");
58 self.punchangle_x = random () - 0.5;
59 self.punchangle_y = random () - 0.5;
60 org = W_MuzzleOrigin (self, '32 6 -8');
62 // this attack_finished just enforces a cooldown at the end of a burst
63 self.attack_finished = time + cvar("g_balance_uzi_first_refire");
65 if (self.uzi_bulletcounter == 1)
66 fireBullet (org, normalize(trueaim - org), cvar("g_balance_uzi_first_spread"), cvar("g_balance_uzi_first_damage"), IT_UZI, (self.uzi_bulletcounter & 3) == 0);
68 fireBullet (org, normalize(trueaim - org), cvar("g_balance_uzi_sustained_spread"), cvar("g_balance_uzi_sustained_damage"), IT_UZI, (self.uzi_bulletcounter & 3) == 0);
71 // org = self.origin + self.view_ofs + (v_right * 6) - (v_up * 10) + (v_forward * 40);
72 setorigin (flash, org);
73 setmodel (flash, "models/uziflash.md3");
74 flash.velocity = v_forward * 20;
75 flash.angles = vectoangles (flash.velocity);
76 flash.angles_z=flash.v_angle_z + random () * 180;
79 SUB_SetFade (flash, time, 0.2);
80 flash.effects = flash.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
83 if (cvar("g_casings") >= 2)
85 org = W_MuzzleOrigin (self, '10 6 -8');
86 SpawnCasing (org, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 + 10) * v_up), 2, v_forward,'0 250 0', 100, 2);
91 void() uzi_ready_01 = {weapon_thinkf(WFRAME_IDLE, 0.1, uzi_ready_01); self.weaponentity.state = WS_READY;};
92 void() uzi_select_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_ready); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, '0 0 0');};
93 void() uzi_deselect_01 = {weapon_thinkf(-1, cvar("g_balance_weaponswitchdelay"), w_clear); weapon_boblayer1(PLAYER_WEAPONSELECTION_SPEED, PLAYER_WEAPONSELECTION_RANGE);};
96 if (self.button0 && self.weapon == self.switchweapon)
98 self.uzi_bulletcounter = self.uzi_bulletcounter + 1;
99 weapon_doattack(uzi_check2, uzi_check2, W_Uzi_Attack);
100 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), uzi_fire1_02);
103 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), uzi_ready_01);
105 void() uzi_fire1_01 =
107 self.uzi_bulletcounter = 1;
108 weapon_doattack(uzi_check, uzi_check, W_Uzi_Attack);
109 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_uzi_sustained_refire"), uzi_fire1_02);