Skip to content

Commit

Permalink
Lockpick doors with 'e' if prying is not available (#41265)
Browse files Browse the repository at this point in the history
* Try picking if can't pry and door is pickable

For locked doors with "examine_action": "locked_object", if no prying
tool is available, check to see if the object has the PICKABLE flag, and
if so, try picking it using iexamine::locked_object_pickable.

* Include prying suggestion before trying to pick
  • Loading branch information
wapcaplet authored Jun 13, 2020
1 parent 7a0fae2 commit 349abcb
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/iexamine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ static const std::string flag_NO_PACKED( "NO_PACKED" );
static const std::string flag_NO_STERILE( "NO_STERILE" );
static const std::string flag_NUTRIENT_OVERRIDE( "NUTRIENT_OVERRIDE" );
static const std::string flag_OPENCLOSE_INSIDE( "OPENCLOSE_INSIDE" );
static const std::string flag_PICKABLE( "PICKABLE" );
static const std::string flag_PROCESSING( "PROCESSING" );
static const std::string flag_PROCESSING_RESULT( "PROCESSING_RESULT" );
static const std::string flag_SAFECRACK( "SAFECRACK" );
Expand Down Expand Up @@ -1386,8 +1387,14 @@ void iexamine::locked_object( player &p, const tripoint &examp )
} );

if( prying_items.empty() ) {
add_msg( m_info, _( "The %s is locked. If only you had something to pry it with…" ),
g->m.has_furn( examp ) ? g->m.furnname( examp ) : g->m.tername( examp ) );
if( g->m.has_flag( flag_PICKABLE, examp ) ) {
add_msg( m_info, _( "The %s is locked. You could pry it open with the right tool…" ),
g->m.has_furn( examp ) ? g->m.furnname( examp ) : g->m.tername( examp ) );
locked_object_pickable( p, examp );
} else {
add_msg( m_info, _( "The %s is locked. If only you had something to pry it with…" ),
g->m.has_furn( examp ) ? g->m.furnname( examp ) : g->m.tername( examp ) );
}
return;
}

Expand Down

0 comments on commit 349abcb

Please sign in to comment.