2 void W_Shotgun_Attack (void)
11 bullets = cvar("g_balance_shotgun_primary_bullets");
12 d = cvar("g_balance_shotgun_primary_damage");
13 f = cvar("g_balance_shotgun_primary_force");
14 spread = cvar("g_balance_shotgun_primary_spread");
16 W_SetupShot (self, '11 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
17 for (sc = 0;sc < bullets;sc = sc + 1)
18 fireBullet (w_shotorg, w_shotdir, spread, d, f, IT_SHOTGUN, sc < 3);
19 if (cvar("g_use_ammunition"))
20 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_primary_ammo");
22 W_Smoke(w_shotorg + v_forward * 8, v_forward, 12);
23 //te_smallflash(w_shotorg);
26 if (cvar("g_casings") >= 1)
27 SpawnCasing (w_shotorg, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1);
29 // muzzle flash for 1st person view
31 setorigin(flash, '53 5 0');
32 setmodel(flash, "models/uziflash.md3"); // precision set below
33 setattachment(flash, self.weaponentity, "bone01");
35 flash.viewmodelforclient = self;
36 flash.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
38 flash.think = SUB_Remove;
39 flash.nextthink = time + 0.06;
40 flash.angles_z = flash.v_angle_z + random() * 180;
42 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
46 void W_Shotgun_Attack2 (void)
54 bullets = cvar("g_balance_shotgun_secondary_bullets");
55 d = cvar("g_balance_shotgun_secondary_damage");
56 f = cvar("g_balance_shotgun_secondary_force");
57 spread = cvar("g_balance_shotgun_secondary_spread");
59 W_SetupShot (self, '11 8 -8', TRUE, 5, "weapons/shotgun_fire.wav");
60 for (sc = 0;sc < bullets;sc = sc + 1)
61 fireBullet (w_shotorg, w_shotdir, spread, d, f, IT_SHOTGUN, sc < 3);
62 if (cvar("g_use_ammunition"))
63 self.ammo_shells = self.ammo_shells - cvar("g_balance_shotgun_secondary_ammo");
65 W_Smoke(w_shotorg + v_forward * 8, v_forward, 12);
66 //te_smallflash(w_shotorg);
69 if (cvar("g_casings") >= 1)
70 SpawnCasing (w_shotorg, ((random () * 50 + 50) * v_right) - ((random () * 25 + 25) * v_forward) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1);
74 void() shotgun_fire2_03 =
77 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), w_ready);
79 void() shotgun_fire2_02 =
82 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_03);
85 float(float req) w_shotgun =
88 if(vlen(self.origin-self.enemy.origin)>200)
89 self.button0 = bot_aim(1000000, 0, 0.001, FALSE);
91 self.button3 = bot_aim(1000000, 0, 0.001, FALSE);
92 else if (req == WR_THINK)
95 if (weapon_prepareattack(0, cvar("g_balance_shotgun_primary_refire")))
98 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_primary_animtime"), w_ready);
101 if (weapon_prepareattack(1, cvar("g_balance_shotgun_secondary_refire")))
104 weapon_thinkf(WFRAME_FIRE1, cvar("g_balance_shotgun_secondary_animtime"), shotgun_fire2_02);
107 else if (req == WR_PRECACHE)
109 precache_model ("models/tracer.mdl");
110 precache_model ("models/weapons/g_shotgun.md3");
111 precache_model ("models/weapons/v_shotgun.md3");
112 precache_model ("models/weapons/w_shotgun.zym");
113 precache_sound ("misc/itempickup.wav");
114 precache_sound ("weapons/ric1.wav");
115 precache_sound ("weapons/ric2.wav");
116 precache_sound ("weapons/ric3.wav");
117 precache_sound ("weapons/shotgun_fire.wav");
118 precache_sound ("weapons/tink1.wav");
119 if (cvar("g_casings") >= 1)
120 precache_model ("models/casing_shell.mdl");
122 else if (req == WR_SETUP)
123 weapon_setup(WEP_SHOTGUN, "shotgun", IT_SHELLS);
124 else if (req == WR_CHECKAMMO1)
125 return self.ammo_shells >= cvar("g_balance_shotgun_primary_ammo");
126 else if (req == WR_CHECKAMMO2)
127 return self.ammo_shells >= cvar("g_balance_shotgun_secondary_ammo") * 3;
128 else if (req == WR_REGISTER)
129 weapon_register(WEP_SHOTGUN, min(cvar("g_balance_shotgun_primary_ammo"), cvar("g_balance_shotgun_secondary_ammo")));