From 2a43480f36f8cc603ca7f1388d41af7eec449cec Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Wed, 14 Feb 2024 13:52:53 -0800 Subject: [PATCH] document rigidbody patches --- QSB/Utility/Deterministic/DeterministicManager.cs | 2 +- ...idbodyPatches.cs => DeterministicRigidbodyPatches.cs} | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) rename QSB/Utility/Deterministic/{OWRigidbodyPatches.cs => DeterministicRigidbodyPatches.cs} (93%) diff --git a/QSB/Utility/Deterministic/DeterministicManager.cs b/QSB/Utility/Deterministic/DeterministicManager.cs index d4bd4b01..d5a5a15b 100644 --- a/QSB/Utility/Deterministic/DeterministicManager.cs +++ b/QSB/Utility/Deterministic/DeterministicManager.cs @@ -24,7 +24,7 @@ public static class DeterministicManager if (!_patched) { - _harmony.PatchAll(typeof(OWRigidbodyPatches)); + _harmony.PatchAll(typeof(DeterministicRigidbodyPatches)); _patched = true; } }; diff --git a/QSB/Utility/Deterministic/OWRigidbodyPatches.cs b/QSB/Utility/Deterministic/DeterministicRigidbodyPatches.cs similarity index 93% rename from QSB/Utility/Deterministic/OWRigidbodyPatches.cs rename to QSB/Utility/Deterministic/DeterministicRigidbodyPatches.cs index 3005321e..e3eaa585 100644 --- a/QSB/Utility/Deterministic/OWRigidbodyPatches.cs +++ b/QSB/Utility/Deterministic/DeterministicRigidbodyPatches.cs @@ -4,9 +4,16 @@ using UnityEngine; namespace QSB.Utility.Deterministic; +/// +/// used to capture the true path of a rigidbody before it unparents +/// [HarmonyPatch(typeof(OWRigidbody))] -public static class OWRigidbodyPatches +public static class DeterministicRigidbodyPatches { + /// + /// 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. + /// private static readonly Dictionary _setParentQueue = new(); [HarmonyPrefix]