The Flora Respawn Bug:
The Flora Respawn Bug is caused by harvested flora using the "empty state changed" flag to indicate being harvested. When they reset normally due to cell respawning, the empty state remains flagged as changed, so when the game is saved and loaded, they will load as harvested, regardless if they had been reset when the game was saved.
The First Fix - Flora Respawn Fix:
The first mod to address this issue was Flora Respawn Fix by bluedanieru. This mod attaches a script to plants that registers them for an update event when harvested, and when the update is received deletes the original plant and replaces it with a copy in pristine unharvested state.
As straightforward as it seems, there are a couple major drawbacks to this method. Besides deleting the original plants, which causes issues with uninstallation, objects registered for an event remain in memory for as long as they stay registered (In this case 10 game days for default respawn settings.) This can cause crashes if you're already pushing Skyrim's memory limit.
The Second Fix - Wiseman303's Flora Fixes v1.x:
The first iteration of Flora Fixes used a different approach. It prevented the respawn bug from happening in the first place by avoiding the built-in harvest behavior entirely and instead simulating it through a script which showed the harvested state on plants by adding harvest animations to the meshes.
Though this method worked fine for new saves it had issues of it's own. Because it relied on avoiding the bug, it didn't fix flora in an existing save that had already been harvested, so an external tool had to be used to fix those saves. Relying on edited meshes to show harvested state also had severe compatibility issues with other mods.
The Third Fix - Wiseman303's Flora Fixes v2.x:
The second iteration of Flora Fixes relies on the SetHarvested function from SKSE to reset the harvested state on flora it detects are harvested but should have reset.
Originally SetHarvested did not update the visuals for the target, but as of version 1.7.2 it does. Unfortunately there is a limit to the number of meshes it will update at once. SetHarvested adds it's targets to a threadsafe queue to be updated by one of the game's internal functions, but that queue only holds 10 objects at a time.
Visuals on a mesh can be forced to reset anyway by disabling then enabling the mesh, so in most cases that's what the script in Flora Fixes v2.x does. Unfortunately objects with an enable parent (such as purchasable upgrades in player homes or objects disabled by civil war changes) can not be disabled or enabled by script.
To work around the 10 object limit for these special case objects, Flora Fixes 2.x adds a quest which implements a larger queue for flora needing reset, and feeds them to SKSE's SetHarvested function 10 at a time from that queue, pausing after each set to make sure they are processed before doing the next. This can cause a slight delay before all the flora get reset, but it does ensure all flora are visibly reset to match their internal state, and fortunately it's only the special cases that need this workaround.
Technical Details
-
Total views8.2k