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

Debug finish research/apply techprint not synced #290

Open
SokyranTheDragon opened this issue Feb 10, 2022 · 1 comment
Open

Debug finish research/apply techprint not synced #290

SokyranTheDragon opened this issue Feb 10, 2022 · 1 comment
Labels
1.3 Fixes or bugs relating to 1.3 (Not Ideology). low priority Quality of life or ignorable to an extent.

Comments

@SokyranTheDragon
Copy link
Member

Both of those are called through RimWorld.MainTabWindow_Research:DrawLeftRect.

The simple solution would involve watching currentProj field inside of RimWorld.ResearchManager and syncing RimWorld.ResearchManager:FinishProject and RimWorld.ResearchManager:ApplyTechprint. However, my question would be - is it safe to do so? Are those ever called from a place where those methods would end up being synced (and cancelled if not in dev mode) when we don't want them to?

@SokyranTheDragon SokyranTheDragon added low priority Quality of life or ignorable to an extent. 1.3 Fixes or bugs relating to 1.3 (Not Ideology). labels Feb 10, 2022
@notfood
Copy link
Member

notfood commented Feb 11, 2022

ResearchTree and friends call FinishProject. A SyncField is more expensive than a SyncMethod. If possible prefer SyncMethod/SyncDelegate. In this case I think you can do with the delegates in MainTabWindow_Research. I'm not aware of anything that touches currentProj directly.

@mantis mantis mentioned this issue Jul 20, 2024
5 tasks
SokyranTheDragon added a commit to SokyranTheDragon/Multiplayer that referenced this issue Aug 21, 2024
This should sync stop research, dev finish now, and dev apply techprints. This required a sync worker delegate for `ResearchManager` to work.

I've left the current syncing for selecting research by using `MainTabWindow_Research.DoBeginResearch`, and made `ResearchManager.SetCurrentProject` debug-only. I've done this due to `ResearchManager.SetCurrentProject` being called by "Dev: Finish now" button, which would allow anyone without ability to execute debug-only methods to change their active research to any possible research, ignoring any prerequisites.

Alternative approach to this would be to drop the current sync method and make `ResearchManager.SetCurrentProject` synced normally, and then applying a Harmony patch to it which would check if the selected research is valid (and prevent it from being executed if not allowed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.3 Fixes or bugs relating to 1.3 (Not Ideology). low priority Quality of life or ignorable to an extent.
Projects
None yet
Development

No branches or pull requests

2 participants