using System.Reflection; using HarmonyLib; using Svelto.ECS; using Unity.Jobs; namespace NScript { [HarmonyPatch] class CameraPatch { public static bool AllowDefaultBehaviour = true; public static bool Prefix(in float deltaTime, ExclusiveGroup cameraGroup) { if (!AllowDefaultBehaviour) GamecraftModdingAPI.Utility.Logging.MetaLog("Doing custom camera"); return AllowDefaultBehaviour; } [HarmonyTargetMethod] static MethodBase Target() { return AccessTools.Method("Techblox.Camera.CharacterCameraMovementEngine:SimulateCameras"); } } [HarmonyPatch] class RotationPatch { public static bool Prefix(JobHandle jobHandle, ref JobHandle __result) { if (!CameraPatch.AllowDefaultBehaviour) GamecraftModdingAPI.Utility.Logging.MetaLog("Doing custom rotation"); __result = default(JobHandle); return CameraPatch.AllowDefaultBehaviour; } [HarmonyTargetMethod] static MethodBase Target() { return AccessTools.Method("Techblox.Camera.VisualCameraRotationEngine:Execute"); } } [HarmonyPatch] class VisualPatch { public static bool Prefix(JobHandle jobHandle, ref JobHandle __result) { if (!CameraPatch.AllowDefaultBehaviour) GamecraftModdingAPI.Utility.Logging.MetaLog("Doing custom visual"); __result = default(JobHandle); return CameraPatch.AllowDefaultBehaviour; } [HarmonyTargetMethod] static MethodBase Target() { return AccessTools.Method("Techblox.Camera.VisualCameraEffectsEngine:Execute"); } } }