Fixed online players
This commit is contained in:
@@ -106,7 +106,7 @@ namespace SeamlessClientPlugin
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static string Version = "1.2.20";
|
public static string Version = "1.2.12";
|
||||||
public static bool Debug = false;
|
public static bool Debug = false;
|
||||||
private static bool Initilized = false;
|
private static bool Initilized = false;
|
||||||
|
|
||||||
|
@@ -7,6 +7,7 @@ using Sandbox.Game.Gui;
|
|||||||
using Sandbox.Game.GUI;
|
using Sandbox.Game.GUI;
|
||||||
using Sandbox.Game.Multiplayer;
|
using Sandbox.Game.Multiplayer;
|
||||||
using Sandbox.Game.World;
|
using Sandbox.Game.World;
|
||||||
|
using Sandbox.ModAPI;
|
||||||
using SeamlessClientPlugin.Utilities;
|
using SeamlessClientPlugin.Utilities;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
@@ -98,7 +99,7 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
|||||||
RemoveOldEntities();
|
RemoveOldEntities();
|
||||||
StartEntitySync();
|
StartEntitySync();
|
||||||
|
|
||||||
|
MyModAPIHelper.Initialize();
|
||||||
// Allow the game to start proccessing incoming messages in the buffer
|
// Allow the game to start proccessing incoming messages in the buffer
|
||||||
MyMultiplayer.Static.StartProcessingClientMessages();
|
MyMultiplayer.Static.StartProcessingClientMessages();
|
||||||
}
|
}
|
||||||
@@ -107,12 +108,19 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
|||||||
private void LoadOnlinePlayers()
|
private void LoadOnlinePlayers()
|
||||||
{
|
{
|
||||||
//Get This players ID
|
//Get This players ID
|
||||||
|
|
||||||
MyPlayer.PlayerId? savingPlayerId = new MyPlayer.PlayerId(Sync.MyId);
|
MyPlayer.PlayerId? savingPlayerId = new MyPlayer.PlayerId(Sync.MyId);
|
||||||
if (!savingPlayerId.HasValue)
|
if (!savingPlayerId.HasValue)
|
||||||
{
|
{
|
||||||
SeamlessClient.TryShow("SavingPlayerID is null! Creating Default!");
|
SeamlessClient.TryShow("SavingPlayerID is null! Creating Default!");
|
||||||
savingPlayerId = new MyPlayer.PlayerId(Sync.MyId);
|
savingPlayerId = new MyPlayer.PlayerId(Sync.MyId);
|
||||||
}
|
}
|
||||||
|
SeamlessClient.TryShow("Saving PlayerID: " + savingPlayerId.ToString());
|
||||||
|
|
||||||
|
Sync.Players.LoadConnectedPlayers(TargetWorld.Checkpoint, savingPlayerId);
|
||||||
|
Sync.Players.LoadControlledEntities(TargetWorld.Checkpoint.ControlledEntities, TargetWorld.Checkpoint.ControlledObject, savingPlayerId);
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
SeamlessClient.TryShow("Saving PlayerID: " + savingPlayerId.ToString());
|
SeamlessClient.TryShow("Saving PlayerID: " + savingPlayerId.ToString());
|
||||||
|
|
||||||
@@ -145,6 +153,8 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetWorldSettings()
|
private void SetWorldSettings()
|
||||||
@@ -169,7 +179,7 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
|||||||
MySession.Static.WorldBoundaries = TargetWorld.Checkpoint.WorldBoundaries;
|
MySession.Static.WorldBoundaries = TargetWorld.Checkpoint.WorldBoundaries;
|
||||||
MySession.Static.InGameTime = MyObjectBuilder_Checkpoint.DEFAULT_DATE;
|
MySession.Static.InGameTime = MyObjectBuilder_Checkpoint.DEFAULT_DATE;
|
||||||
MySession.Static.ElapsedGameTime = new TimeSpan(TargetWorld.Checkpoint.ElapsedGameTime);
|
MySession.Static.ElapsedGameTime = new TimeSpan(TargetWorld.Checkpoint.ElapsedGameTime);
|
||||||
|
MySession.Static.Settings.EnableSpectator = false;
|
||||||
|
|
||||||
|
|
||||||
MySession.Static.Password = TargetWorld.Checkpoint.Password;
|
MySession.Static.Password = TargetWorld.Checkpoint.Password;
|
||||||
@@ -248,16 +258,23 @@ namespace SeamlessClientPlugin.SeamlessTransfer
|
|||||||
|
|
||||||
private void LoadConnectedClients()
|
private void LoadConnectedClients()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
Patches.LoadMembersFromWorld.Invoke(MySession.Static, new object[] { TargetWorld, MyMultiplayer.Static });
|
||||||
|
|
||||||
|
|
||||||
//Re-Initilize Virtual clients
|
//Re-Initilize Virtual clients
|
||||||
object VirtualClientsValue = Patches.VirtualClients.GetValue(MySession.Static);
|
object VirtualClientsValue = Patches.VirtualClients.GetValue(MySession.Static);
|
||||||
Patches.InitVirtualClients.Invoke(VirtualClientsValue, null);
|
Patches.InitVirtualClients.Invoke(VirtualClientsValue, null);
|
||||||
|
|
||||||
|
/*
|
||||||
SeamlessClient.TryShow("Loading exsisting Members From World!");
|
SeamlessClient.TryShow("Loading exsisting Members From World!");
|
||||||
foreach (var Client in TargetWorld.Checkpoint.Clients)
|
foreach (var Client in TargetWorld.Checkpoint.Clients)
|
||||||
{
|
{
|
||||||
SeamlessClient.TryShow("Adding New Client: " + Client.Name);
|
SeamlessClient.TryShow("Adding New Client: " + Client.Name);
|
||||||
Sync.Clients.AddClient(Client.SteamId, Client.Name);
|
Sync.Clients.AddClient(Client.SteamId, Client.Name);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StartEntitySync()
|
private void StartEntitySync()
|
||||||
|
Reference in New Issue
Block a user