cataclysmbnteam / Cataclysm-BN

Cataclysm: Bright Nights, A fork/variant of Cataclysm:DDA by CleverRaven.
https://docs.cataclysmbn.org
Other
662 stars 260 forks source link

recipes that ignore ingredients do not stack with natural items #3166

Open RoyalFox2140 opened 12 months ago

RoyalFox2140 commented 12 months ago

Describe the bug

Ever since recipes can ignore ingredients, items made from a recipe that overrides the ingredients does not stack with items found naturally even if the ingredients are ignored. Here's an example for testing purposes. I believe that the metadata on the item must still be recognizing what it is made out of somehow, but I have no idea.

 {
    "type": "recipe",
    "result": "lead",
    "id_suffix": "FoxConjuration",
    "category": "CC_OTHER",
    "subcategory": "CSC_OTHER_OTHER",
    "skill_used": "fabrication",
    "difficulty": 0,
    "time": "1 s",
    "result_mult": 4,
    "batch_time_factors": [ 80, 2 ],
    "autolearn": true,
    "components": [ [ [ "rock", 1 ] ] ],
    "flags": ["NUTRIENT_OVERRIDE"]
  },

Steps To Reproduce

  1. ingredient override is used in the recipe, craft said item
  2. find the same item. I acquired lead from deconstructing a weight bench furniture at an LMOE.

Screenshots

image image

Versions and configuration

Additional context

Also, foods made with different ingredient spoil times even by a few hours don't stack, and I think ingredient temperature matters too. Stacking has so many problems.

chaosvolt commented 12 months ago

Weird. It logically should be doing this for comestibles if they have different calorie values, but not for non-comestible items full-stop.

scarf005 commented 12 months ago

Also, foods made with different ingredient spoil times even by a few hours don't stack, and I think ingredient temperature matters too. Stacking has so many problems.

could you make this a separate issue as well? the primary reason is that freshness comparison is too strict. could make its laxness configurable but maybe it could slow down things

https://github.com/cataclysmbnteam/Cataclysm-BN/blob/4e48081db6de0b8ec64d69fe7607bc4bb0033ac4/src/item.cpp#L933-L947

olanti-p commented 12 months ago

Items made with such recipes have the NUTRIENT_OVERRIDE flag added to them, and merging is only allowed when 2 items have same flags (merging is irreversible, so it must be careful about accidentally erasing information).

Maybe we could get rid of this flag on items entirely, only only allow it on recipes? The flag would make it so the recipe does not record components when creating the food item, and food items would calculate their nutritional value from components only if they had components, otherwise they would use the default value defined in JSON?

but not for non-comestible items full-stop.

The NUTRIENT_OVERRIDE flag should not be applicable to non-comestible recipes in the first place.