Skip to content

Commit

Permalink
E to eat food and a to activate it, no mixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fris0uman committed Oct 9, 2024
1 parent f5cd465 commit 712a716
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
11 changes: 0 additions & 11 deletions src/character.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7105,17 +7105,6 @@ bool Character::invoke_item( item *used, const std::string &method, const tripoi
return false;
}

if( actually_used->is_comestible() &&
actually_used->type->use_methods.find( "delayed_transform" ) ==
actually_used->type->use_methods.end() ) {
// Assume that when activating food that can be transformed, you're trying to transform it. Otherwise...
// Try to eat it.
add_msg_if_player( m_info, string_format( "Attempting to eat %s", actually_used->display_name() ) );
assign_activity( consume_activity_actor( item_location( *this, actually_used ) ) );
// If the character isn't eating, then invoking the item failed somewhere
return !activity.is_null();
}

std::optional<int> charges_used = actually_used->type->invoke( this, *actually_used,
pt, method );
if( !charges_used.has_value() ) {
Expand Down
21 changes: 1 addition & 20 deletions src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,16 +1069,6 @@ static bool eat( item &food, Character &you, bool force )
return false;
}

int charges_used = 0;
if( food.type->has_use() ) {
if( !food.type->can_use( "PETFOOD" ) ) {
charges_used = food.type->invoke( &you, food, you.pos() ).value_or( 0 );
if( charges_used <= 0 ) {
return false;
}
}
}

// Note: the block below assumes we decided to eat it
// No coming back from here

Expand Down Expand Up @@ -1118,16 +1108,7 @@ static bool eat( item &food, Character &you, bool force )
} else if( spoiled && saprophage ) {
you.add_msg_if_player( m_good, _( "Mmm, this %s tastes delicious…" ), food.tname() );
}
if( !you.consume_effects( food ) ) {
// Already consumed by using `food.type->invoke`?
if( charges_used > 0 ) {
if( food.count_by_charges() ) {
food.mod_charges( -charges_used );
}
return true;
}
return false;
}

if( food.count_by_charges() ) {
food.mod_charges( -1 );
}
Expand Down

0 comments on commit 712a716

Please sign in to comment.