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

Pause state setter for plugin API #22090

Merged
merged 3 commits into from
Jun 25, 2024
Merged

Conversation

spacek531
Copy link
Contributor

It is impossible to set pause state on loading without losing 1 frame when hooked to map.changed and it is impossible to set pause state before park save when hooked to map.save. This PR fixes that by allowing plugins to set pause state directly.

Setter is disabled in networked mode because it is not network-safe to call PauseToggle without extra stuff that the game action does perfectly well.

@spacek531
Copy link
Contributor Author

You can try this feature out with this plugin: https://github.com/spacek531/ParkPauser/blob/master/src/ParkPauser.js

@spacek531 spacek531 force-pushed the api/pause branch 2 times, most recently from 9bff9d2 to 31fff18 Compare May 26, 2024 02:43
@spacek531 spacek531 force-pushed the api/pause branch 2 times, most recently from 8880c9c to 2265d75 Compare May 30, 2024 21:38
@Basssiiie Basssiiie self-requested a review May 31, 2024 07:32
@Sadret
Copy link
Contributor

Sadret commented May 31, 2024

I'm not sure if we should introduce even more unsafe game state manipulations like this one, but it does not look too problematic.
I think your use case is niche but valid.

Copy link
Member

@Basssiiie Basssiiie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay but I have tested it and it all looks good to me! 😄

@spacek531
Copy link
Contributor Author

Rebased

@spacek531
Copy link
Contributor Author

Are there any current blockers to merging this?

@Gymnasiast Gymnasiast merged commit 4e72d58 into OpenRCT2:develop Jun 25, 2024
22 checks passed
@Gymnasiast Gymnasiast added this to the v0.4.12 milestone Jun 25, 2024
@spacek531 spacek531 deleted the api/pause branch June 25, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants