Skip to content

Add hooks for HKMP TimeScale changes#112

Closed
dplochcoder wants to merge 2 commits into
Extremelyd1:masterfrom
dplochcoder:pause
Closed

Add hooks for HKMP TimeScale changes#112
dplochcoder wants to merge 2 commits into
Extremelyd1:masterfrom
dplochcoder:pause

Conversation

@dplochcoder
Copy link
Copy Markdown
Contributor

Korzer420/TheHuntIsOn#10 implements an addon to HKMP which facilitates coordinated server-wide pauses and unpauses, which modify the standard Unity timescale. Since HKMP also modifies the timescale for several reasons, some coordination is required to make this functionality work cleanly without stuttering or overwriting.

This PR funnels all HKMP timescale changes through a public event which can be listened to, allowing consumers to respond to these changes promptly and completely.

Copy link
Copy Markdown
Owner

@Extremelyd1 Extremelyd1 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I have left a few comment about things I'd like to see changed. Let me know if you want to tackle this yourself, or if you want me to do it.
With Silksong released, I'm assuming there is no hurry with this.

Comment thread HKMP/Api/Client/IClientManager.cs
Comment thread HKMP/Api/Client/IClientManager.cs
Comment thread HKMP/Api/Client/IClientManager.cs
Comment thread HKMP/Game/Client/ClientManager.cs
private readonly IClientManager.SetTimeScale _onSetTimeScale;

public PauseManager(NetClient netClient) {
public PauseManager(NetClient netClient, IClientManager.SetTimeScale onSetTimeScale) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think it makes more sense to expose the event for the time scale changing in this class instead. Now we are just juggling a delegate around just to be able to call the event in the ClientManager class.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This would be a more invasive change, since PauseManager is an internal class and is not currently exposed at all through the public API. I can make this change if you prefer but I thought it was cleaner this way to stick to the existing API surface.

@Extremelyd1
Copy link
Copy Markdown
Owner

Superceded by #113

@dplochcoder dplochcoder deleted the pause branch September 17, 2025 16:29
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.

2 participants