From b7d26db12d563c93e7da3e5924ba5d3a41a733f5 Mon Sep 17 00:00:00 2001 From: InvalidArgument3 Date: Sat, 26 Oct 2024 20:08:50 -0500 Subject: [PATCH] Revert "slipspace mvsp leak stop attempt #1" This reverts commit 94c6d66e2b5d5505ae3c0eca68e8f2b14e5dfa64. --- .../Data/Scripts/WarpDrive/WarpDrive.cs | 2 + .../Scripts/WarpDrive/WarpDriveSession.cs | 44 ------------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/Slipspace Engine/Data/Scripts/WarpDrive/WarpDrive.cs b/Slipspace Engine/Data/Scripts/WarpDrive/WarpDrive.cs index e1054c28..1046bbf2 100644 --- a/Slipspace Engine/Data/Scripts/WarpDrive/WarpDrive.cs +++ b/Slipspace Engine/Data/Scripts/WarpDrive/WarpDrive.cs @@ -66,6 +66,8 @@ public override void Init(MyObjectBuilder_EntityBase objectBuilder) if (WarpDriveSession.Instance != null) initStart = WarpDriveSession.Instance.Runtime; + MyVisualScriptLogicProvider.PlayerLeftCockpit += PlayerLeftCockpit; + if (!MyAPIGateway.Utilities.IsDedicated) Block.AppendingCustomInfo += Block_AppendingCustomInfo; diff --git a/Slipspace Engine/Data/Scripts/WarpDrive/WarpDriveSession.cs b/Slipspace Engine/Data/Scripts/WarpDrive/WarpDriveSession.cs index 83f856e9..e8a8100d 100644 --- a/Slipspace Engine/Data/Scripts/WarpDrive/WarpDriveSession.cs +++ b/Slipspace Engine/Data/Scripts/WarpDrive/WarpDriveSession.cs @@ -481,50 +481,6 @@ private bool HasValidSystem(WarpDrive drive) return drive?.System != null && drive.System.Valid; } - private void OnPlayerLeftCockpit(string entityName, long playerId, string gridName) { - // Verify that WarpDrive.Instance and other required systems are active - if (WarpDrive.Instance == null || WarpDrive.Instance.System == null) - return; - - // Try parsing the entity name to get the cockpit ID - long cockpitId; - if (long.TryParse(entityName, out cockpitId)) { - var cockpit = MyAPIGateway.Entities.GetEntityById(cockpitId) as IMyShipController; - if (cockpit == null || cockpit.CubeGrid == null) - return; - - // Check if the cockpit's grid has an active warp drive and is in warp state - var warpDrive = WarpDrive.Instance; - if (warpDrive.System.WarpState != WarpSystem.State.Active) - return; - - // Validate that the warp drive and cockpit belong to the same grid - if (warpDrive.Block?.CubeGrid.EntityId != cockpit.CubeGrid.EntityId) - return; - - // Trigger warp exit sequence - warpDrive.System.SafeTriggerON = true; - - if (MyAPIGateway.Utilities.IsDedicated || MyAPIGateway.Multiplayer.IsServer) { - warpDrive.System.currentSpeedPt = -1f; - cockpit.CubeGrid?.Physics?.ClearSpeed(); - - warpDrive.System.Dewarp(true); - warpDrive.Block.Enabled = false; - warpDrive.BlockWasON = true; - } - - warpDrive.System.SafeTriggerON = false; - } - } - - public override void LoadData() { - Instance = this; - - // Subscribe to PlayerLeftCockpit event - MyVisualScriptLogicProvider.PlayerLeftCockpit += OnPlayerLeftCockpit; - } - protected override void UnloadData() { try