Skip to content

Commit 455b3d2

Browse files
committed
SERVER: Improve Ballistic Knife reliability/stability, secondary model update rate
1 parent b98233b commit 455b3d2

4 files changed

Lines changed: 38 additions & 6 deletions

File tree

source/server/ai/zombie_core.qc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,8 @@ void(entity where) spawn_a_zombieB =
20082008
if (map_compatibility_mode == MAP_COMPAT_BETA)
20092009
szombie.head.scale = szombie.larm.scale = szombie.rarm.scale = szombie.scale = 0.73;
20102010

2011+
szombie.head.flags = szombie.larm.flags = szombie.rarm.flags = FL_MONSTER;
2012+
20112013
// set up timer for next spawn
20122014
zombie_spawn_timer = zombie_spawn_delay + time;
20132015

source/server/weapons/ballistic_knife.qc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,19 @@ void(entity victim) Blade_Damage =
3232
float damage_type = 0;
3333
float damage_region = 0;
3434

35+
entity damage_target = victim;
36+
3537
switch(victim.classname) {
3638
case "ai_zombie_head":
3739
damage_region = HEAD_X;
3840
damage_type = DMG_TYPE_HEADSHOT;
41+
damage_target = victim.owner;
3942
break;
4043
case "ai_zombie_larm":
4144
case "ai_zombie_rarm":
4245
damage_region = LIMBS_X;
4346
damage_type = DMG_TYPE_OTHER;
47+
damage_target = victim.owner;
4448
break;
4549
case "ai_zombie":
4650
if (trace_endpos_z < victim.origin_z) {
@@ -58,7 +62,7 @@ void(entity victim) Blade_Damage =
5862
break;
5963
}
6064

61-
DamageHandler(victim, self.owner, getWeaponDamage(self.weapon) * getWeaponMultiplier(self.weapon, damage_region), damage_type);
65+
DamageHandler(damage_target, self.owner, getWeaponDamage(self.weapon) * getWeaponMultiplier(self.weapon, damage_region), damage_type);
6266
self.angles_y = 180;
6367
};
6468

@@ -118,6 +122,11 @@ void() Blade_Pickup =
118122
//
119123
void() Blade_Impact =
120124
{
125+
if (other != world) {
126+
bprint(PRINT_HIGH, "classname: ");
127+
bprint(PRINT_HIGH, other.classname);
128+
bprint(PRINT_HIGH, "\n");
129+
}
121130
if (!other.solid || other.solid == SOLID_TRIGGER)
122131
if (other != world)
123132
return;
@@ -146,6 +155,8 @@ void() Blade_Impact =
146155
self.effects = EF_FULLBRIGHT;
147156
self.think = Blade_Die;
148157
self.nextthink = time + 60;
158+
159+
setorigin(self, self.origin);
149160
};
150161

151162
//

source/server/weapons/frames_core.qc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,12 @@ void () W2_Frame_Update =
5656
if (self.anim_weapon2_time > time)
5757
return; //don't call every frame, if it is the animations will play too fast
5858

59-
#ifndef FTE
60-
61-
if (self.weapon == W_KAR_SCOPE || self.weapon == W_HEADCRACKER) {
59+
// Weapons where their secondary model is an attachment (e.g. scoped kar, ballistic knife, etc.)
60+
// should update the second frame in time with the first, always.
61+
if (WepDef_WeaponSecondaryModelIsAttachment(self.weapon)) {
6262
self.weapon2frame = self.weaponframe;
6363
return;
6464
}
65-
66-
#endif // FTE
6765

6866
self.anim_weapon2_time = time + self.weapon2_animduration;
6967

source/shared/weapon_stats.qc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5095,3 +5095,24 @@ vector(float weapon) WepDef_GetLeftFlashOffset =
50955095
}
50965096
return [0, 0, 0];
50975097
}
5098+
5099+
//
5100+
// WepDef_WeaponSecondaryModelIsAttachment(weapon)
5101+
// Returns TRUE if a weapon's secondary model is
5102+
// an attachment as opposed to something else
5103+
// (akimbo).
5104+
//
5105+
float(float weapon) WepDef_WeaponSecondaryModelIsAttachment =
5106+
{
5107+
switch(weapon) {
5108+
case W_KAR_SCOPE:
5109+
case W_HEADCRACKER:
5110+
case W_BK:
5111+
case W_KRAUS:
5112+
return true;
5113+
default:
5114+
return false;
5115+
}
5116+
5117+
return false;
5118+
}

0 commit comments

Comments
 (0)