diff --git a/data/json/furniture_and_terrain/furniture-storage.json b/data/json/furniture_and_terrain/furniture-storage.json index 3c51e5686dc6..242e6a39858a 100644 --- a/data/json/furniture_and_terrain/furniture-storage.json +++ b/data/json/furniture_and_terrain/furniture-storage.json @@ -66,6 +66,7 @@ "move_cost_mod": -1, "coverage": 40, "required_str": 14, + "examine_action": "locked_object", "flags": [ "TRANSPARENT", "CONTAINER", diff --git a/data/json/furniture_and_terrain/terrain-zlevel-transitions.json b/data/json/furniture_and_terrain/terrain-zlevel-transitions.json index 51cb6f0a4427..4798c0f6b7b1 100644 --- a/data/json/furniture_and_terrain/terrain-zlevel-transitions.json +++ b/data/json/furniture_and_terrain/terrain-zlevel-transitions.json @@ -143,6 +143,7 @@ "color": "dark_gray", "move_cost": 2, "flags": [ "TRANSPARENT" ], + "examine_action": "locked_object", "pry": { "success_message": "You lift the manhole cover.", "fail_message": "You pry, but cannot lift the manhole cover.", diff --git a/src/iexamine.cpp b/src/iexamine.cpp index f354232c6c0e..c683284c39ec 100644 --- a/src/iexamine.cpp +++ b/src/iexamine.cpp @@ -1462,13 +1462,9 @@ void iexamine::gunsafe_el( player &p, const tripoint &examp ) static safe_reference find_best_prying_tool( player &p ) { - std::vector prying_items = p.items_with( [&p]( const item & it ) { - // Don't search for worn items such as hairpins - if( p.get_item_position( &it ) >= -1 ) { - item temporary_item( it.type ); - return temporary_item.has_quality( quality_id( "PRY" ), 1 ); - } - return false; + std::vector prying_items = p.items_with( []( const item & it ) { + // we want to get worn items (eg crowbar in toolbelt), so no check on item position + return it.has_quality( quality_id( "PRY" ), 1 ); } ); // Sort by their quality level. @@ -1486,12 +1482,9 @@ static safe_reference find_best_prying_tool( player &p ) static safe_reference find_best_lock_picking_tool( player &p ) { - std::vector picklocks = p.items_with( [&p]( const item & it ) { - // Don't search for worn items such as hairpins - if( p.get_item_position( &it ) >= -1 ) { - return it.type->get_use( "picklock" ) != nullptr; - } - return false; + std::vector picklocks = p.items_with( []( const item & it ) { + // we want to get worn items (eg hairpin), so no check on item position + return it.type->get_use( "picklock" ) != nullptr; } ); // Sort by their picklock level. diff --git a/src/iuse_actor.cpp b/src/iuse_actor.cpp index f28cffb903fd..0ef55c463775 100644 --- a/src/iuse_actor.cpp +++ b/src/iuse_actor.cpp @@ -1145,7 +1145,7 @@ void pick_lock_actor::load( const JsonObject &obj ) pick_quality = obj.get_int( "pick_quality" ); } -int pick_lock_actor::use( player &p, item &it, bool, const tripoint & ) const +int pick_lock_actor::use( player &p, item &it, bool, const tripoint &t ) const { if( p.is_npc() ) { return 0; @@ -1167,7 +1167,7 @@ int pick_lock_actor::use( player &p, item &it, bool, const tripoint & ) const return is_allowed; }; - const cata::optional pnt_ = choose_adjacent_highlight( + const cata::optional pnt_ = ( t != p.pos() ) ? t : choose_adjacent_highlight( _( "Use your lockpick where?" ), _( "There is nothing to lockpick nearby." ), f, false ); if( !pnt_ ) { return 0;