hack to get DetachableFragment._fragmentIntegrity to not be null after Detach

This commit is contained in:
JohnCorby 2021-11-16 12:30:26 -08:00
parent dcf8bf0510
commit d3735a5b60

View File

@ -157,6 +157,22 @@ namespace QSB.MeteorSync.Patches
}
[HarmonyPrefix]
[HarmonyPatch(typeof(DetachableFragment), nameof(DetachableFragment.Detach))]
public static void Detach_Prefix(DetachableFragment __instance, out FragmentIntegrity __state)
{
// this gets set to null in Detach, so store it here and and then restore it in postfix
__state = __instance._fragmentIntegrity;
}
[HarmonyPostfix]
[HarmonyPatch(typeof(DetachableFragment), nameof(DetachableFragment.Detach))]
public static void Detach_Postfix(DetachableFragment __instance, FragmentIntegrity __state)
{
__instance._fragmentIntegrity = __state;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(DebrisLeash), nameof(DebrisLeash.MoveByDistance))]
public static bool MoveByDistance(DebrisLeash __instance,