-
-
Notifications
You must be signed in to change notification settings - Fork 128
Improve bootstrap flow: in-game TOML config, map init detection, and reliable save upload for dedicated server #809
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
base: dev
Are you sure you want to change the base?
Changes from all commits
f827b35
2001446
7c9752f
2785367
cd59333
239b63a
3a57c64
2b3711c
4040936
6c8c521
93f4155
169b348
363fb7d
e848679
3cb52c1
447d521
467c035
c4c8050
c034dd9
277dc51
4b15af8
6c5a946
316144f
c9116b9
d40c224
fa3eabd
43845c7
1517ab0
24d377f
c59c4d1
982faa5
a51fb31
da65173
b167531
178bf38
a1800d5
b01b57c
3511ebe
3867acc
89237c6
5552b60
1b0bd04
66be825
95f9906
d48dc44
f7c6e45
b6c4f65
a5ef655
2d8a2da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| using Multiplayer.Common; | ||
| using Multiplayer.Common.Networking.Packet; | ||
|
|
||
| namespace Multiplayer.Client; | ||
|
|
||
| /// <summary> | ||
| /// Client connection state used while configuring a bootstrap server. | ||
| /// The server is in ServerBootstrap and expects upload packets; the client must keep the connection alive | ||
| /// and handle bootstrap completion / disconnect packets. | ||
| /// </summary> | ||
| [PacketHandlerClass(inheritHandlers: true)] | ||
| public class ClientBootstrapState(ConnectionBase connection) : ClientBaseState(connection) | ||
| { | ||
| public new void HandleDisconnected(ServerDisconnectPacket packet) | ||
| { | ||
| // If bootstrap completed successfully, show success message before closing the window | ||
| if (packet.reason == MpDisconnectReason.BootstrapCompleted) | ||
| { | ||
| OnMainThread.Enqueue(() => Verse.Messages.Message( | ||
| "Bootstrap configuration completed. The server will now shut down; please restart it manually to start normally.", | ||
| RimWorld.MessageTypeDefOf.PositiveEvent, false)); | ||
| } | ||
|
|
||
| // Close the bootstrap configurator window now that the process is complete | ||
| OnMainThread.Enqueue(() => | ||
| { | ||
| var window = Verse.Find.WindowStack.WindowOfType<BootstrapConfiguratorWindow>(); | ||
| if (window != null) | ||
| Verse.Find.WindowStack.TryRemove(window); | ||
| }); | ||
|
|
||
|
Comment on lines
+24
to
+31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BootstrapConfiguratorWindow should instead implement IConnectionStatusListener and do whatever it needs there |
||
| // Let the base class handle the disconnect | ||
| base.HandleDisconnected(packet); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,15 +10,24 @@ | |||||||||||||
| namespace Multiplayer.Client | ||||||||||||||
| { | ||||||||||||||
|
|
||||||||||||||
| [PacketHandlerClass(inheritHandlers: false)] | ||||||||||||||
| // We want to inherit the shared typed packet handlers from ClientBaseState (keepalive, time control, disconnect). | ||||||||||||||
| // Disabling inheritance can cause missing core handlers during joining and lead to early disconnects / broken UI. | ||||||||||||||
| [PacketHandlerClass(inheritHandlers: true)] | ||||||||||||||
|
Comment on lines
+13
to
+15
|
||||||||||||||
| // We want to inherit the shared typed packet handlers from ClientBaseState (keepalive, time control, disconnect). | |
| // Disabling inheritance can cause missing core handlers during joining and lead to early disconnects / broken UI. | |
| [PacketHandlerClass(inheritHandlers: true)] | |
| // Do not inherit handlers from ClientBaseState here; inheriting all base handlers can affect | |
| // packet routing during the joining phase and potentially conflict with join-specific logic. | |
| [PacketHandlerClass(inheritHandlers: false)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of using global variables, make these instance fields
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'd be best to move this to SessionDisconnectInfo, but it currently doesn't support showing just a Verse Message, which complicates this a bit. I think the simplest way to do this is roughly: add a field
bool shouldDisplayWindow = trueto SessionDisconnectInfo, and then add a if-guard in MultiplayerSession.Disconnected to only create a DisconnectWindow ifshouldDisplayWindowis true. This way when creating a SessionDisconnectInfo (in From), you can just set shouldDisplayWindow to false and have it work with the existing machinery. This is still somewhat shoehorned in, but not as much