Skip to content

Commit

Permalink
Merge pull request #48966 from Fris0uman/msc_craft
Browse files Browse the repository at this point in the history
Fix impossibility to resume craft in MSC
  • Loading branch information
ZhilkinSerg authored May 22, 2021
2 parents 9f4f731 + 31a9e96 commit 820adad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
5 changes: 0 additions & 5 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8712,11 +8712,6 @@ bool Character::invoke_item( item *used, const std::string &method, const tripoi
moves = pre_obtain_moves;
return false;
}
if( used->is_medication() && !can_use_heal_item( *used ) ) {
add_msg_if_player( m_bad, _( "Your biology is not compatible with that healing item." ) );
moves = pre_obtain_moves;
return false;
}

item *actually_used = used->get_usable_item( method );
if( actually_used == nullptr ) {
Expand Down
2 changes: 1 addition & 1 deletion src/game_inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ class comestible_inventory_preset : public inventory_selector_preset
return _( "Can't drink spilt liquids." );
}

if( med.is_medication() && !p.can_use_heal_item( med ) ) {
if( med.is_medication() && !p.can_use_heal_item( med ) && !med.is_craft() ) {
return _( "Your biology is not compatible with that item." );
}

Expand Down
13 changes: 7 additions & 6 deletions src/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2014,12 +2014,6 @@ void player::use( item_location loc, int pre_obtain_moves )
item &used = *loc;
last_item = used.typeId();

if( ( *loc ).is_medication() && !can_use_heal_item( *loc ) ) {
add_msg_if_player( m_bad, _( "Your biology is not compatible with that healing item." ) );
moves = pre_obtain_moves;
return;
}

if( used.is_tool() ) {
if( !used.type->has_use() ) {
add_msg_if_player( _( "You can't do anything interesting with your %s." ), used.tname() );
Expand All @@ -2036,6 +2030,13 @@ void player::use( item_location loc, int pre_obtain_moves )

} else if( !used.is_craft() && ( used.is_medication() || ( !used.type->has_use() &&
used.is_food() ) ) ) {

if( used.is_medication() && !can_use_heal_item( used ) ) {
add_msg_if_player( m_bad, _( "Your biology is not compatible with that healing item." ) );
moves = pre_obtain_moves;
return;
}

if( avatar *u = as_avatar() ) {
const ret_val<edible_rating> ret = u->will_eat( used, true );
if( !ret.success() ) {
Expand Down

0 comments on commit 820adad

Please sign in to comment.