detach player when killing ship

This commit is contained in:
JohnCorby 2023-01-02 21:42:33 -08:00
parent e838dc391d
commit 09c42e150a
2 changed files with 8 additions and 2 deletions

View File

@ -64,7 +64,7 @@ public class DeathPatches : QSBPatch
[HarmonyPrefix] [HarmonyPrefix]
[HarmonyPatch(typeof(DeathManager), nameof(DeathManager.FinishDeathSequence))] [HarmonyPatch(typeof(DeathManager), nameof(DeathManager.FinishDeathSequence))]
public static bool FinishDeathSequence(DeathManager __instance) public static bool DeathManager_FinishDeathSequence(DeathManager __instance)
{ {
if (!__instance._isDead) if (!__instance._isDead)
{ {
@ -200,6 +200,12 @@ public class DeathPatches : QSBPatch
} }
Locator.GetDeathManager().KillPlayer(__instance._deathType); Locator.GetDeathManager().KillPlayer(__instance._deathType);
// detach the player before vanishing the ship so we dont delete the player too
if (PlayerAttachWatcher.Current)
{
PlayerAttachWatcher.Current.DetachPlayer();
}
// original method returns here. we dont cuz we want to ship the get destroyed even if the player is inside it
} }
__instance.Vanish(shipBody, entryLocation); __instance.Vanish(shipBody, entryLocation);

View File

@ -7,7 +7,7 @@
"body": "- Disable *all* other mods. (Can heavily affect performance)\n- Make sure you are not running any other network-intensive applications." "body": "- Disable *all* other mods. (Can heavily affect performance)\n- Make sure you are not running any other network-intensive applications."
}, },
"uniqueName": "Raicuparta.QuantumSpaceBuddies", "uniqueName": "Raicuparta.QuantumSpaceBuddies",
"version": "0.24.1", "version": "0.24.2",
"owmlVersion": "2.9.0", "owmlVersion": "2.9.0",
"dependencies": [ "_nebula.MenuFramework", "JohnCorby.VanillaFix" ], "dependencies": [ "_nebula.MenuFramework", "JohnCorby.VanillaFix" ],
"pathsToPreserve": [ "debugsettings.json" ], "pathsToPreserve": [ "debugsettings.json" ],