Weapons: Add weapon reload timers.

This commit is contained in:
Marco Cawthorne 2021-05-22 16:41:21 +02:00
parent 4c4be5946c
commit f9aa283592
5 changed files with 35 additions and 5 deletions

View file

@ -243,7 +243,13 @@ w_crossbow_reload(void)
}
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::crossbow_mag, player::ammo_bolt, 5);
static void w_crossbow_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::crossbow_mag, player::ammo_bolt, 5);
}
pl.think = w_crossbow_reload_done;
pl.nextthink = time + 4.5f;
Sound_Play(pl, CHAN_ITEM, "weapon_crossbow.reload");
#endif

View file

@ -256,7 +256,13 @@ w_glock_reload(void)
}
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::glock_mag, player::ammo_9mm, 18);
static void w_glock_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::glock_mag, player::ammo_9mm, 18);
}
pl.think = w_glock_reload_done;
pl.nextthink = time + 2.0f;
#endif
pl.w_attack_next = 2.0f;

View file

@ -247,7 +247,13 @@ w_mp5_reload(void)
Weapons_ViewAnimation(MP5_RELOAD);
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::mp5_mag, player::ammo_9mm, 50);
static void w_mp5_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::mp5_mag, player::ammo_9mm, 50);
}
pl.think = w_mp5_reload_done;
pl.nextthink = time + 1.5f;
#endif
pl.w_attack_next = 1.5f;

View file

@ -204,8 +204,14 @@ w_python_reload(void)
Weapons_ViewAnimation(PYTHON_RELOAD);
#ifdef SERVER
static void w_python_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::python_mag, player::ammo_357, 6);
}
pl.think = w_python_reload_done;
pl.nextthink = time + 3.25f;
Sound_Play(pl, CHAN_WEAPON, "weapon_357.reload");
Weapons_ReloadWeapon(pl, player::python_mag, player::ammo_357, 6);
#endif
pl.w_attack_next = 3.25f;

View file

@ -189,7 +189,13 @@ void w_rpg_reload(void)
/* Audio-Visual Bit */
#ifdef SERVER
Weapons_ReloadWeapon(pl, player::rpg_mag, player::ammo_rocket, 1);
static void w_rpg_reload_done(void) {
player pl = (player)self;
Weapons_ReloadWeapon(pl, player::rpg_mag, player::ammo_rocket, 1);
}
pl.think = w_rpg_reload_done;
pl.nextthink = time + 2.25f;
#endif
pl.w_attack_next = 2.25f;