From 4aef732440805b6f48ff1ffbe445fc2f469ac551 Mon Sep 17 00:00:00 2001 From: JohnCorby Date: Sat, 31 Dec 2022 12:02:53 -0800 Subject: [PATCH] add planet teleporting check back --- QSB/TeleportingPlanetsPatch.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 QSB/TeleportingPlanetsPatch.cs diff --git a/QSB/TeleportingPlanetsPatch.cs b/QSB/TeleportingPlanetsPatch.cs new file mode 100644 index 00000000..94c9e581 --- /dev/null +++ b/QSB/TeleportingPlanetsPatch.cs @@ -0,0 +1,27 @@ +using HarmonyLib; +using OWML.Common; +using QSB.Patches; +using QSB.Utility; +using System; +using UnityEngine; + +namespace QSB; + +/// +/// TEMPORARY: this is for trying to solve this stupid fucking bug (gorp) +/// +[HarmonyPatch(typeof(OWRigidbody))] +public class TeleportingPlanetsPatch : QSBPatch +{ + public override QSBPatchTypes Type => QSBPatchTypes.OnModStart; + + [HarmonyPostfix] + [HarmonyPatch(nameof(OWRigidbody.SetPosition))] + private static void SetPosition(OWRigidbody __instance, Vector3 worldPosition) + { + if (__instance.TryGetComponent(out var astroObject) && astroObject._name != AstroObject.Name.ProbeCannon) + { + DebugLog.ToAll($"AHHHHHHHHH!!!!!!!!!\n{Environment.StackTrace}", MessageType.Error); + } + } +}