Mac Fruit Trees drop fruit of differing qualities

CandyNim

Tiller
Okay for this one I'm not entirely sure if it's a bug or not; there's code that suggests it might be, and code that suggests it might not be.

Bug: Fruit on a tree from before a tree ages to the next quality remains at the old quality even after the tree ages to the next quality.

Code Analysis: In FruitTree.shake, the game has the following section of code
C#:
Item item = this.fruit[j];
this.fruit[j] = null;
d = new Debris(item, new Vector2(tileLocation.X * 64f + 32f, (tileLocation.Y - 3f) * 64f + 32f) + offset, playerPixel)
{
    itemQuality = fruitQuality
};
This explicitly passes in the fruitQuality, which is calculated earlier with the current age of the tree. However, because the fruit is an Item, the fruit comes with a quality already attached (given by FruitTree.TryCreateFruit) and from how Debris work the quality of an Item object overwrites any manually passed in quality.

Suggested Fix: If this isn't a bug, just delete the {itemQuality = fruitQuality} passing in because it does nothing. I'm also unsure why Coal gets given quality, because while it gives a string id and thus the quality variable would be considered, the quality is always 0 when a tree is struck by lightning so it's always going to pass in 0.

If this isn't a bug, setting item.Quality.Value = fruitQuality instead would fix it. Honestly both seem fine to me I just ran into it and saw the fact that the code intentions seem split.

Version Analysis: In 1.5, the fruit aged with the tree. It looks like this changed behavior happened during the 1.6 change (2022-03-07 build made the fruitontree be Items rather than just grabbing the string id, and the 2023-01-27 build make the Item have quality).

Attached is a save file with an apple tree that currently has a normal quality fruit attached, and if you sleep you get both a normal and a silver quality fruit from the tree.
 

Attachments

FilthyGorilla

Local Legend
I've seen this behaviour before (not coal) and thought it may be intentional to ensure a player gets the full amount of a single quality fruit from a tree before maturing. While minimal, there's some slight benefit gained from leaving fruit past the trees 'maturing' date which may contradict the intended behaviour of produce being tied to the tree rather than when picked?

Hard to say without a good comparison for it in the game
 

Terdin

Farmer
The fruits that have already matured and become ready for picking don't change when the tree does, because they were already done. They weren't still in production. Which is why only fruits that mature after the tree has increased in quality gets the new quality. A feature rather than a bug, the way I see it.
 
Top