Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix only one faction having access to Anomaly research in Multifaction #496

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SokyranTheDragon
Copy link
Member

In Multifaction, only one of the factions can access the Anomaly research tab. Anomaly tab is unlocked when awakening the monolith, but the Anomaly state is global (rather than per-player) which means that there should ever be 1 monolith, and awakening it progresses the Anomaly level for everyone. The issue here is that the code that unlocks Anomaly research tab runs for a single player, meaning that everyone besides the person triggering it will be locked out of it. It also won't unlock for factions unlocked after raising the Anomaly level either.

Changes:

  • Added a patch to ResearchManager.Notify_MonolithLevelChanged, and then called the method with faction repeater to ensure that unlocking research applies to all active factions
    • All that the patched method does is unlock all the research tabs locked behind a specific Anomaly level
    • However, this won't double some of the special events, like activating Gray Pall or the ending sequence
  • Added a call to ResearchManager:Notify_MonolithLevelChanged inside FactionCreator:InitNewGame to unlock Anomaly research for new factions
    • This will only apply if the Anomaly level is high enough to unlock it
  • Added code to call ResearchManager:Notify_MonolithLevelChanged inside MultiplayerWorldComp:DoBackCompat to unlock Anomaly research for factions created before the fix was introduced
    • Again, this will only apply if the Anomaly level is high enough to unlock it
    • I've picked DoBackCompat as it seemed fitting to me, but it could be moved to a different location if needed
    • As mentioned in the comments, the monolith is not spawned yet so the check isn't perfect - fixing it would require moving the code to a postfix for Building_VoidMonolith:SpawnSetup
  • Added copying of all anomaly knowledge, unlocked research projects, and tab visibility inside of HostUtil:SetupGameFromSingleplayer
    • This roughly matches with original code for normal research, where research progress and applied techprints were copied

@Zetrith if you'd like me to move the code fixing existing save files somewhere else that's not DoBackCompat, or make some other changes, just let me know.

In Multifaction, only one of the factions can access the Anomaly research tab. Anomaly tab is unlocked when awakening the monolith, but the Anomaly state is global (rather than per-player) which means that there should ever be 1 monolith, and awakening it progresses the Anomaly level for everyone. The issue here is that the code that unlocks Anomaly research tab runs for a single player, meaning that everyone besides the person triggering it will be locked out of it. It also won't unlock for factions unlocked after raising the Anomaly level either.

Changes:
- Added a patch to `ResearchManager.Notify_MonolithLevelChanged`, and then called the method with faction repeater to ensure that unlocking research applies to all active factions
  - All that the patched method does is unlock all the research tabs locked behind a specific Anomaly level
  - However, this won't double some of the special events, like activating Gray Pall or the ending sequence
- Added a call to `ResearchManager:Notify_MonolithLevelChanged` inside `FactionCreator:InitNewGame` to unlock Anomaly research for new factions
  - This will only apply if the Anomaly level is high enough to unlock it
- Added code to call `ResearchManager:Notify_MonolithLevelChanged` inside `MultiplayerWorldComp:DoBackCompat` to unlock Anomaly research for factions created before the fix was introduced
  - Again, this will only apply if the Anomaly level is high enough to unlock it
  - I've picked `DoBackCompat` as it seemed fitting to me, but it could be moved to a different location if needed
  - As mentioned in the comments, the monolith is not spawned yet so the check isn't perfect - fixing it would require moving the code to a postfix for `Building_VoidMonolith:SpawnSetup`
- Added copying of all anomaly knowledge, unlocked research projects, and tab visibility inside of `HostUtil:SetupGameFromSingleplayer`
  - This roughly matches with original code for normal research, where research progress and applied techprints were copied
@SokyranTheDragon SokyranTheDragon added 1.5 Fixes or bugs relating to 1.5 (Not Anomaly). multifaction Bugs or issues only in multifaction mode. labels Aug 20, 2024
@SokyranTheDragon SokyranTheDragon mentioned this pull request Aug 20, 2024
@SokyranTheDragon SokyranTheDragon changed the title Fix only one faction having to Anomaly research in Multifaction Fix only one faction having access to Anomaly research in Multifaction Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.5 Fixes or bugs relating to 1.5 (Not Anomaly). multifaction Bugs or issues only in multifaction mode.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant