TerraFirmaCraft

TerraFirmaCraft

2M Downloads

Food combination recipes ignore traits

alcatrazEscapee opened this issue ยท 3 comments

commented

Split off from #1066 because it's a separate issue.

Description:

  • When combining food items with different traits in a crafting grid, the rule of always preserving the soonest expiry date is violated, and the result does not correctly take into account traits present on the inputs.
  • Example

The section in question which does not take into account FoodTraits:

public ItemStack getCraftingResult(InventoryCrafting inv)

I believe the current mechanic is not going to take into account traits at all. This is a bit of a delicate (mathematically) operation. The only possible result I can see, would be:

  • First, collect all traits that are present among all input items.
  • Then, copy all input items (avoid mutating the existing items in the crafting grid), and strip all traits that aren't present among all items, reducing or changing the expiration date accordingly.
    - Finally, perform the existing combination of items, now that each one should have the same traits (including the same decay modifier, which is important for choosing a minimum creation date)
commented

Or, just refuse to stack items with different traits? That's what I was expecting to occur.

commented

Yeah, that works as well and is probably easier to do and would be more intuitive.

commented