// set start time of melee
if(!self.cnt)
{
- self.cnt = time;
+ self.cnt = time;
W_PlayStrengthSound(self.realowner);
}
// update values for v_* vectors
makevectors(self.realowner.v_angle);
-
+
// calculate swing percentage based on time
meleetime = WEP_CVAR(shockwave, melee_time) * W_WeaponRateFactor();
swing = bound(0, (self.cnt + meleetime - time) / meleetime, 10);
f = ((1 - swing) * WEP_CVAR(shockwave, melee_traces));
-
- // perform the traces needed for this frame
+
+ // perform the traces needed for this frame
for(i=self.swing_prev; i < f; ++i)
{
swing_factor = ((1 - (i / WEP_CVAR(shockwave, melee_traces))) * 2 - 1);
-
- targpos = (self.realowner.origin + self.realowner.view_ofs
+
+ targpos = (self.realowner.origin + self.realowner.view_ofs
+ (v_forward * WEP_CVAR(shockwave, melee_range))
+ (v_up * swing_factor * WEP_CVAR(shockwave, melee_swing_up))
+ (v_right * swing_factor * WEP_CVAR(shockwave, melee_swing_side)));
self.realowner,
ANTILAG_LATENCY(self.realowner)
);
-
+
// draw lightning beams for debugging
#ifdef DEBUG_SHOCKWAVE
- te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
+ te_lightning2(world, targpos, self.realowner.origin + self.realowner.view_ofs + v_forward * 5 - v_up * 5);
te_customflash(targpos, 40, 2, '1 1 1');
#endif
-
+
is_player = (IS_PLAYER(trace_ent) || trace_ent.classname == "body" || (trace_ent.flags & FL_MONSTER));
if((trace_fraction < 1) // if trace is good, apply the damage and remove self if necessary
- && (trace_ent.takedamage == DAMAGE_AIM)
+ && (trace_ent.takedamage == DAMAGE_AIM)
&& (trace_ent != self.swing_alreadyhit)
&& (is_player || WEP_CVAR(shockwave, melee_nonplayerdamage)))
{
target_victim = trace_ent; // so it persists through other calls
-
+
if(is_player) // this allows us to be able to nerf the non-player damage done in e.g. assault or onslaught
swing_damage = (WEP_CVAR(shockwave, melee_damage) * min(1, swing_factor + 1));
else
Damage(
target_victim,
self.realowner,
- self.realowner,
+ self.realowner,
swing_damage,
- (WEP_SHOCKWAVE | HITTYPE_SECONDARY),
- (self.realowner.origin + self.realowner.view_ofs),
+ (WEP_SHOCKWAVE | HITTYPE_SECONDARY),
+ (self.realowner.origin + self.realowner.view_ofs),
(v_forward * WEP_CVAR(shockwave, melee_force))
);
}
}
}
-
+
if(time >= self.cnt + meleetime)
{
// melee is finished
}
else
{
- // set up next frame
+ // set up next frame
self.swing_prev = i;
self.nextthink = time;
}
float spreadlimit;
float distance_of_attack = vlen(sw_shotorg - attack_endpos);
float distance_from_line = vlen(targetorg - nearest_on_line);
-
+
spreadlimit = (distance_of_attack ? min(1, (vlen(sw_shotorg - nearest_on_line) / distance_of_attack)) : 1);
spreadlimit =
(
{
if(!head) { return false; }
float i;
-
+
for(i = 0; i <= queue; ++i)
{
if(shockwave_hit[i] == head)
entity head;
float i, queue = 0;
-
+
// set up the shot direction
W_SetupShot(self, false, 3, "weapons/lasergun_fire.wav", CH_WEAPON_B, WEP_CVAR(shockwave, blast_damage));
vector attack_endpos = (w_shotorg + (w_shotdir * WEP_CVAR(shockwave, blast_distance)));
),
false
);
-
+
while(head)
{
if(head.takedamage)
{
float distance_to_head = vlen(attack_hitpos - head.WarpZone_findradius_nearest);
-
+
if((head == self) && (distance_to_head <= WEP_CVAR(shockwave, blast_jump_radius)))
{
// ========================
// BLAST JUMP CALCULATION
// ========================
-
+
// calculate importance of distance and accuracy for this attack
multiplier_from_accuracy = (1 -
(distance_to_head ?
// ==========================
// BLAST SPLASH CALCULATION
// ==========================
-
+
// calculate importance of distance and accuracy for this attack
multiplier_from_accuracy = (1 -
(distance_to_head ?
// BLAST CONE CALCULATION
// ========================
- // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
+ // if it's a player, use the view origin as reference (stolen from RadiusDamage functions in g_damage.qc)
center = CENTER_OR_VIEWOFS(head);
// find the closest point on the enemy to the center of the attack
float ang; // angle between shotdir and h
float h; // hypotenuse, which is the distance between attacker to head
float a; // adjacent side, which is the distance between attacker and the point on w_shotdir that is closest to head.origin
-
+
h = vlen(center - self.origin);
ang = acos(dotproduct(normalize(center - self.origin), w_shotdir));
a = h * cos(ang);
vector nearest_on_line = (w_shotorg + a * w_shotdir);
vector nearest_to_attacker = WarpZoneLib_NearestPointOnBox(center + head.mins, center + head.maxs, nearest_on_line);
- if((vlen(head.WarpZone_findradius_dist) <= WEP_CVAR(shockwave, blast_distance))
+ if((vlen(head.WarpZone_findradius_dist) <= WEP_CVAR(shockwave, blast_distance))
&& (W_Shockwave_Attack_IsVisible(head, nearest_on_line, w_shotorg, attack_endpos)))
{
// calculate importance of distance and accuracy for this attack
head = shockwave_hit[i-1];
final_force = shockwave_hit_force[i-1];
final_damage = shockwave_hit_damage[i-1];
-
+
Damage(
head,
self,
vlen(final_force)
));
#endif
-
+
shockwave_hit[i-1] = world;
shockwave_hit_force[i-1] = '0 0 0';
shockwave_hit_damage[i-1] = 0;
{ self.BUTTON_ATCK2 = bot_aim(1000000, 0, 0.001, false); }
else
{ self.BUTTON_ATCK = bot_aim(1000000, 0, 0.001, false); }
-
+
return true;
}
case WR_THINK:
weapon_thinkf(WFRAME_FIRE1, 0, W_Shockwave_Melee);
}
}
-
+
return true;
}
case WR_INIT:
new_max_dist = vlen(new_min_end - endpos);
new_max_end = (new_min_end + (deviation * new_max_dist));
//te_lightning2(world, new_end, prev_min_end);
-
+
if(counter == 0)
{
entity shockwave;
shockwave = spawn();
shockwave.draw = Draw_Shockwave;
-
+
shockwave.sw_shotorg_x = ReadCoord(); shockwave.sw_shotorg_y = ReadCoord(); shockwave.sw_shotorg_z = ReadCoord();
shockwave.sw_shotdir_x = ReadCoord(); shockwave.sw_shotdir_y = ReadCoord(); shockwave.sw_shotdir_z = ReadCoord();