Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Mar 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3509,10 +3509,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 @@ -3620,10 +3625,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