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 ScandalLib v1.0.0
BepInEx/plugins/scandallib/scandal.scandallib.dll
Decompiled 17 hours agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using ScandalLib.Patches; using ScandalLib.Scripts; using ScandalLib.Utils; using Unity.Netcode; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: AssemblyCompany("scandal.scandallib")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ScandalLib")] [assembly: AssemblyTitle("scandal.scandallib")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 ScandalLib { [BepInPlugin("scandal.scandallib", "ScandalLib", "1.0.0")] public class Plugin : BaseUnityPlugin { internal static bool initialized; public static Plugin Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } public void Awake() { if (!initialized) { initialized = true; Logger = ((BaseUnityPlugin)this).Logger; Instance = this; LoadAssetBundle(); Patch(); LogInfo("scandal.scandallib v1.0.0 has loaded!"); } } internal void LoadAssetBundle() { AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "scandalsharedassets")); if ((Object)(object)val == (Object)null) { LogError("[AssetBundle] Failed to load asset bundle: sharedAssetsBundle"); } else { LogInfo("[AssetBundle] Successfully loaded asset bundle: sharedAssetsBundle"); } } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("scandal.scandallib"); } LogDebug("Patching..."); Harmony.PatchAll(); LogDebug("Finished patching!"); } internal static void Unpatch() { LogDebug("Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } LogDebug("Finished unpatching!"); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogMessage(string messageLog) { Logger.LogMessage((object)messageLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogDebug(string debugLog) { Logger.LogDebug((object)debugLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogInfo(string infoLog) { Logger.LogInfo((object)infoLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogWarning(string warningLog) { Logger.LogWarning((object)warningLog); } [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static void LogError(string errorLog) { Logger.LogError((object)errorLog); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "scandal.scandallib"; public const string PLUGIN_NAME = "ScandalLib"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace ScandalLib.Utils { internal static class References { internal static AudioMixerGroup? diageticSFXGroup; } public static class Utilities { private struct AnimationInfo { public string stateName; public float normalizedTime; } public static readonly int stopAnimationID = Animator.StringToHash("SA_stopAnimation"); public static bool disableAnimationSync = false; private static float[] storedParameters = new float[0]; private static bool[] storedBools = new bool[0]; private static int[] storedInts = new int[0]; private static AnimationInfo[] storedAnimations = new AnimationInfo[0]; public static void ResetHUDToolTips(PlayerControllerB player) { if (!((Object)(object)player == (Object)null) && !player.isPlayerDead && player.isPlayerControlled) { if ((Object)(object)player != (Object)(object)GameNetworkManager.Instance.localPlayerController) { Plugin.LogWarning("Reset HUD Tooltips was called on a non-local player"); } else if ((Object)(object)player.currentlyHeldObjectServer != (Object)null) { player.currentlyHeldObjectServer.SetControlTipsForItem(); } else { HUDManager.Instance.ClearControlTips(); } } } public static void StoreParameters(Animator playerAnimator) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected I4, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) AnimatorControllerParameter[] parameters = playerAnimator.parameters; storedParameters = new float[parameters.Length]; storedBools = new bool[parameters.Length]; storedInts = new int[parameters.Length]; storedAnimations = new AnimationInfo[playerAnimator.layerCount]; for (int i = 0; i < parameters.Length; i++) { AnimatorControllerParameter val = parameters[i]; AnimatorControllerParameterType type = val.type; AnimatorControllerParameterType val2 = type; switch (val2 - 1) { case 0: storedParameters[i] = playerAnimator.GetFloat(val.name); break; case 3: storedBools[i] = playerAnimator.GetBool(val.name); break; case 2: storedInts[i] = playerAnimator.GetInteger(val.name); break; } } for (int j = 0; j < playerAnimator.layerCount; j++) { AnimatorStateInfo currentAnimatorStateInfo = playerAnimator.GetCurrentAnimatorStateInfo(j); AnimationInfo animationInfo = new AnimationInfo { stateName = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).fullPathHash.ToString(), normalizedTime = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime }; storedAnimations[j] = animationInfo; } } public static void RestoreParameters(Animator playerAnimator) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected I4, but got Unknown AnimatorControllerParameter[] parameters = playerAnimator.parameters; for (int i = 0; i < parameters.Length; i++) { AnimatorControllerParameter val = parameters[i]; AnimatorControllerParameterType type = val.type; AnimatorControllerParameterType val2 = type; switch (val2 - 1) { case 0: if (i < storedParameters.Length) { playerAnimator.SetFloat(val.name, storedParameters[i]); } break; case 3: if (i < storedBools.Length) { playerAnimator.SetBool(val.name, storedBools[i]); } break; case 2: if (i < storedInts.Length) { playerAnimator.SetInteger(val.name, storedInts[i]); } break; } } for (int j = 0; j < playerAnimator.layerCount; j++) { if (j < storedAnimations.Length) { AnimationInfo animationInfo = storedAnimations[j]; playerAnimator.Play(int.Parse(animationInfo.stateName), j, animationInfo.normalizedTime); } } } } } namespace ScandalLib.Scripts { public class AudioMixerFixer : MonoBehaviour { public AudioSource[] allAudios = null; public void Awake() { if ((Object)(object)References.diageticSFXGroup == (Object)null) { Plugin.LogError("Audio mixer is null"); return; } if (allAudios == null || allAudios.Length == 0) { Plugin.LogError("Audio array was either null or empty"); return; } for (int i = 0; i < allAudios.Length; i++) { if (!((Object)(object)allAudios[i] == (Object)null)) { allAudios[i].outputAudioMixerGroup = References.diageticSFXGroup; } } Plugin.LogDebug($"Corrected output mixer on {allAudios.Length} audios"); } } public class VehicleSeatAnimator : MonoBehaviour { public RuntimeAnimatorController playerVehicleAnimator = null; public PlayerControllerB seatedPlayer = null; public InteractTrigger seatTrigger = null; private Coroutine specialInteractCoroutine = null; private RuntimeAnimatorController cachedPlayerAnimatorController = null; private Animator seatedPlayerAnimator = null; public void SetLocalPlayerIntoSeat() { if (specialInteractCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(specialInteractCoroutine); specialInteractCoroutine = null; } specialInteractCoroutine = ((MonoBehaviour)this).StartCoroutine(SpecialInteractAnimation(seatTrigger, GameNetworkManager.Instance.localPlayerController)); } public IEnumerator SpecialInteractAnimation(InteractTrigger seatTrigger, PlayerControllerB playerController) { if ((Object)(object)seatTrigger == (Object)null) { Plugin.LogError("No seat found for trigger " + ((Object)((Component)this).gameObject).name); InteractTriggerPatches.interactedLastFrame = false; specialInteractCoroutine = null; yield break; } if ((Object)(object)playerController == (Object)null) { Plugin.LogError("No player argument was passed for trigger " + ((Object)((Component)this).gameObject).name); InteractTriggerPatches.interactedLastFrame = false; specialInteractCoroutine = null; yield break; } playerController.updatePlayerAnimationsInterval = 0f; Utilities.disableAnimationSync = true; seatedPlayer = playerController; SetPlayerAnimations(playerController, isLocalPlayer: true); seatTrigger.UpdateUsedByPlayerServerRpc((int)playerController.playerClientId); seatTrigger.isPlayingSpecialAnimation = true; seatTrigger.lockedPlayer = playerController.thisPlayerBody; seatTrigger.playerScriptInSpecialAnimation = playerController; if (seatTrigger.clampLooking) { seatTrigger.playerScriptInSpecialAnimation.minVerticalClamp = seatTrigger.minVerticalClamp; seatTrigger.playerScriptInSpecialAnimation.maxVerticalClamp = seatTrigger.maxVerticalClamp; seatTrigger.playerScriptInSpecialAnimation.horizontalClamp = seatTrigger.horizontalClamp; seatTrigger.playerScriptInSpecialAnimation.clampLooking = true; } seatTrigger.playerScriptInSpecialAnimation.overridePhysicsParent = seatTrigger.overridePlayerParent; seatTrigger.playerScriptInSpecialAnimation.inVehicleAnimation = true; if (seatTrigger.hidePlayerItem && (Object)(object)seatTrigger.playerScriptInSpecialAnimation.currentlyHeldObjectServer != (Object)null) { seatTrigger.playerScriptInSpecialAnimation.currentlyHeldObjectServer.EnableItemMeshes(false); } playerController.UpdateSpecialAnimationValue(true, (short)seatTrigger.playerPositionNode.eulerAngles.y, 0f, false); playerController.inSpecialInteractAnimation = true; playerController.currentTriggerInAnimationWith = seatTrigger; playerController.playerBodyAnimator.ResetTrigger(Utilities.stopAnimationID); playerController.playerBodyAnimator.ResetTrigger(seatTrigger.animationString); playerController.playerBodyAnimator.SetTrigger(seatTrigger.animationString); HUDManager.Instance.ClearControlTips(); if (!seatTrigger.stopAnimationManually) { yield return (object)new WaitForSeconds(seatTrigger.animationWaitTime); seatTrigger.StopSpecialAnimation(); } InteractTriggerPatches.interactedLastFrame = false; specialInteractCoroutine = null; } public void SetPlayerAnimations(PlayerControllerB playerController, bool isLocalPlayer) { if (!((Object)(object)playerController == (Object)null) && !playerController.isPlayerDead && playerController.isPlayerControlled) { if (isLocalPlayer) { SetPlayerSeated(setSeated: true, playerController); UncrouchPlayer(playerController); } ResetPlayerData(playerController); cachedPlayerAnimatorController = null; cachedPlayerAnimatorController = Object.Instantiate<RuntimeAnimatorController>(playerController.playerBodyAnimator.runtimeAnimatorController); seatedPlayerAnimator = playerController.playerBodyAnimator; if (isLocalPlayer) { Utilities.StoreParameters(playerController.playerBodyAnimator); } playerController.playerBodyAnimator.runtimeAnimatorController = playerVehicleAnimator; if (!isLocalPlayer) { playerController.playerBodyAnimator.ResetTrigger(Utilities.stopAnimationID); playerController.playerBodyAnimator.ResetTrigger(seatTrigger.animationString); playerController.playerBodyAnimator.SetTrigger(seatTrigger.animationString); } } } public void ReturnPlayerAnimations(PlayerControllerB playerController, bool isLocalPlayer) { if ((Object)(object)playerController == (Object)null) { return; } if ((Object)(object)cachedPlayerAnimatorController != (Object)null) { playerController.playerBodyAnimator.runtimeAnimatorController = cachedPlayerAnimatorController; if (isLocalPlayer) { Utilities.RestoreParameters(playerController.playerBodyAnimator); } } else if (isLocalPlayer) { playerController.playerBodyAnimator.runtimeAnimatorController = StartOfRound.Instance.localClientAnimatorController; } else { playerController.playerBodyAnimator.runtimeAnimatorController = StartOfRound.Instance.otherClientsAnimatorController; } if (isLocalPlayer) { playerController.playerBodyAnimator.ResetTrigger(Utilities.stopAnimationID); SetPlayerSeated(setSeated: false, playerController); UncrouchPlayer(playerController); } ResetPlayerData(playerController); cachedPlayerAnimatorController = null; seatedPlayerAnimator = null; } public void OnStopInteract(PlayerControllerB playerController) { ReturnPlayerAnimations(playerController, isLocalPlayer: true); playerController.updatePlayerAnimationsInterval = 0f; Utilities.disableAnimationSync = false; seatedPlayer = null; } public virtual void OnPlayerLeaveGame() { } public void Update() { if (!((Object)(object)((NetworkBehaviour)seatTrigger).NetworkManager == (Object)null) && ((NetworkBehaviour)seatTrigger).NetworkManager.IsListening && !((Object)(object)seatTrigger.playerScriptInSpecialAnimation == (Object)null) && !seatTrigger.playerScriptInSpecialAnimation.isPlayerControlled && seatTrigger.playerScriptInSpecialAnimation.disconnectedMidGame) { PlayerControllerB playerScriptInSpecialAnimation = seatTrigger.playerScriptInSpecialAnimation; if (!((Object)(object)playerScriptInSpecialAnimation == (Object)null)) { seatTrigger.StopUsingClientRpc((int)seatTrigger.playerScriptInSpecialAnimation.playerClientId); OnPlayerLeaveGame(); } } } public void UncrouchPlayer(PlayerControllerB player) { player.isCrouching = false; player.playerBodyAnimator.SetBool("crouching", false); } public virtual void ResetPlayerData(PlayerControllerB player) { } public virtual void SetPlayerSeated(bool setSeated, PlayerControllerB localPlayer) { } } } namespace ScandalLib.Patches { [HarmonyPatch(typeof(InteractTrigger))] public static class InteractTriggerPatches { public static bool interactedLastFrame; [HarmonyPatch("Interact")] [HarmonyPrefix] private static bool InteractTrigger_Pre_Interact(InteractTrigger __instance, Transform playerTransform, bool __runOriginal) { if (!__runOriginal) { return false; } PlayerControllerB val = default(PlayerControllerB); if (!((Component)playerTransform).TryGetComponent<PlayerControllerB>(ref val)) { return true; } PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if ((Object)(object)localPlayerController == (Object)null || (Object)(object)val != (Object)(object)localPlayerController || localPlayerController.isPlayerDead) { return true; } VehicleSeatAnimator vehicleSeatAnimator = default(VehicleSeatAnimator); if (!((Component)__instance).gameObject.TryGetComponent<VehicleSeatAnimator>(ref vehicleSeatAnimator)) { return true; } if ((Object)(object)__instance.lockedPlayer != (Object)null) { CancelVehicleSeatInteraction(); return false; } if (interactedLastFrame) { return false; } interactedLastFrame = true; if (__instance.interactCooldown) { if (__instance.currentCooldownValue >= 0f) { CancelVehicleSeatInteraction(); return false; } __instance.currentCooldownValue = __instance.cooldownTime; } localPlayerController.ResetFallGravity(); ((UnityEvent<PlayerControllerB>)(object)__instance.onInteractEarly).Invoke((PlayerControllerB)null); return false; } [HarmonyPatch("StopSpecialAnimation")] [HarmonyPostfix] private static void InteractTrigger_Post_StopSpecialAnimation(InteractTrigger __instance) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; VehicleSeatAnimator vehicleSeatAnimator = default(VehicleSeatAnimator); if (!((Object)(object)localPlayerController == (Object)null) && ((Component)__instance).gameObject.TryGetComponent<VehicleSeatAnimator>(ref vehicleSeatAnimator) && !((Object)(object)vehicleSeatAnimator.seatedPlayer == (Object)null) && !((Object)(object)vehicleSeatAnimator.seatedPlayer != (Object)(object)localPlayerController)) { vehicleSeatAnimator.OnStopInteract(localPlayerController); interactedLastFrame = false; } } public static void CancelVehicleSeatInteraction() { interactedLastFrame = false; } } [HarmonyPatch(typeof(PlayerControllerB))] public static class PlayerControllerBPatches { [HarmonyPatch("UpdatePlayerAnimationsToOtherClients")] [HarmonyPrefix] private static bool PlayerControllerB_Pre_UpdatePlayerAnimationsToOtherClients(PlayerControllerB __instance, Vector2 moveInputVector) { return (Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController || !Utilities.disableAnimationSync; } } [HarmonyPatch(typeof(SoundManager))] public static class SoundManagerPatches { [HarmonyPatch("Start")] [HarmonyPrefix] private static void SoundManager_Pre_Start(SoundManager __instance) { if ((Object)(object)References.diageticSFXGroup == (Object)null) { AudioMixerGroup diageticSFXGroup = __instance.diageticMixer.FindMatchingGroups("Master/SFX")[0]; References.diageticSFXGroup = diageticSFXGroup; } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }