diff --git a/Components/SeamlessSwitcher.cs b/Components/SeamlessSwitcher.cs index f0c494c..6dfd242 100644 --- a/Components/SeamlessSwitcher.cs +++ b/Components/SeamlessSwitcher.cs @@ -37,6 +37,7 @@ using VRage.Game.Entity; using VRageRender.Effects; using VRage.Scripting; using VRage.Utils; +using SpaceEngineers.Game.World; namespace SeamlessClient.Components { @@ -64,6 +65,8 @@ namespace SeamlessClient.Components private static bool PreventRPC = false; private static bool StartPacketCheck = false; + private bool keepGrid = false; + public SeamlessSwitcher() { Instance = this; @@ -216,7 +219,7 @@ namespace SeamlessClient.Components if (ent is MyPlanet || ent is MyCubeGrid) continue; - if(ent.EntityId == _OriginalCharacterEntity && ent is MyCharacter character) + if((ent.EntityId == _OriginalCharacterEntity && keepGrid) && ent is MyCharacter character) { continue; } @@ -224,6 +227,9 @@ namespace SeamlessClient.Components ent.Close(); } + + + List grids = new List(); foreach (var gridgroup in MyCubeGridGroups.GetGridGroups(VRage.Game.ModAPI.GridLinkTypeEnum.Physical, grids)) @@ -235,17 +241,17 @@ namespace SeamlessClient.Components if (localGrids.Count == 0) continue; - if (localGrids.Any(x => x.EntityId == _OriginalGridEntity)) + if (localGrids.Any(x => x.EntityId == _OriginalGridEntity) && keepGrid) { foreach(var grid in localGrids) { MyEntity ent = grid as MyEntity; allGrids.Add((MyCubeGrid)grid); - grid.Synchronized = false; + //grid.Synchronized = false; - ent.SyncFlag = false; - ent.Save = false; + //ent.SyncFlag = false; + //ent.Save = false; @@ -411,7 +417,7 @@ namespace SeamlessClient.Components MyGuiSandbox.UnloadContent(); MyGuiSandbox.LoadContent(); - MyGuiScreenHudSpace.Static?.RecreateControls(true); + @@ -432,7 +438,11 @@ namespace SeamlessClient.Components MySandboxGame.AreClipmapsReady = false; } 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); } diff --git a/Seamless.cs b/Seamless.cs index 39333a7..a72f849 100644 --- a/Seamless.cs +++ b/Seamless.cs @@ -2,6 +2,7 @@ using NLog.Fluent; using Sandbox; using Sandbox.Game.Entities; +using Sandbox.Game.Gui; using Sandbox.Game.Localization; using Sandbox.Game.World; using Sandbox.ModAPI; @@ -180,8 +181,6 @@ namespace SeamlessClient IMyGameServer server = MyServiceManager.Instance.GetService(); MySandboxGame.PausePop(); - - }