SERVER: Fix last-frame reload cancelling on weapons

This commit is contained in:
MotoLegacy 2024-11-30 14:09:28 -08:00
parent 25b1e08b56
commit 6f1fecbb86
2 changed files with 14 additions and 2 deletions

View file

@ -454,6 +454,9 @@ void(float side) W_Reload =
delay = getWeaponDelay(self.weapon,RELOAD);
void(optional float t) endanimfunc = SUB_Null;
if (!reloadcancelframe)
reloadcancelframe = endframe;
if (self.weapon == W_KAR_SCOPE || self.weapon == W_HEADCRACKER ){
startframe = 14;
endframe = 18;
@ -497,6 +500,17 @@ void(float side) W_Reload =
} else {
self.reload_delay2 = delay + time;
}
// Sometimes we hit a race condition of sorts where if we have a weapon
// designed not to fill the magazine until the end of the reload,
// reload_delay is improperly zero because of server tick rate.
// Firing while this occurs causes the reload to cancel and the mag to not
// fill. So we delay when we can action again to ensure we reach the mag
// fill state. -- cypress (30 Nov 2024)
if (endframe == reloadcancelframe) {
self.reload_delay += 0.5;
self.reload_delay2 += 0.5;
}
Set_W_Frame (startframe, endframe, delay, reloadcancelframe, RELOAD, endanimfunc, modelname, false, side, false);
}

View file

@ -2394,8 +2394,6 @@ float(float wep, float frametype, optional float z) GetFrame =
return 50;
case PUT_OUT_END:
return 53;
case RELOAD_CANCEL:
return 48;
}
break;
case W_STG: