Skip to content

Commit

Permalink
feat: apply NUTRIENT_OVERRIDE for recipes (#3132)
Browse files Browse the repository at this point in the history
  • Loading branch information
scarf005 authored Sep 12, 2023
1 parent ff0f3b8 commit 24a08bf
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,6 +1027,7 @@ void complete_craft( player &p, item &craft, const bench_location & )
const int batch_size = craft.charges;
std::list<item> &used = craft.components;
const double relative_rot = craft.get_relative_rot();
const bool ignore_component = making.has_flag( flag_NUTRIENT_OVERRIDE );

// Set up the new item, and assign an inventory letter if available
std::vector<item> newits = making.create_results( batch_size );
Expand Down Expand Up @@ -1079,10 +1080,15 @@ void complete_craft( player &p, item &craft, const bench_location & )
food_contained.unset_flag( flag );
}

// Don't store components for things made by charges,
// Don't store components for things that can't be uncrafted.
if( recipe_dictionary::get_uncraft( making.result() ) && !food_contained.count_by_charges() &&
making.is_reversible() ) {
// Don't store components for things that ignores components (e.g wow 'conjured bread')
if( ignore_component ) {
food_contained.set_flag( flag_NUTRIENT_OVERRIDE );
} else if( recipe_dictionary::get_uncraft( making.result() ) &&
!food_contained.count_by_charges() &&
making.is_reversible() ) {
// Don't store components for things made by charges,
// Don't store components for things that can't be uncrafted.

// Setting this for items counted by charges gives only problems:
// those items are automatically merged everywhere (map/vehicle/inventory),
// which would either lose this information or merge it somehow.
Expand Down

0 comments on commit 24a08bf

Please sign in to comment.