document rigidbody patches

This commit is contained in:
JohnCorby 2024-02-14 13:52:53 -08:00
parent 6e042665cf
commit 2a43480f36
2 changed files with 9 additions and 2 deletions

View File

@ -24,7 +24,7 @@ public static class DeterministicManager
if (!_patched) if (!_patched)
{ {
_harmony.PatchAll(typeof(OWRigidbodyPatches)); _harmony.PatchAll(typeof(DeterministicRigidbodyPatches));
_patched = true; _patched = true;
} }
}; };

View File

@ -4,9 +4,16 @@ using UnityEngine;
namespace QSB.Utility.Deterministic; namespace QSB.Utility.Deterministic;
/// <summary>
/// used to capture the true path of a rigidbody before it unparents
/// </summary>
[HarmonyPatch(typeof(OWRigidbody))] [HarmonyPatch(typeof(OWRigidbody))]
public static class OWRigidbodyPatches public static class DeterministicRigidbodyPatches
{ {
/// <summary>
/// changing the parent has to be deferred until Start to preserve the sibling index.
/// for example, anglerfish bodies all share the same parent, so unparenting one clobbers the sibling index of all the others.
/// </summary>
private static readonly Dictionary<OWRigidbody, Transform> _setParentQueue = new(); private static readonly Dictionary<OWRigidbody, Transform> _setParentQueue = new();
[HarmonyPrefix] [HarmonyPrefix]