Weapons: Go over all the reload functions to make sure our finalized reload call is delayed and people can't quick-switch abuse.

This commit is contained in:
Marco Cawthorne 2022-04-26 09:57:03 -07:00
parent f5a01e914e
commit a875dae71e
Signed by: eukara
GPG key ID: C196CD8BA993248A
20 changed files with 201 additions and 94 deletions

View file

@ -203,12 +203,18 @@ w_ak47_reload(player pl)
Weapons_ViewAnimation(pl, AK47_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::ak47_mag, player::ammo_762mm, 30);
#endif
pl.w_attack_next = 2.4f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::ak47_mag, player::ammo_762mm, 30);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -186,13 +186,18 @@ w_aug_reload(player pl)
return;
}
Weapons_ViewAnimation(pl, AUG_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::aug_mag, player::ammo_762mm, 30);
#endif
pl.w_attack_next = 3.3f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::aug_mag, player::ammo_762mm, 30);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -258,12 +258,18 @@ w_awp_reload(player pl)
Weapons_ViewAnimation(pl, AWP_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::awp_mag, player::ammo_338mag, 10);
#endif
pl.w_attack_next = 2.9f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::awp_mag, player::ammo_338mag, 10);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
float

View file

@ -202,12 +202,18 @@ w_deagle_reload(player pl)
}
Weapons_ViewAnimation(pl, DEAGLE_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::deagle_mag, player::ammo_50ae, 7);
#endif
pl.w_attack_next = 2.1f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::deagle_mag, player::ammo_50ae, 7);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -272,12 +272,18 @@ w_elites_reload(player pl)
Weapons_ViewAnimation(pl, ELITES_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::elites_mag, player::ammo_9mm, 30);
#endif
pl.w_attack_next = 4.6f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::elites_mag, player::ammo_9mm, 30);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -171,12 +171,18 @@ w_fiveseven_reload(player pl)
Weapons_ViewAnimation(pl, FIVESEVEN_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::fiveseven_mag, player::ammo_57mm, 20);
#endif
pl.w_attack_next = 3.1f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::fiveseven_mag, player::ammo_57mm, 20);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -180,14 +180,18 @@ w_g3sg1_reload(player pl)
return;
Weapons_ViewAnimation(pl, G3SG1_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::g3sg1_mag, player::ammo_762mm, 20);
Weapons_UpdateAmmo(pl, pl.g3sg1_mag, pl.ammo_762mm, -1);
#endif
pl.w_attack_next = 4.6f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::g3sg1_mag, player::ammo_762mm, 20);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -236,13 +236,18 @@ w_glock18_reload(player pl)
break;
}
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::glock18_mag, player::ammo_9mm, 20);
Weapons_UpdateAmmo(pl, pl.glock18_mag, pl.ammo_9mm, -1);
#endif
pl.w_attack_next = 2.1f;
pl.w_idle_next = pl.w_attack_next + 1.0f;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::glock18_mag, player::ammo_9mm, 20);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -231,12 +231,18 @@ w_m4a1_reload(player pl)
else
Weapons_ViewAnimation(pl, M4A1_RELOADUNSIL);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::m4a1_mag, player::ammo_556mm, 30);
#endif
pl.w_attack_next = 3.1f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::m4a1_mag, player::ammo_556mm, 30);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
float

View file

@ -165,13 +165,18 @@ w_mac10_reload(player pl)
Weapons_ViewAnimation(pl, MAC10_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::mac10_mag, player::ammo_45acp, 30);
Weapons_UpdateAmmo(pl, pl.mac10_mag, pl.ammo_45acp, -1);
#endif
pl.w_attack_next = 3.2f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::mac10_mag, player::ammo_45acp, 30);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -163,13 +163,18 @@ w_mp5_reload(player pl)
Weapons_ViewAnimation(pl, MP5_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::mp5_mag, player::ammo_9mm, 30);
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, -1);
#endif
pl.w_attack_next = 2.6f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::mp5_mag, player::ammo_9mm, 30);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -171,13 +171,18 @@ w_p228_reload(player pl)
Weapons_ViewAnimation(pl, P228_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::p228_mag, player::ammo_357sig, 13);
Weapons_UpdateAmmo(pl, pl.p228_mag, pl.ammo_357sig, -1);
#endif
pl.w_attack_next = 2.7f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::p228_mag, player::ammo_357sig, 13);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -163,13 +163,18 @@ w_p90_reload(player pl)
Weapons_ViewAnimation(pl, P90_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::p90_mag, player::ammo_57mm, 50);
Weapons_UpdateAmmo(pl, pl.p90_mag, pl.ammo_57mm, -1);
#endif
pl.w_attack_next = 3.3f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::p90_mag, player::ammo_57mm, 50);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -159,13 +159,18 @@ w_para_reload(player pl)
Weapons_ViewAnimation(pl, PARA_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::para_mag, player::ammo_556mmbox, 100);
Weapons_UpdateAmmo(pl, pl.para_mag, pl.ammo_556mmbox, -1);
#endif
pl.w_attack_next = 3.0f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::para_mag, player::ammo_556mmbox, 100);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -220,13 +220,18 @@ w_scout_reload(player pl)
Weapons_ViewAnimation(pl, SCOUT_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::scout_mag, player::ammo_762mm, 10);
Weapons_UpdateAmmo(pl, pl.scout_mag, pl.ammo_762mm, -1);
#endif
pl.w_attack_next = 2.0f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::scout_mag, player::ammo_762mm, 10);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
float

View file

@ -182,13 +182,18 @@ w_sg550_reload(player pl)
Weapons_ViewAnimation(pl, SG550_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::sg550_mag, player::ammo_556mm, 30);
Weapons_UpdateAmmo(pl, pl.sg550_mag, pl.ammo_556mm, -1);
#endif
pl.w_attack_next = 3.8f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::sg550_mag, player::ammo_556mm, 30);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -183,13 +183,18 @@ w_sg552_reload(player pl)
Weapons_ViewAnimation(pl, SG552_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::sg552_mag, player::ammo_556mm, 30);
Weapons_UpdateAmmo(pl, pl.sg552_mag, pl.ammo_556mm, -1);
#endif
pl.w_attack_next = 3.2f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::sg552_mag, player::ammo_556mm, 30);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -163,13 +163,18 @@ w_tmp_reload(player pl)
Weapons_ViewAnimation(pl, TMP_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::tmp_mag, player::ammo_9mm, 30);
Weapons_UpdateAmmo(pl, pl.tmp_mag, pl.ammo_9mm, -1);
#endif
pl.w_attack_next = 2.1f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::tmp_mag, player::ammo_9mm, 30);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -163,13 +163,18 @@ w_ump45_reload(player pl)
Weapons_ViewAnimation(pl, UMP45_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::ump45_mag, player::ammo_45acp, 25);
Weapons_UpdateAmmo(pl, pl.ump45_mag, pl.ammo_45acp, -1);
#endif
pl.w_attack_next = 3.5f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::ump45_mag, player::ammo_45acp, 25);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void

View file

@ -242,11 +242,18 @@ w_usp45_reload(player pl)
else
Weapons_ViewAnimation(pl, USP45_RELOADUNSIL);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::usp45_mag, player::ammo_45acp, 12);
#endif
pl.w_attack_next = 2.5f;
pl.w_idle_next = pl.w_attack_next;
#ifdef SERVER
static void w_weapon_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::usp45_mag, player::ammo_45acp, 12);
}
pl.think = w_weapon_reload_done;
pl.nextthink = time + pl.w_attack_next - 0.1f;
#endif
}
void