Skip to content

Commit

Permalink
Fix not being able to fetch tools (disassembly zone) (CleverRaven#51343)
Browse files Browse the repository at this point in the history
* fix fetch required for multi disassemlbe

* NPCs are too dumb to be able to handle liquid
  • Loading branch information
Menschheit authored and Venera3 committed Sep 21, 2021
1 parent 2528519 commit 77612a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,7 @@ static activity_reason_info can_do_activity_there( const activity_id &act, Chara
return activity_reason_info::ok( do_activity_reason::CAN_DO_FETCH );
} else if( act == ACT_MULTIPLE_DIS ) {
// Is there anything to be disassembled?
const inventory inv = you.crafting_inventory( src_loc, PICKUP_RANGE - 1 );
const inventory inv = you.crafting_inventory( src_loc, PICKUP_RANGE - 1, false );
requirement_data req;
for( item &i : here.i_at( src_loc ) ) {
// Skip items marked by other ppl.
Expand All @@ -1399,7 +1399,7 @@ static activity_reason_info can_do_activity_there( const activity_id &act, Chara
// Are the requirements fulfilled?
const recipe &r = recipe_dictionary::get_uncraft( ( i.typeId() == itype_id( "disassembly" ) ) ?
i.components.front().typeId() : i.typeId() );
const auto &req = r.disassembly_requirements();
req = r.disassembly_requirements();
if( !std::all_of( req.get_qualities().begin(),
req.get_qualities().end(), [&inv]( const std::vector<quality_requirement> &cur ) {
return cur.empty() ||
Expand Down Expand Up @@ -2648,7 +2648,6 @@ static requirement_check_result generic_multi_activity_check_requirement( Charac
// is it even worth fetching anything if there isn't enough nearby?
if( !are_requirements_nearby( tool_pickup ? loot_zone_spots : combined_spots, what_we_need, you,
act_id, tool_pickup, src_loc ) ) {

you.add_msg_player_or_npc( m_info,
_( "The required items are not available to complete this task." ),
_( "The required items are not available to complete this task." ) );
Expand Down
7 changes: 4 additions & 3 deletions src/crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2524,7 +2524,7 @@ void Character::complete_disassemble( item_location &target, const recipe &dis )
if( this->is_avatar() ) {
add_msg( m_bad, _( "You fail to recover %s." ), newit.tname() );
} else {
add_msg_if_player_sees( *this, m_bad, _( "%1s fails to recover %2s." ), this->disp_name( false,
add_msg_if_player_sees( *this, m_bad, _( "%1$s fails to recover %2$s." ), this->disp_name( false,
true ), newit.tname() );
}
continue;
Expand All @@ -2535,7 +2535,7 @@ void Character::complete_disassemble( item_location &target, const recipe &dis )
if( this->is_avatar() ) {
add_msg( m_bad, _( "You fail to recover %1$s from the %2$s." ), newit.tname(), dis_item.tname() );
} else {
add_msg_if_player_sees( *this, m_bad, _( "%1s fails to recover %2$s from the %3$s." ),
add_msg_if_player_sees( *this, m_bad, _( "%1$s fails to recover %2$s from the %3$s." ),
this->disp_name( false, true ), newit.tname(), dis_item.tname() );
}
continue;
Expand Down Expand Up @@ -2566,7 +2566,8 @@ void Character::complete_disassemble( item_location &target, const recipe &dis )
}
}

if( act_item.made_of( phase_id::LIQUID ) ) {
//NPCs are too dumb to be able to handle liquid (for now)
if( act_item.made_of( phase_id::LIQUID ) && !is_npc() ) {
liquid_handler::handle_all_liquid( act_item, PICKUP_RANGE );
} else {
drop_items.push_back( act_item );
Expand Down

0 comments on commit 77612a9

Please sign in to comment.