Visibility Cache Fixer
Attempts to fix issues with visibility info caching in code which causes bugs such as not being able to target hacking objectives.
This is done automatically with an event listener that forces the visibility manager to reinitialize, by default only once when first loading into a mission which appears to work from very minimal testing and has imperceptible impact on loading or performance.
Additionally runs for every tactical save load which uses a DLC hook and should also be of similarly minimal impact.
There is also a console command Zelf_ForceUpdateVisMgr that can be used to force this visibility info update any time (tactical only). Use a command ForceUpdateActionAvailability or TTC, or just take an action with a soldier or to refresh abilities afterwards.
You can add and remove which events are used to force visibility updates. Default config only does it in PostMissionObjectivesSpawned which is a WOTC Community Highlander added event triggered during tactical start initialization.
There is a separate config option for running in the DLC hook OnLoadedSavedGameToTactical which is also added by the Highlander, enabled by default. This is a separate option because it’s not an event that an event listener would listen to.
Does not actually require the Highlander but you have to change the configured event(s) if you are not using it.
Possibly works in non-WotC base XCom 2 but not tested, obviously would also require changing the configured event.
The underlying cause of these visibility bugs is not confirmed but they are probably related to maps, including base game maps. Common map pieces this happens with are ADVENT trains with computer terminals.
Please comment if this isn’t working for you, and try some of the other events in config if one of them works better.
