From 62317aa1e69cb6c679fd521a78e60c0321a4d69c Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sat, 22 May 2021 20:36:25 +0200 Subject: [PATCH] Reload timers for the WEAPON_EAGLE and WEAPON_SNIPERRIFLE weapon --- src/shared/w_eagle.qc | 8 +++++++- src/shared/w_sniperrifle.qc | 11 ++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/shared/w_eagle.qc b/src/shared/w_eagle.qc index 1a0d00d..05a122a 100644 --- a/src/shared/w_eagle.qc +++ b/src/shared/w_eagle.qc @@ -236,7 +236,13 @@ w_eagle_reload(void) /* Audio-Visual bit */ #ifdef SERVER - Weapons_ReloadWeapon(pl, player::eagle_mag, player::ammo_357, 7); + static void w_eagle_reload_done(void) { + player pl = (player)self; + Weapons_ReloadWeapon(pl, player::eagle_mag, player::ammo_357, 7); + } + + pl.think = w_eagle_reload_done; + pl.nextthink = time + 1.64f; #endif pl.w_attack_next = 1.64f; diff --git a/src/shared/w_sniperrifle.qc b/src/shared/w_sniperrifle.qc index 6e2accd..d752c09 100644 --- a/src/shared/w_sniperrifle.qc +++ b/src/shared/w_sniperrifle.qc @@ -168,10 +168,15 @@ w_sniperrifle_reload(void) /* Audio-Visual bit */ /* TODO has a couple reloading states */ - Weapons_ViewAnimation(SNIPER_RELOAD1); - + Weapons_ViewAnimation(SNIPER_RELOAD3); #ifdef SERVER - Weapons_ReloadWeapon(pl, player::sniper_mag, player::ammo_762, 5); + static void w_sniperrifle_reload_done(void) { + player pl = (player)self; + Weapons_ReloadWeapon(pl, player::sniper_mag, player::ammo_762, 5); + } + + pl.think = w_sniperrifle_reload_done; + pl.nextthink = time + 2.3f; #endif pl.w_attack_next = 2.3f; pl.w_idle_next = 10.0f;