From 23b7274b82427f4e5944da4cd31d4d165bc3b249 Mon Sep 17 00:00:00 2001 From: Cavan Stone Date: Fri, 4 Oct 2024 22:41:50 -0400 Subject: [PATCH] Revert "Rewqrk how comestibles are activated" This reverts commit e0650e55d3ec5e195738e83d71ba0b02b5303578. --- src/character.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/character.cpp b/src/character.cpp index d297157a6ea46..3774dd15eeccc 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -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 charges_used = actually_used->type->invoke( this, *actually_used, pt, method ); if( !charges_used.has_value() ) { @@ -7129,6 +7118,16 @@ bool Character::invoke_item( item *used, const std::string &method, const tripoi return false; } + if( actually_used->is_comestible() ) { + const bool ret = consume_effects( *used ); + const int consumed = used->activation_consume( charges_used.value(), pt, this ); + if( consumed == 0 ) { + // Nothing was consumed from within the item. "Eat" the item itself away. + i_rem( actually_used ); + } + return ret; + } + actually_used->activation_consume( charges_used.value(), pt, this ); if( actually_used->has_flag( flag_SINGLE_USE ) || actually_used->is_bionic() ||