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

Fix impossibility to resume craft in MSC #48966

Merged
merged 1 commit into from
May 22, 2021
Merged
Show file tree
Hide file tree
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
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