Skip to content

Commit

Permalink
fix: empty underslung gun doesnt prevent going into firing mode UI
Browse files Browse the repository at this point in the history
Without this fix having an empty underbarrel mod/gun like the grenade
launcher prevents the player from activating the firing ui via 'f'.
This is especially troublesome as most players, including myself,
only know how to change firing modes via this UI. This effectively
prevents players from switching firing mode to the main weapon.
  • Loading branch information
ekaratzas committed Mar 4, 2024
1 parent 729b2b5 commit b0ab5c7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/avatar_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,12 +675,13 @@ bool avatar_action::can_fire_weapon( avatar &you, const map &m, const item &weap

std::vector<std::string> messages;

const gun_mode &mode = weapon.gun_current_mode();
bool check_common = ranged::gunmode_checks_common( you, m, messages, mode );
bool check_weapon = ranged::gunmode_checks_weapon( you, m, messages, mode );
bool can_use_mode = check_common && check_weapon;
if( can_use_mode ) {
return true;
for( const std::pair<const gun_mode_id, gun_mode> &mode_map : weapon.gun_all_modes() ) {
const bool check_common = ranged::gunmode_checks_common( you, m, messages, mode_map.second );
const bool check_weapon = ranged::gunmode_checks_weapon( you, m, messages, mode_map.second );
const bool can_use_mode = check_common && check_weapon;
if( can_use_mode ) {
return true;
}
}

for( const std::string &message : messages ) {
Expand Down

0 comments on commit b0ab5c7

Please sign in to comment.