Minor fixes. Fixed game not pausing in offline mode, and possible fix for specific mods using script data
This commit is contained in:
@@ -27,6 +27,10 @@ using Sandbox.Game;
|
|||||||
using VRage.Game.ModAPI;
|
using VRage.Game.ModAPI;
|
||||||
using VRage.Utils;
|
using VRage.Utils;
|
||||||
using SeamlessClient.ServerSwitching;
|
using SeamlessClient.ServerSwitching;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||||
|
using VRage.Scripting;
|
||||||
|
|
||||||
namespace SeamlessClient.Components
|
namespace SeamlessClient.Components
|
||||||
{
|
{
|
||||||
@@ -41,6 +45,7 @@ namespace SeamlessClient.Components
|
|||||||
private static MethodInfo GpsRegisterChat;
|
private static MethodInfo GpsRegisterChat;
|
||||||
private static MethodInfo LoadMembersFromWorld;
|
private static MethodInfo LoadMembersFromWorld;
|
||||||
private static MethodInfo InitVirtualClients;
|
private static MethodInfo InitVirtualClients;
|
||||||
|
private static MethodInfo InitDataComponents;
|
||||||
private static FieldInfo AdminSettings;
|
private static FieldInfo AdminSettings;
|
||||||
private static FieldInfo RemoteAdminSettings;
|
private static FieldInfo RemoteAdminSettings;
|
||||||
private static FieldInfo VirtualClients;
|
private static FieldInfo VirtualClients;
|
||||||
@@ -52,6 +57,8 @@ namespace SeamlessClient.Components
|
|||||||
public static ServerSwitcherComponentOLD Instance { get; private set; }
|
public static ServerSwitcherComponentOLD Instance { get; private set; }
|
||||||
private string OldArmorSkin { get; set; } = string.Empty;
|
private string OldArmorSkin { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
private static Stopwatch LoadTime = new Stopwatch();
|
||||||
|
|
||||||
public ServerSwitcherComponentOLD() { Instance = this; }
|
public ServerSwitcherComponentOLD() { Instance = this; }
|
||||||
|
|
||||||
|
|
||||||
@@ -72,8 +79,10 @@ namespace SeamlessClient.Components
|
|||||||
RemoteAdminSettings = PatchUtils.GetField(typeof(MySession), "m_remoteAdminSettings");
|
RemoteAdminSettings = PatchUtils.GetField(typeof(MySession), "m_remoteAdminSettings");
|
||||||
LoadMembersFromWorld = PatchUtils.GetMethod(typeof(MySession), "LoadMembersFromWorld");
|
LoadMembersFromWorld = PatchUtils.GetMethod(typeof(MySession), "LoadMembersFromWorld");
|
||||||
InitVirtualClients = PatchUtils.GetMethod(PatchUtils.VirtualClientsType, "Init");
|
InitVirtualClients = PatchUtils.GetMethod(PatchUtils.VirtualClientsType, "Init");
|
||||||
|
InitDataComponents = PatchUtils.GetMethod(typeof(MySession), "InitDataComponents");
|
||||||
VirtualClients = PatchUtils.GetField(typeof(MySession), "VirtualClients");
|
VirtualClients = PatchUtils.GetField(typeof(MySession), "VirtualClients");
|
||||||
|
|
||||||
|
|
||||||
patcher.Patch(onJoin, postfix: new HarmonyMethod(Get(typeof(ServerSwitcherComponentOLD), nameof(OnUserJoined))));
|
patcher.Patch(onJoin, postfix: new HarmonyMethod(Get(typeof(ServerSwitcherComponentOLD), nameof(OnUserJoined))));
|
||||||
base.Patch(patcher);
|
base.Patch(patcher);
|
||||||
}
|
}
|
||||||
@@ -87,6 +96,9 @@ namespace SeamlessClient.Components
|
|||||||
//Invoke the switch event
|
//Invoke the switch event
|
||||||
ForceClientConnection();
|
ForceClientConnection();
|
||||||
isSeamlessSwitching = false;
|
isSeamlessSwitching = false;
|
||||||
|
LoadTime.Stop();
|
||||||
|
|
||||||
|
MyAPIGateway.Utilities?.ShowMessage("Seamless", $"Loading Time: {LoadTime.Elapsed.ToString(@"s\.fff")}s");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,6 +109,8 @@ namespace SeamlessClient.Components
|
|||||||
TargetServer = _TargetServer;
|
TargetServer = _TargetServer;
|
||||||
TargetWorld = _TargetWorld;
|
TargetWorld = _TargetWorld;
|
||||||
|
|
||||||
|
|
||||||
|
LoadTime.Start();
|
||||||
MySandboxGame.Static.Invoke(delegate
|
MySandboxGame.Static.Invoke(delegate
|
||||||
{
|
{
|
||||||
//Set camera controller to fixed spectator
|
//Set camera controller to fixed spectator
|
||||||
@@ -159,6 +173,8 @@ namespace SeamlessClient.Components
|
|||||||
|
|
||||||
MyModAPIHelper.Initialize();
|
MyModAPIHelper.Initialize();
|
||||||
MySession.Static.LoadDataComponents();
|
MySession.Static.LoadDataComponents();
|
||||||
|
InitDataComponents.Invoke(MySession.Static, null);
|
||||||
|
|
||||||
|
|
||||||
//MySession.Static.LoadObjectBuildersComponents(TargetWorld.Checkpoint.SessionComponents);
|
//MySession.Static.LoadObjectBuildersComponents(TargetWorld.Checkpoint.SessionComponents);
|
||||||
MyModAPIHelper.Initialize();
|
MyModAPIHelper.Initialize();
|
||||||
@@ -188,6 +204,10 @@ namespace SeamlessClient.Components
|
|||||||
//Recreate all controls... Will fix weird gui/paint/crap
|
//Recreate all controls... Will fix weird gui/paint/crap
|
||||||
MyGuiScreenHudSpace.Static?.RecreateControls(true);
|
MyGuiScreenHudSpace.Static?.RecreateControls(true);
|
||||||
//MySession.Static.LocalHumanPlayer.BuildArmorSkin = OldArmorSkin;
|
//MySession.Static.LocalHumanPlayer.BuildArmorSkin = OldArmorSkin;
|
||||||
|
|
||||||
|
//Pop any queued pause popup messages. Dirty way
|
||||||
|
for(int i = 0; i < 10; i++)
|
||||||
|
MySandboxGame.PausePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LoadOnlinePlayers()
|
private static void LoadOnlinePlayers()
|
||||||
|
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
|
|||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
|
|
||||||
[assembly: AssemblyVersion("2.0.0.6")] //Set these both to the same
|
[assembly: AssemblyVersion("2.0.0.7")] //Set these both to the same
|
||||||
[assembly: AssemblyFileVersion("2.0.0.6")]
|
[assembly: AssemblyFileVersion("2.0.0.7")]
|
||||||
|
@@ -163,7 +163,9 @@ namespace SeamlessClient
|
|||||||
{
|
{
|
||||||
allComps.ForEach(x => x.Update());
|
allComps.ForEach(x => x.Update());
|
||||||
|
|
||||||
if (MyAPIGateway.Multiplayer == null)
|
|
||||||
|
//All this crap needs to be cleaned
|
||||||
|
if (MyAPIGateway.Multiplayer == null || MyAPIGateway.Multiplayer.MyId == MyAPIGateway.Multiplayer.ServerId)
|
||||||
{
|
{
|
||||||
isSeamlessServer = false;
|
isSeamlessServer = false;
|
||||||
return;
|
return;
|
||||||
@@ -176,11 +178,6 @@ namespace SeamlessClient
|
|||||||
|
|
||||||
Initialized = true;
|
Initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
IMyGameServer server = MyServiceManager.Instance.GetService<IMyGameServer>();
|
|
||||||
MySandboxGame.PausePop();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user