quantum-space-buddies/QSB/TeleportingPlanetsPatch.cs

28 lines
840 B
C#
Raw Normal View History

2022-12-31 20:02:53 +00:00
using HarmonyLib;
using OWML.Common;
using QSB.Patches;
using QSB.Utility;
using System;
using UnityEngine;
namespace QSB;
/// <summary>
2023-07-30 00:39:14 +00:00
/// "TEMPORARY": this is for trying to solve this stupid fucking bug (gorp)
2022-12-31 20:02:53 +00:00
/// </summary>
[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<AstroObject>(out var astroObject) && astroObject._name != AstroObject.Name.ProbeCannon)
{
2023-07-30 00:39:14 +00:00
DebugLog.ToConsole($"AHHHHHHHHH!!!!!!!!!\nPlanet {__instance.name} teleported! Please screenshot this and contact devs!\n{Environment.StackTrace}", MessageType.Fatal);
2022-12-31 20:02:53 +00:00
}
}
}