diff --git a/Readme.md b/Readme.md index 800f05d..f5c910b 100644 --- a/Readme.md +++ b/Readme.md @@ -78,5 +78,6 @@ Inventory.AltHudIcon for your weapons! Tag property is also nice to have. Zhs2 and Apollucas for feature suggestions. - Thanks to Accensus, Proydoha, mamaluigisbagel, Ac!d, wildweasel, Dark-Assassin, rparhkdtp, Samarai1000, Mr. Blazkowicz, lucker42, spectrefps, - Someone64, Lippeth, JMartinez9820 and generic name guy for bug reports. + Someone64, Lippeth, JMartinez9820, generic name guy and sebastianpanetta for + bug reports. - See also [credits list](credits.md). diff --git a/zscript/gearbox/event_handler.zs b/zscript/gearbox/event_handler.zs index cf9534f..e9f9def 100644 --- a/zscript/gearbox/event_handler.zs +++ b/zscript/gearbox/event_handler.zs @@ -165,6 +165,7 @@ class gb_EventHandler : EventHandler } else { + mSounds.playNope(); return false; } @@ -306,7 +307,7 @@ class gb_EventHandler : EventHandler private ui void openWeapons() { - if (gb_Player.isDead()) + if (gb_Player.isDead() || mWeaponMenu.isThereNoWeapons()) { mSounds.playNope(); return; diff --git a/zscript/gearbox/weapon_menu.zs b/zscript/gearbox/weapon_menu.zs index a53c320..324b049 100644 --- a/zscript/gearbox/weapon_menu.zs +++ b/zscript/gearbox/weapon_menu.zs @@ -190,6 +190,17 @@ class gb_WeaponMenu return oldIndex; } + bool isThereNoWeapons() const + { + bool isNothingFound = true; + uint nWeapons = mWeapons.size(); + for (uint i = 0; i < nWeapons; ++i) + { + if (isInInventory(i) && !isHidden(mWeapons[i].getClassName())) return false; + } + return isNothingFound; + } + // private: //////////////////////////////////////////////////////////////////////////////////////// private