rwmt / Multiplayer

Zetrith's Multiplayer mod for RimWorld
MIT License
481 stars 98 forks source link

Synced all research tab buttons, fixes #290 #497

Open SokyranTheDragon opened 3 months ago

SokyranTheDragon commented 3 months ago

This should sync stop research, dev finish now, and dev apply techprints. This required a sync worker delegate for ResearchManager to work.

I've decided to include ResearchManager sync worker in the Game region, as it's a game-wide element (doesn't matter where in the world your colony is, the research will be accessible by you). I've done so since AreaManager and AutoSlaughterManager are included under the Maps region. However, @Zetrith if you'd prefer me to change it and either move it to an existing region or make a new region (Research?) - just let me know and I'll update the PR.

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).