Update for latest version of seamless
Some checks failed
Build / Compute Version (push) Successful in 5s
Build / Build Nuget package (push) Failing after 35s

Notable feature: ModAPI
This commit is contained in:
2025-05-11 16:14:22 -04:00
parent c8c0255edd
commit d84f37bea7
15 changed files with 310 additions and 113 deletions

View File

@@ -2,6 +2,7 @@
using HarmonyLib;
using NLog.Fluent;
using Sandbox;
using Sandbox.Engine.Multiplayer;
using Sandbox.Game.Localization;
using Sandbox.Game.World;
using Sandbox.ModAPI;
@@ -39,7 +40,7 @@ namespace SeamlessClient
public static bool isSeamlessServer { get; private set; } = false;
public static bool isDebug = false;
public static bool UseNewVersion = false;
public void Init(object gameInstance)
@@ -49,10 +50,15 @@ namespace SeamlessClient
GetComponents();
PatchComponents(SeamlessPatcher);
MySession.LoadingStep += SessionLoaded;
}
private void SessionLoaded(LoadingProgress progress)
{
if (progress >= LoadingProgress.PROGRESS_STEP8)
SendSeamlessVersion();
}
private void GetComponents()
{
@@ -93,16 +99,19 @@ namespace SeamlessClient
}
}
private void InitilizeComponents()
{
foreach(ComponentBase component in allComps)
foreach (ComponentBase component in allComps)
{
try
{
component.Initilized();
TryShow($"Initilized {component.GetType()}");
}catch(Exception ex)
}
catch (Exception ex)
{
TryShow(ex, $"Failed to initialize {component.GetType()}");
}
@@ -126,24 +135,18 @@ namespace SeamlessClient
isSeamlessServer = true;
switch (msg.MessageType)
{
case ClientMessageType.FirstJoin:
Seamless.TryShow("Sending First Join!");
SendSeamlessVersion();
break;
case ClientMessageType.TransferServer:
StartSwitch(msg.GetTransferData());
break;
case ClientMessageType.OnlinePlayers:
//Not implemented yet
var playerData = msg.GetOnlinePlayers();
PlayersWindowComponent.ApplyRecievedPlayers(playerData.OnlineServers, playerData.currentServerID);
break;
}
}
public static void SendSeamlessVersion()
@@ -151,13 +154,15 @@ namespace SeamlessClient
ClientMessage response = new ClientMessage(SeamlessVersion.ToString());
MyAPIGateway.Multiplayer?.SendMessageToServer(SeamlessClientNetId, MessageUtils.Serialize(response));
Seamless.TryShow("Sending Seamless request...");
}
public void Dispose()
{
}
public void Update()
{