Its working... but at what cost?
This commit is contained in:
@@ -37,6 +37,7 @@ using VRage.Game.Entity;
|
|||||||
using VRageRender.Effects;
|
using VRageRender.Effects;
|
||||||
using VRage.Scripting;
|
using VRage.Scripting;
|
||||||
using VRage.Utils;
|
using VRage.Utils;
|
||||||
|
using SpaceEngineers.Game.World;
|
||||||
|
|
||||||
namespace SeamlessClient.Components
|
namespace SeamlessClient.Components
|
||||||
{
|
{
|
||||||
@@ -64,6 +65,8 @@ namespace SeamlessClient.Components
|
|||||||
private static bool PreventRPC = false;
|
private static bool PreventRPC = false;
|
||||||
private static bool StartPacketCheck = false;
|
private static bool StartPacketCheck = false;
|
||||||
|
|
||||||
|
private bool keepGrid = false;
|
||||||
|
|
||||||
public SeamlessSwitcher()
|
public SeamlessSwitcher()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
@@ -216,7 +219,7 @@ namespace SeamlessClient.Components
|
|||||||
if (ent is MyPlanet || ent is MyCubeGrid)
|
if (ent is MyPlanet || ent is MyCubeGrid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(ent.EntityId == _OriginalCharacterEntity && ent is MyCharacter character)
|
if((ent.EntityId == _OriginalCharacterEntity && keepGrid) && ent is MyCharacter character)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -224,6 +227,9 @@ namespace SeamlessClient.Components
|
|||||||
ent.Close();
|
ent.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
List<IMyGridGroupData> grids = new List<IMyGridGroupData>();
|
List<IMyGridGroupData> grids = new List<IMyGridGroupData>();
|
||||||
|
|
||||||
foreach (var gridgroup in MyCubeGridGroups.GetGridGroups(VRage.Game.ModAPI.GridLinkTypeEnum.Physical, grids))
|
foreach (var gridgroup in MyCubeGridGroups.GetGridGroups(VRage.Game.ModAPI.GridLinkTypeEnum.Physical, grids))
|
||||||
@@ -235,17 +241,17 @@ namespace SeamlessClient.Components
|
|||||||
if (localGrids.Count == 0)
|
if (localGrids.Count == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (localGrids.Any(x => x.EntityId == _OriginalGridEntity))
|
if (localGrids.Any(x => x.EntityId == _OriginalGridEntity) && keepGrid)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach(var grid in localGrids)
|
foreach(var grid in localGrids)
|
||||||
{
|
{
|
||||||
MyEntity ent = grid as MyEntity;
|
MyEntity ent = grid as MyEntity;
|
||||||
allGrids.Add((MyCubeGrid)grid);
|
allGrids.Add((MyCubeGrid)grid);
|
||||||
grid.Synchronized = false;
|
//grid.Synchronized = false;
|
||||||
|
|
||||||
ent.SyncFlag = false;
|
//ent.SyncFlag = false;
|
||||||
ent.Save = false;
|
//ent.Save = false;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -411,7 +417,7 @@ namespace SeamlessClient.Components
|
|||||||
|
|
||||||
MyGuiSandbox.UnloadContent();
|
MyGuiSandbox.UnloadContent();
|
||||||
MyGuiSandbox.LoadContent();
|
MyGuiSandbox.LoadContent();
|
||||||
MyGuiScreenHudSpace.Static?.RecreateControls(true);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -432,7 +438,11 @@ namespace SeamlessClient.Components
|
|||||||
MySandboxGame.AreClipmapsReady = false;
|
MySandboxGame.AreClipmapsReady = false;
|
||||||
}
|
}
|
||||||
MyMultiplayer.Static.PendingReplicablesDone -= Static_PendingReplicablesDone;
|
MyMultiplayer.Static.PendingReplicablesDone -= Static_PendingReplicablesDone;
|
||||||
|
|
||||||
|
|
||||||
|
//Try find existing seat:
|
||||||
|
//bool found = (bool)typeof(MySpaceRespawnComponent).GetMethod("TryFindExistingCharacter", BindingFlags.Static | BindingFlags.NonPublic).Invoke(null, new object[] { MySession.Static.LocalHumanPlayer });
|
||||||
|
MyGuiScreenHudSpace.Static?.RecreateControls(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
using NLog.Fluent;
|
using NLog.Fluent;
|
||||||
using Sandbox;
|
using Sandbox;
|
||||||
using Sandbox.Game.Entities;
|
using Sandbox.Game.Entities;
|
||||||
|
using Sandbox.Game.Gui;
|
||||||
using Sandbox.Game.Localization;
|
using Sandbox.Game.Localization;
|
||||||
using Sandbox.Game.World;
|
using Sandbox.Game.World;
|
||||||
using Sandbox.ModAPI;
|
using Sandbox.ModAPI;
|
||||||
@@ -180,8 +181,6 @@ namespace SeamlessClient
|
|||||||
|
|
||||||
IMyGameServer server = MyServiceManager.Instance.GetService<IMyGameServer>();
|
IMyGameServer server = MyServiceManager.Instance.GetService<IMyGameServer>();
|
||||||
MySandboxGame.PausePop();
|
MySandboxGame.PausePop();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user