Weapons will now auto-switch to the next best available weapon when empty.

This commit is contained in:
Marco Cawthorne 2023-04-15 17:21:13 -07:00
parent 1421857601
commit 5280004b1f
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
7 changed files with 23 additions and 6 deletions

View File

@ -147,8 +147,10 @@ w_grenadelauncher_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (pl.ammo_rockets <= 0)
if (pl.ammo_rockets <= 0) {
Weapons_SwitchBest(pl, 0);
return;
}
/* fire the actual projectile (on the server) */
#ifdef SERVER

View File

@ -92,8 +92,10 @@ w_lightning_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (pl.ammo_cells <= 0)
if (pl.ammo_cells <= 0) {
Weapons_SwitchBest(pl, 0);
return;
}
pl.ammo_cells--;

View File

@ -91,8 +91,10 @@ w_nailgun_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (pl.ammo_nails <= 0)
if (pl.ammo_nails <= 0) {
Weapons_SwitchBest(pl, 0);
return;
}
pl.ammo_nails--;

View File

@ -92,8 +92,10 @@ w_rocketlauncher_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (pl.ammo_rockets <= 0)
if (pl.ammo_rockets <= 0) {
Weapons_SwitchBest(pl, 0);
return;
}
/* visual fluff */
Weapons_ViewAnimation(pl, RPG_SHOOT);

View File

@ -124,8 +124,10 @@ w_shotgun_primary(player pl)
{
if (pl.w_attack_next > 0.0)
return;
if (pl.ammo_shells <= 0)
if (pl.ammo_shells <= 0) {
Weapons_SwitchBest(pl, 0);
return;
}
#ifdef SERVER
/* Singleplayer is more accurate */

View File

@ -96,6 +96,11 @@ w_supernailgun_primary(player pl)
if (pl.w_attack_next > 0.0f)
return;
if (pl.ammo_nails < 1) {
Weapons_SwitchBest(pl, 0);
return;
}
pl.ammo_nails--;
Weapons_ViewAnimation(pl, SUPERNAIL_SHOOT);
Weapons_ViewPunchAngle(pl, [-2,0,0]);

View File

@ -138,8 +138,10 @@ w_supershotgun_primary(player pl)
if (pl.w_attack_next > 0.0)
return;
if (pl.ammo_shells < 2)
if (pl.ammo_shells < 2) {
Weapons_SwitchBest(pl, 0);
return;
}
/* actual firing */
pl.ammo_shells -= 2;