Enhance reliability of chunk data transmission and update world seed handling on game start

This commit is contained in:
2025-12-14 23:13:43 +01:00
parent 76f1033bd2
commit 36acbb57c5
2 changed files with 11 additions and 2 deletions

View File

@@ -99,7 +99,7 @@ namespace KCM.Packets.Network
chunkSize = chunk.Length, chunkSize = chunk.Length,
saveDataIndex = sent, saveDataIndex = sent,
totalChunks = chunks.Count totalChunks = chunks.Count
}.Send(clientId); }.Send(clientId, Riptide.MessageSendMode.Reliable);
Main.helper.Log(" "); Main.helper.Log(" ");

View File

@@ -144,7 +144,6 @@ namespace KCM
{ {
Main.helper.Log("Disable all"); Main.helper.Log("Disable all");
//StartGameButton.gameObject.SetActive(false);
StartGameButton.onClick.RemoveAllListeners(); StartGameButton.onClick.RemoveAllListeners();
StartGameButton.GetComponentInChildren<TextMeshProUGUI>().text = "Ready"; StartGameButton.GetComponentInChildren<TextMeshProUGUI>().text = "Ready";
StartGameButton.onClick.AddListener(() => StartGameButton.onClick.AddListener(() =>
@@ -189,6 +188,16 @@ namespace KCM
StartGameButton.GetComponentInChildren<TextMeshProUGUI>().text = "Start"; StartGameButton.GetComponentInChildren<TextMeshProUGUI>().text = "Start";
StartGameButton.onClick.AddListener(() => StartGameButton.onClick.AddListener(() =>
{ {
if (World.inst.GetTextSeed() != WorldSeed.text)
{
World.inst.seed = World.inst.SeedFromText(WorldSeed.text);
}
new WorldSeed()
{
Seed = World.inst.seed
}.SendToAll(KCClient.client.Id);
new StartGame().SendToAll(); new StartGame().SendToAll();
if (PlacementType.value == 0 && !LobbyManager.loadingSave) if (PlacementType.value == 0 && !LobbyManager.loadingSave)