mirror of
https://github.com/nzp-team/quakec.git
synced 2025-02-26 05:31:09 +00:00
SERVER: Prevent Melee Lunge with large vertical difference
This commit is contained in:
parent
32f15342a5
commit
86df8159a0
1 changed files with 46 additions and 43 deletions
|
@ -1195,6 +1195,7 @@ void() WeaponCore_Melee =
|
||||||
vector trace_source = self.origin + self.view_ofs;
|
vector trace_source = self.origin + self.view_ofs;
|
||||||
traceline(trace_source, trace_source + v_forward * melee_range, 0, self);
|
traceline(trace_source, trace_source + v_forward * melee_range, 0, self);
|
||||||
|
|
||||||
|
if (fabs(trace_endpos_z - trace_source_z) <= 15) {
|
||||||
// Check if this is a Zombie limb, set to the body if so
|
// Check if this is a Zombie limb, set to the body if so
|
||||||
if (trace_ent.owner.head == trace_ent || trace_ent.owner.larm == trace_ent || trace_ent.owner.rarm == trace_ent)
|
if (trace_ent.owner.head == trace_ent || trace_ent.owner.larm == trace_ent || trace_ent.owner.rarm == trace_ent)
|
||||||
trace_ent = trace_ent.owner;
|
trace_ent = trace_ent.owner;
|
||||||
|
@ -1215,12 +1216,13 @@ void() WeaponCore_Melee =
|
||||||
SpawnBlood(trace_source + (v_forward * 20), trace_source + (v_forward * 20), 50);
|
SpawnBlood(trace_source + (v_forward * 20), trace_source + (v_forward * 20), 50);
|
||||||
|
|
||||||
// Calculate distance to use for the Lunge velocity
|
// Calculate distance to use for the Lunge velocity
|
||||||
float lunge_factor = fabs(vlen(trace_source - (trace_endpos - v_forward*4)));
|
float lunge_factor = vlen(trace_source - (trace_endpos - v_forward*4));
|
||||||
|
|
||||||
// Perform lunge, exclusive to AI.
|
// Perform lunge, exclusive to AI.
|
||||||
if (lunge_factor > WEAPONCORE_MELEE_LUNGEMIN) {
|
if (lunge_factor > WEAPONCORE_MELEE_LUNGEMIN) {
|
||||||
did_lunge = true;
|
did_lunge = true;
|
||||||
applied_velocity = v_forward * melee_range * 6;
|
applied_velocity = v_forward * melee_range * 6;
|
||||||
|
applied_velocity_z = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Some other ent (player, button, etc.)
|
// Some other ent (player, button, etc.)
|
||||||
|
@ -1243,6 +1245,7 @@ void() WeaponCore_Melee =
|
||||||
DamageHandler (trace_ent, self, melee_damage, S_KNIFE);
|
DamageHandler (trace_ent, self, melee_damage, S_KNIFE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Grab animation stats for our melee weapon.
|
// Grab animation stats for our melee weapon.
|
||||||
float start_frame = WepDef_GetMeleeFirstFrame(self.weapon, did_lunge, self.bowie);
|
float start_frame = WepDef_GetMeleeFirstFrame(self.weapon, did_lunge, self.bowie);
|
||||||
|
|
Loading…
Reference in a new issue