Its working... but at what cost?

This commit is contained in:
Garrett
2024-10-29 14:01:58 -05:00
parent af95b422d5
commit f631d2b9ff
2 changed files with 17 additions and 8 deletions

View File

@@ -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<IMyGridGroupData> grids = new List<IMyGridGroupData>();
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);
@@ -433,6 +439,10 @@ namespace SeamlessClient.Components
}
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);
}

View File

@@ -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<IMyGameServer>();
MySandboxGame.PausePop();
}