Skip to content

Commit

Permalink
[CR] Added a message notifying player about why he can't mine terrain…
Browse files Browse the repository at this point in the history
…/furniture with bash resistance above maximum mining ability for a pickaxe/jackhammer (#55346)

* Added a message notifying player about why he can't mine terrain/furniture with bash resistance above maximum mining ability for a pickaxe/jackhammer

Co-authored-by: Kevin Granade <[email protected]>
  • Loading branch information
Night-Pryanik and kevingranade authored Mar 10, 2022
1 parent 640d061 commit 6621e88
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3443,10 +3443,15 @@ cata::optional<int> iuse::jackhammer( Character *p, item *it, bool, const tripoi
}

map &here = get_map();
bool mineable_furn = here.has_flag_furn( ter_furn_flag::TFLAG_MINEABLE, pnt );
bool mineable_ter = here.has_flag_ter( ter_furn_flag::TFLAG_MINEABLE, pnt );
const bool mineable_furn = here.has_flag_furn( ter_furn_flag::TFLAG_MINEABLE, pnt );
const bool mineable_ter = here.has_flag_ter( ter_furn_flag::TFLAG_MINEABLE, pnt );
const int max_mining_ability = 70;
if( !mineable_furn && !mineable_ter ) {
p->add_msg_if_player( m_info, _( "You can't drill there." ) );
if( here.bash_resistance( pnt ) > max_mining_ability ) {
p->add_msg_if_player( m_info,
_( "The material is too hard for you to even make a dent." ) );
}
return cata::nullopt;
}
if( here.veh_at( pnt ) ) {
Expand Down Expand Up @@ -3554,10 +3559,15 @@ cata::optional<int> iuse::pickaxe( Character *p, item *it, bool, const tripoint
}

map &here = get_map();
bool mineable_furn = here.has_flag_furn( ter_furn_flag::TFLAG_MINEABLE, pnt );
bool mineable_ter = here.has_flag_ter( ter_furn_flag::TFLAG_MINEABLE, pnt );
const bool mineable_furn = here.has_flag_furn( ter_furn_flag::TFLAG_MINEABLE, pnt );
const bool mineable_ter = here.has_flag_ter( ter_furn_flag::TFLAG_MINEABLE, pnt );
const int max_mining_ability = 70;
if( !mineable_furn && !mineable_ter ) {
p->add_msg_if_player( m_info, _( "You can't mine there." ) );
if( here.bash_resistance( pnt ) > max_mining_ability ) {
p->add_msg_if_player( m_info,
_( "The material is too hard for you to even make a dent." ) );
}
return cata::nullopt;
}
if( here.veh_at( pnt ) ) {
Expand Down

0 comments on commit 6621e88

Please sign in to comment.