Fix companions ceasing activities when PC enter Z level #72883
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
None
Purpose of change
Fix #72792, i.e. Companion crafting aborted whe PC enters the companion's Z level.
Describe the solution
Add a call to rebuild map caches when the PC changes Z level.
Describe alternatives you've considered
Testing
Using a save suffering from the bug report issue and verify it still happens when going down the stairs and then up again.
Modify the code and verify there is no visible effect on the crafting companion (still active) after having returned to the same Z level.
Waiting and verifying that the progress of a pair of heavy survivor boots in progress craft increases from 49% to 50% after waiting.
Additional context
The changes to the tests requires some explanations:
This is presumably caused by the solution not to keep lighting information up to date on all Z levels for performance reasons, coupled with a delay in the update of the lighting conditions of the Z level the PC reaches to after the companions have evaluated their light levels for the turn. Companions are kept unaffected by the light level while the PC is on a different Z level by code that explicitly ignores it due to the performance issues involved in keeping it up to date.