Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of EmoteCameraFix v1.0.0
plugins/EmoteCameraFix/EmoteCameraFix.dll
Decompiled 2 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Saltanis.EmoteCameraFix { [BepInPlugin("saltanis.emotecamerafix", "Emote Camera Fix", "1.0.0")] [BepInDependency("FlipMods.TooManyEmotes", "2.3.17")] public sealed class EmoteCameraFixPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(StartOfRound), "SwitchCamera")] private static class CameraSwitchPatch { private static void Prefix(StartOfRound __instance, out Camera __state) { __state = __instance.activeCamera; } private static void Postfix(StartOfRound __instance, Camera __0, Camera __state) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown if ((Object)(object)__instance.activeCamera != (Object)(object)__0) { return; } Camera val = (Camera)emoteCameraField.GetValue(null); if (!Object.op_Implicit((Object)(object)val)) { return; } if ((Object)(object)__0 != (Object)(object)val) { if ((Object)(object)__state == (Object)(object)val) { ((Behaviour)val).enabled = false; } return; } PlayerControllerB localPlayerController = __instance.localPlayerController; if (!Object.op_Implicit((Object)(object)localPlayerController) || !Object.op_Implicit((Object)(object)localPlayerController.gameplayCamera) || (Object)(object)localPlayerController.gameplayCamera == (Object)(object)val) { return; } Camera gameplayCamera = localPlayerController.gameplayCamera; HDAdditionalCameraData component = ((Component)gameplayCamera).GetComponent<HDAdditionalCameraData>(); if (Object.op_Implicit((Object)(object)component)) { HDAdditionalCameraData val2 = ((Component)val).GetComponent<HDAdditionalCameraData>(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = ((Component)val).gameObject.AddComponent<HDAdditionalCameraData>(); } component.CopyTo(val2); } val.targetTexture = gameplayCamera.targetTexture; ((Behaviour)gameplayCamera).enabled = false; } } private const string Id = "saltanis.emotecamerafix"; private const string Version = "1.0.0"; private static FieldInfo emoteCameraField; private void Awake() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) Type type = AccessTools.TypeByName("TooManyEmotes.Patches.ThirdPersonEmoteController"); emoteCameraField = ((type == null) ? null : AccessTools.Field(type, "emoteCamera")); if (emoteCameraField == null || !emoteCameraField.IsStatic || emoteCameraField.FieldType != typeof(Camera)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find the TooManyEmotes camera. Camera switching was left untouched."); return; } new Harmony("saltanis.emotecamerafix").CreateClassProcessor(typeof(CameraSwitchPatch)).Patch(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"TooManyEmotes camera compatibility patch applied."); } } }