3 /* WEP_##id */ SHOCKWAVE,
4 /* function */ W_Shockwave,
5 /* ammotype */ IT_SHELLS,
7 /* flags */ WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN,
8 /* rating */ BOT_PICKUP_RATING_LOW,
10 /* netname */ "shockwave",
11 /* fullname */ _("Shockwave")
14 #define SHOCKWAVE_SETTINGS(w_cvar,w_prop) \
15 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_damage) \
16 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_distance) \
17 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_edgedamage) \
18 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_force) \
19 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_force_forwardbias) \
20 /*w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_force_velocitybias)*/ \
21 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_force_zscale) \
22 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_damage) \
23 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_edgedamage) \
24 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_force) \
25 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_force_velocitybias) \
26 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_force_zscale) \
27 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_multiplier_accuracy) \
28 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_multiplier_distance) \
29 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_multiplier_min) \
30 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_jump_radius) \
31 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_multiplier_accuracy) \
32 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_multiplier_distance) \
33 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_multiplier_min) \
34 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_damage) \
35 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_edgedamage) \
36 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_force) \
37 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_force_forwardbias) \
38 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_multiplier_accuracy) \
39 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_multiplier_distance) \
40 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_multiplier_min) \
41 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_splash_radius) \
42 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_spread_max) \
43 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, blast_spread_min) \
44 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_animtime) \
45 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_damage) \
46 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_delay) \
47 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_force) \
48 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_multihit) \
49 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_no_doubleslap) \
50 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_nonplayerdamage) \
51 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_range) \
52 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_refire) \
53 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_swing_side) \
54 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_swing_up) \
55 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_time) \
56 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, melee_traces) \
57 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_ammo) \
58 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_animtime) \
59 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_bulletconstant) \
60 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_bullets) \
61 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_damage) \
62 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_force) \
63 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_refire) \
64 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_speed) \
65 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, pellets_spread) \
66 w_cvar(WEP_SHOCKWAVE, shockwave, MO_NONE, secondary) \
67 w_prop(WEP_SHOCKWAVE, shockwave, reloading_ammo, reload_ammo) \
68 w_prop(WEP_SHOCKWAVE, shockwave, reloading_time, reload_time) \
69 w_prop(WEP_SHOCKWAVE, shockwave, switchdelay_raise, switchdelay_raise) \
70 w_prop(WEP_SHOCKWAVE, shockwave, switchdelay_drop, switchdelay_drop)
73 SHOCKWAVE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
77 void spawnfunc_weapon_shockwave()
79 //if(autocvar_sv_q3acompat_machineshockwaveswap)
80 if(autocvar_sv_q3acompat_machineshotgunswap)
81 if(self.classname != "droppedweapon")
83 weapon_defaultspawnfunc(WEP_UZI);
86 weapon_defaultspawnfunc(WEP_SHOCKWAVE);
90 .entity swing_alreadyhit;
91 .float shockwave_pelletstime;
92 entity shockwave_hit[32];
93 float shockwave_hit_damage[32];
94 vector shockwave_hit_force[32];
96 // LEGACY ATTACK MODE: Scattered bullets
97 void W_Shockwave_Pellets(void)
106 float bulletconstant;
109 ammoamount = WEP_CVAR(shockwave, pellets_ammo);
110 bullets = WEP_CVAR(shockwave, pellets_bullets);
111 d = WEP_CVAR(shockwave, pellets_damage);
112 f = WEP_CVAR(shockwave, pellets_force);
113 spread = WEP_CVAR(shockwave, pellets_spread);
114 bulletspeed = WEP_CVAR(shockwave, pellets_speed);
115 bulletconstant = WEP_CVAR(shockwave, pellets_bulletconstant);
117 W_DecreaseAmmo(ammo_shells, ammoamount, autocvar_g_balance_shockwave_reload_ammo);
119 W_SetupShot(self, TRUE, 5, "weapons/shockwave_fire.wav", CH_WEAPON_A, d * bullets);
120 for(sc = 0;sc < bullets;sc = sc + 1)
121 fireBallisticBullet(w_shotorg, w_shotdir, spread, bulletspeed, 5, d, f, WEP_SHOCKWAVE, 0, bulletconstant);
122 endFireBallisticBullet();
124 pointparticles(particleeffectnum("shockwave_muzzleflash"), w_shotorg, w_shotdir * 1000, WEP_CVAR(shockwave, pellets_ammo));
127 if(autocvar_g_casings >= 1)
128 for(sc = 0;sc < ammoamount;sc = sc + 1)
129 SpawnCasing(((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 30) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 1, self);
131 // muzzle flash for 1st person view
133 setmodel(flash, "models/uziflash.md3"); // precision set below
134 flash.think = SUB_Remove;
135 flash.nextthink = time + 0.06;
136 flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
137 W_AttachToShotorg(flash, '5 0 0');
141 void W_Shockwave_Melee_Think()
144 float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
145 entity target_victim;
148 if(!self.cnt) // set start time of melee
151 W_PlayStrengthSound(self.realowner);
154 makevectors(self.realowner.v_angle); // update values for v_* vectors
156 // calculate swing percentage based on time
157 meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor();
158 swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
159 f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
161 // check to see if we can still continue, otherwise give up now
162 if((self.realowner.deadflag != DEAD_NO) && WEP_CVAR(shockwave, melee_no_doubleslap))
168 // if okay, perform the traces needed for this frame
169 for(i=self.swing_prev; i < f; ++i)
171 swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
173 targpos = (self.realowner.origin + self.realowner.view_ofs
174 + (v_forward * WEP_CVAR(shockwave, melee_range))
175 + (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
176 + (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
178 WarpZone_traceline_antilag(self.realowner, self.realowner.origin + self.realowner.view_ofs, targpos, FALSE, self.realowner, ANTILAG_LATENCY(self.realowner));
180 // draw lightning beams for debugging
181 te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
182 te_customflash(targpos, 40, 2, '1 1 1');
184 is_player = (trace_ent.classname == "player" || trace_ent.classname == "body");
186 if((trace_fraction < 1) // if trace is good, apply the damage and remove self
187 && (trace_ent.takedamage == DAMAGE_AIM)
188 && (trace_ent != self.swing_alreadyhit)
189 && (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
191 target_victim = trace_ent; // so it persists through other calls
193 if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught.
194 swing_damage = (WEP_CVAR(shockwave, melee_damage * min(1, swing_factor + 1)));
196 swing_damage = (WEP_CVAR(shockwave, melee_nonplayerdamage * min(1, swing_factor + 1)));
198 //print(strcat(self.realowner.netname, " hitting ", target_victim.netname, " with ", strcat(ftos(swing_damage), " damage (factor: ", ftos(swing_factor), ") at "), ftos(time), " seconds.\n"));
200 Damage(target_victim, self.realowner, self.realowner,
201 swing_damage, WEP_SHOCKWAVE | HITTYPE_SECONDARY,
202 self.realowner.origin + self.realowner.view_ofs,
203 v_forward * WEP_CVAR(shockwave, melee_force));
205 if(accuracy_isgooddamage(self.realowner, target_victim)) { accuracy_add(self.realowner, WEP_SHOCKWAVE, 0, swing_damage); }
207 if(WEP_CVAR(shockwave, melee_multihit)) // allow multiple hits with one swing, but not against the same player twice.
209 self.swing_alreadyhit = target_victim;
210 continue; // move along to next trace
220 if(time >= self.cnt + meleetime)
230 self.nextthink = time;
234 void W_Shockwave_Melee()
236 sound(self, CH_WEAPON_A, "weapons/shotgun_melee.wav", VOL_BASE, ATTN_NORM);
237 weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
241 meleetemp.owner = meleetemp.realowner = self;
242 meleetemp.think = W_Shockwave_Melee_Think;
243 meleetemp.nextthink = time + WEP_CVAR(shockwave, melee_delay) * W_WeaponRateFactor();
244 W_SetupShot_Range(self, TRUE, 0, "", 0, WEP_CVAR(shockwave, melee_damage), WEP_CVAR(shockwave, melee_range));
247 // SHOCKWAVE ATTACK MODE
248 float W_Shockwave_Attack_CheckSpread(
250 vector nearest_on_line,
252 vector attack_endpos)
255 float distance_of_attack = vlen(sw_shotorg - attack_endpos);
256 float distance_from_line = vlen(targetorg - nearest_on_line);
258 spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
259 spreadlimit = (WEP_CVAR(shockwave, blast_spread_min) * (1 - spreadlimit) + WEP_CVAR(shockwave, blast_spread_max) * spreadlimit);
262 (spreadlimit && (distance_from_line <= spreadlimit))
264 ((vlen(normalize(targetorg - sw_shotorg) - normalize(attack_endpos - sw_shotorg)) * RAD2DEG) <= 90)
266 { return bound(0, (distance_from_line / spreadlimit), 1); }
271 float W_Shockwave_Attack_IsVisible(
273 vector nearest_on_line,
275 vector attack_endpos)
277 vector nearest_to_attacker = head.WarpZone_findradius_nearest;
278 vector center = (head.origin + (head.mins + head.maxs) * 0.5);
282 // STEP ONE: Check if the nearest point is clear
283 if(W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, sw_shotorg, attack_endpos))
285 WarpZone_TraceLine(sw_shotorg, nearest_to_attacker, MOVE_NOMONSTERS, self);
286 if(trace_fraction == 1) { return TRUE; } // yes, the nearest point is clear and we can allow the damage
289 // STEP TWO: Check if shotorg to center point is clear
290 if(W_Shockwave_Attack_CheckSpread(center, nearest_on_line, sw_shotorg, attack_endpos))
292 WarpZone_TraceLine(sw_shotorg, center, MOVE_NOMONSTERS, self);
293 if(trace_fraction == 1) { return TRUE; } // yes, the center point is clear and we can allow the damage
296 // STEP THREE: Check each corner to see if they are clear
299 corner = get_corner_position(head, i);
300 if(W_Shockwave_Attack_CheckSpread(corner, nearest_on_line, sw_shotorg, attack_endpos))
302 WarpZone_TraceLine(sw_shotorg, corner, MOVE_NOMONSTERS, self);
303 if(trace_fraction == 1) { return TRUE; } // yes, this corner is clear and we can allow the damage
310 float W_Shockwave_Attack_CheckHit(
316 if not(head) { return FALSE; }
321 for(i = 1; i <= queue; ++i)
323 if(shockwave_hit[i] == head)
325 if(vlen(final_force) > vlen(shockwave_hit_force[i])) { shockwave_hit_force[i] = final_force; }
326 if(final_damage > shockwave_hit_damage[i]) { shockwave_hit_damage[i] = final_damage; }
331 shockwave_hit[queue] = head;
332 shockwave_hit_force[queue] = final_force;
333 shockwave_hit_damage[queue] = final_damage;
337 void W_Shockwave_Attack()
340 float multiplier, multiplier_from_accuracy, multiplier_from_distance;
341 float final_damage; //, final_spread;
342 vector final_force, center, vel;
347 // set up the shot direction
348 W_SetupShot(self, FALSE, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
349 vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
350 WarpZone_TraceLine(w_shotorg, attack_endpos, MOVE_NOMONSTERS, self);
351 vector attack_hitpos = trace_endpos;
352 float distance_to_end = vlen(w_shotorg - attack_endpos);
353 float distance_to_hit = vlen(w_shotorg - attack_hitpos);
354 //entity transform = WarpZone_trace_transform;
356 // do the firing effect now
357 //SendCSQCShockwaveParticle(attack_endpos); // WEAPONTODO
358 Damage_DamageInfo(attack_hitpos, WEP_CVAR(shockwave, blast_splash_damage), WEP_CVAR(shockwave, blast_splash_edgedamage), WEP_CVAR(shockwave, blast_splash_radius), w_shotdir * WEP_CVAR(shockwave, blast_splash_force), WEP_SHOCKWAVE, 0, self);
360 // splash damage/jumping trace
361 head = WarpZone_FindRadius(attack_hitpos, max(WEP_CVAR(shockwave, blast_splash_radius), WEP_CVAR(shockwave, blast_jump_radius)), FALSE);
368 center = CENTER_OR_VIEWOFS(head);
370 float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
372 if((head == self) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
374 multiplier_from_accuracy = (1 - (distance_to_head ? min(1, (distance_to_head / WEP_CVAR(shockwave, blast_jump_radius))) : 0));
375 multiplier_from_distance = (1 - (distance_to_hit ? min(1, (distance_to_hit / distance_to_end)) : 0));
376 multiplier = max(WEP_CVAR(shockwave, blast_jump_multiplier_min), ((multiplier_from_accuracy * WEP_CVAR(shockwave, blast_jump_multiplier_accuracy)) + (multiplier_from_distance * WEP_CVAR(shockwave, blast_jump_multiplier_distance))));
378 final_force = ((normalize(center - attack_hitpos) * WEP_CVAR(shockwave, blast_jump_force)) * multiplier);
379 vel = head.velocity; vel_z = 0;
380 vel = normalize(vel) * bound(0, vlen(vel) / autocvar_sv_maxspeed, 1) * WEP_CVAR(shockwave, blast_jump_force_velocitybias);
381 final_force = (vlen(final_force) * normalize(normalize(final_force) + vel));
382 final_force_z *= WEP_CVAR(shockwave, blast_jump_force_zscale);
383 final_damage = (WEP_CVAR(shockwave, blast_jump_damage) * multiplier + WEP_CVAR(shockwave, blast_jump_edgedamage) * (1 - multiplier));
385 Damage(head, self, self, final_damage, WEP_SHOCKWAVE, head.origin, final_force);
386 //print("SELF HIT: multiplier = ", ftos(multiplier), strcat(", damage = ", ftos(final_damage), ", force = ", ftos(vlen(final_force))),"... multiplier_from_accuracy = ", ftos(multiplier_from_accuracy), ", multiplier_from_distance = ", ftos(multiplier_from_distance), ".\n");
388 else if (distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
390 multiplier_from_accuracy = (1 - (distance_to_head ? min(1, (distance_to_head / WEP_CVAR(shockwave, blast_splash_radius))) : 0));
391 multiplier_from_distance = (1 - (distance_to_hit ? min(1, (distance_to_hit / distance_to_end)) : 0));
392 multiplier = max(WEP_CVAR(shockwave, blast_splash_multiplier_min), ((multiplier_from_accuracy * WEP_CVAR(shockwave, blast_splash_multiplier_accuracy)) + (multiplier_from_distance * WEP_CVAR(shockwave, blast_splash_multiplier_distance))));
394 final_force = normalize(center - (attack_hitpos - (w_shotdir * WEP_CVAR(shockwave, blast_splash_force_forwardbias))));
395 //te_lightning2(world, attack_hitpos, (attack_hitpos + (final_force * 200)));
396 final_force = ((final_force * WEP_CVAR(shockwave, blast_splash_force)) * multiplier);
397 final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
398 final_damage = (WEP_CVAR(shockwave, blast_splash_damage) * multiplier + WEP_CVAR(shockwave, blast_splash_edgedamage) * (1 - multiplier));
400 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
401 //print("SPLASH HIT: multiplier = ", ftos(multiplier), strcat(", damage = ", ftos(final_damage), ", force = ", ftos(vlen(final_force))),"... multiplier_from_accuracy = ", ftos(multiplier_from_accuracy), ", multiplier_from_distance = ", ftos(multiplier_from_distance), ".\n");
408 head = WarpZone_FindRadius(w_shotorg, WEP_CVAR(shockwave, blast_distance), FALSE);
413 if((head != self) && head.takedamage)
415 // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
416 center = CENTER_OR_VIEWOFS(head);
418 // find the closest point on the enemy to the center of the attack
419 float ang; // angle between shotdir and h
420 float h; // hypotenuse, which is the distance between attacker to head
421 float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
423 h = vlen(center - self.origin);
424 ang = acos(dotproduct(normalize(center - self.origin), w_shotdir));
427 vector nearest_on_line = (w_shotorg + a * w_shotdir);
428 vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
429 float distance_to_target = vlen(w_shotorg - nearest_to_attacker); // todo: use the findradius function for this
431 if((distance_to_target <= WEP_CVAR(shockwave, blast_distance))
432 && (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
434 multiplier_from_accuracy = (1 - W_Shockwave_Attack_CheckSpread(nearest_to_attacker, nearest_on_line, w_shotorg, attack_endpos));
435 multiplier_from_distance = (1 - (distance_to_hit ? min(1, (distance_to_target / distance_to_end)) : 0));
436 multiplier = max(WEP_CVAR(shockwave, blast_multiplier_min), ((multiplier_from_accuracy * WEP_CVAR(shockwave, blast_multiplier_accuracy)) + (multiplier_from_distance * WEP_CVAR(shockwave, blast_multiplier_distance))));
438 final_force = normalize(center - (nearest_on_line - (w_shotdir * WEP_CVAR(shockwave, blast_force_forwardbias))));
439 //te_lightning2(world, nearest_on_line, (attack_hitpos + (final_force * 200)));
440 final_force = ((final_force * WEP_CVAR(shockwave, blast_force)) * multiplier);
441 final_force_z *= WEP_CVAR(shockwave, blast_force_zscale);
442 final_damage = (WEP_CVAR(shockwave, blast_damage) * multiplier + WEP_CVAR(shockwave, blast_edgedamage) * (1 - multiplier));
444 if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { ++queue; }
445 //print("CONE HIT: multiplier = ", ftos(multiplier), strcat(", damage = ", ftos(final_damage), ", force = ", ftos(vlen(final_force))),"... multiplier_from_accuracy = ", ftos(multiplier_from_accuracy), ", multiplier_from_distance = ", ftos(multiplier_from_distance), ".\n");
451 for(i = 1; i <= queue; ++i)
453 head = shockwave_hit[i];
454 final_force = shockwave_hit_force[i];
455 final_damage = shockwave_hit_damage[i];
457 Damage(head, self, self, final_damage, WEP_SHOCKWAVE, head.origin, final_force);
458 print("SHOCKWAVE by ", self.netname, ": damage = ", ftos(final_damage), ", force = ", ftos(vlen(final_force)), ".\n");
460 shockwave_hit[i] = world;
461 shockwave_hit_force[i] = '0 0 0';
462 shockwave_hit_damage[i] = 0;
464 //print("queue was ", ftos(queue), ".\n\n");
467 float W_Shockwave(float req)
474 if(vlen(self.origin-self.enemy.origin) <= WEP_CVAR(shockwave, melee_range))
475 { self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, FALSE); }
477 { self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, FALSE); }
483 if(autocvar_g_balance_shockwave_reload_ammo && self.clip_load < WEP_CVAR(shockwave, pellets_ammo)) // forced reload
485 // don't force reload an empty shockwave if its melee attack is active
486 if(!(autocvar_g_balance_shockwave_secondary && self.ammo_shells < WEP_CVAR(shockwave, pellets_ammo)))
487 WEP_ACTION(self.weapon, WR_RELOAD);
491 if (self.BUTTON_ATCK)
493 if (time >= self.shockwave_pelletstime) // handle refire separately so the secondary can be fired straight after a primary
495 if(weapon_prepareattack(0, WEP_CVAR(shockwave, pellets_animtime)))
497 W_Shockwave_Attack();
498 self.shockwave_pelletstime = time + WEP_CVAR(shockwave, pellets_refire) * W_WeaponRateFactor();
499 weapon_thinkf(WFRAME_FIRE1, WEP_CVAR(shockwave, pellets_animtime), w_ready);
504 if (self.clip_load >= 0) // we are not currently reloading
505 if (!self.crouch) // no crouchmelee please
506 if (self.BUTTON_ATCK2 && autocvar_g_balance_shockwave_secondary)
507 if (weapon_prepareattack(1, WEP_CVAR(shockwave, melee_refire)))
509 // attempt forcing playback of the anim by switching to another anim (that we never play) here...
510 weapon_thinkf(WFRAME_FIRE1, 0, W_Shockwave_Melee);
517 precache_model("models/uziflash.md3");
518 precache_model("models/weapons/g_shockwave.md3");
519 precache_model("models/weapons/v_shockwave.md3");
520 precache_model("models/weapons/h_shockwave.iqm");
521 precache_sound("misc/itempickup.wav");
522 precache_sound("weapons/shockwave_fire.wav");
523 precache_sound("weapons/shockwave_melee.wav");
524 SHOCKWAVE_SETTINGS(WEP_SKIPCVAR, WEP_SET_PROP)
529 self.current_ammo = ammo_shells;
534 ammo_amount = self.ammo_shells >= WEP_CVAR(shockwave, pellets_ammo);
535 ammo_amount += self.(weapon_load[WEP_SHOCKWAVE]) >= WEP_CVAR(shockwave, pellets_ammo);
540 // melee attack is always available
545 SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS)
550 W_Reload(WEP_CVAR(shockwave, pellets_ammo), "weapons/reload.wav");
553 case WR_SUICIDEMESSAGE:
555 return WEAPON_THINKING_WITH_PORTALS;
559 if(w_deathtype & HITTYPE_SECONDARY)
560 return WEAPON_SHOCKWAVE_MURDER_SLAP;
562 return WEAPON_SHOCKWAVE_MURDER;
569 float W_Shockwave(float req)
573 case WR_IMPACTEFFECT:
576 org2 = w_org + w_backoff * 2;
577 pointparticles(particleeffectnum("shockwave_impact"), org2, w_backoff * 1000, 1);
582 //precache_sound("weapons/ric1.wav");
583 //precache_sound("weapons/ric2.wav");
584 //precache_sound("weapons/ric3.wav");