-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Psychic ritual syncing #482
base: master
Are you sure you want to change the base?
Psychic ritual syncing #482
Conversation
I've decided to look into this over the past 2-3 days and have mostly finished it, however there's still a few things that are needed (so it's currently a draft). Things still needing work: - Modify ritual prepatches to also work with psychic rituals, so assigning roles will be synced - Add localization for `MpPsychicRitualSession` Info on psychic ritual patches I've included: - Heavily based on ritual patches (started by copy-pasting the code related to them) - I've not used "PsychicRitualData" like how it's done with "RitualData" for normal rituals, as I've decided there wasn't as much data to handle - I've synced the start call by overriding the "Start" method in ritual proxy - This can also be applied to normal rituals to remove a harmony patch - In case of normal rituals, we could also include a confirmation dialog to match vanilla behaviour - Syncing of creating session was done by patching `PsychicRitualGizmo.InitializePsychicRitual` - As opposed to normal rituals that can be started in multiple places, this is the only location those can be created from - I believe everything else should have comments, match behaviour of other session, or be self-explanatory - If explanation for anything else is needed, let me know, and I'll include it in code comments or on GitHub A slight side note about dialogs with sessions (and styling station dialog) - perhaps we should make a single harmony patch to `Widgets.ButtonTextWorker` with a generalized way to use it? As it stands right now, we basically make two patches per session (prefix and postfix). Having a more generalized way to handle it may be useful in the future.
In case someone skimmed through the contents of the main message - this is a draft because we need to modify ritual prepatches to also work with psychic rituals, so assigning roles will be synced. |
First, a psychic ritual dialog desync was fixed by seeding the RNG when it may end up being used. Second (and more importantly), the psychic rituals were synced further. I hope that everything should work now, unless I've missed something. I have to admit - syncing was done it a rather crude and simple way. I've changed the code to apply the same prepatches for both rituals and psychic rituals (which means 2 patches are applied to those methods now). This approach could be improved by changing `PrepatcherPrefix` to accept all subtypes (rather than just having an exact type match). This will reduce the amount of prepatches needed, but (without further changes) won't fully eliminate them - 2 of the patches rely on transforming the arguments, and I could not think of a clear and simple way to handle them. In any case, I've extracted the argument transformer writer and reader used there into their own methods, and I've made them generic methods that will handle both normal and psychic rituals. A final addition was adding a sync worker for `PawnPsychicRitualRoleSelectionWidget`, as it's used by the synced methods.
I've made a new commit with a few changes/additions. First, a psychic ritual dialog desync was fixed by seeding the RNG when it may end up being used. Second (and more importantly), the psychic rituals were synced further. I hope that everything should work now, unless I've missed something. I have to admit - syncing was done it a rather crude and simple way. I've changed the code to apply the same prepatches for both rituals and psychic rituals (which means 2 patches are applied to those methods now). This approach could be improved by changing In any case, I've extracted the argument transformer writer and reader into their own methods, and I've made them generic methods that will handle both normal and psychic rituals. A final addition was adding a sync worker for |
I've also decided to mark this PR as ready for review (rather than a draft), as I believe it should be mostly complete (again, ignoring some minor changes to prepatches). |
One thing I just had - should sessions for normal and psychic rituals be mutually exclusive? Thinking about it, it seems like it may be safer to do it that way, as this would avoid any issues where pawns are assigned to both a normal and psychic ritual at the same time. Thoughts? |
I've decided to look into this over the past 2-3 days and have mostly finished it, however there's still a few things that are needed (so it's currently a draft). Things still needing work:
MpPsychicRitualSession
Info on psychic ritual session, dialog, and patches I've included:
PsychicRitualGizmo.InitializePsychicRitual
A slight side note about dialogs with sessions (and styling station dialog) - perhaps we should make a single harmony patch to
Widgets.ButtonTextWorker
with a generalized way to use it? As it stands right now, we basically make two patches per session (prefix and postfix). Having a more generalized way to handle it may be useful in the future.