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 MoreCompanyFix v1.0.1
plugins/MoreCompanyFix.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using ModelReplacement.Monobehaviors; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MoreCompanyFix")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MoreCompanyFix")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("53f365a7-b2d4-49f9-9392-454ad8407614")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace MoreCompanyFix; [BepInPlugin("Citroel.MoreCompanyFix", "More Company Fix", "1.0.0.0")] public class MoreCompanyFix : BaseUnityPlugin { private const string modGUID = "Citroel.MoreCompanyFix"; private const string modName = "More Company Fix"; private const string modVersions = "1.0.0.0"; private GameObject fixerObject; private Harmony harmony; internal ManualLogSource mls; private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown mls = Logger.CreateLogSource("More Company Fix"); mls.LogInfo((object)"Initializing More Company Fix..."); harmony = new Harmony("Citroel.MoreCompanyFix"); harmony.PatchAll(); fixerObject = new GameObject("Fixer"); fixerObject.AddComponent<Fixer>(); Object.DontDestroyOnLoad((Object)(object)fixerObject); mls.LogInfo((object)"More Company Fix initialized successfully."); } private void OnDestroy() { harmony.UnpatchSelf(); if ((Object)(object)fixerObject != (Object)null) { Object.Destroy((Object)(object)fixerObject); } mls.LogInfo((object)"More Company Fix destroyed."); } } public class Fixer : NetworkBehaviour { private InputAction toggleOnAction; private InputAction toggleOffAction; public static Fixer fixerInstance; private void OnEnable() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown toggleOnAction = new InputAction((string)null, (InputActionType)0, "<Keyboard>/p", (string)null, (string)null, (string)null); toggleOffAction = new InputAction((string)null, (InputActionType)0, "<Keyboard>/o", (string)null, (string)null, (string)null); toggleOnAction.performed += ToggleOnPerformed; toggleOffAction.performed += ToggleOffPerformed; toggleOnAction.Enable(); toggleOffAction.Enable(); } private void OnDisable() { toggleOnAction.performed -= ToggleOnPerformed; toggleOffAction.performed -= ToggleOffPerformed; toggleOnAction.Disable(); toggleOffAction.Disable(); } private void ToggleOnPerformed(CallbackContext context) { GameObject localPlayer = GetLocalPlayer(); if ((Object)(object)localPlayer != (Object)null) { EnableCosmeticManager(localPlayer, enable: true); } else { Debug.LogWarning((object)"Local player not found."); } } private void ToggleOffPerformed(CallbackContext context) { GameObject localPlayer = GetLocalPlayer(); if ((Object)(object)localPlayer != (Object)null) { EnableCosmeticManager(localPlayer, enable: false); } else { Debug.LogWarning((object)"Local player not found."); } } private GameObject GetLocalPlayer() { NetworkObject[] array = Object.FindObjectsOfType<NetworkObject>(); foreach (NetworkObject val in array) { if (val.IsOwner && ((Component)val).CompareTag("Player")) { return ((Component)val).gameObject; } } return null; } private void EnableCosmeticManager(GameObject player, bool enable) { MoreCompanyCosmeticManager component = player.GetComponent<MoreCompanyCosmeticManager>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = enable; Debug.Log((object)("Cosmetic Manager has been " + (enable ? "enabled" : "disabled") + " for player " + ((Object)player).name + ".")); } else { Debug.LogWarning((object)"MoreCompanyCosmeticManager component not found on player."); } } public override void OnDestroy() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown fixerInstance = null; toggleOnAction.Disable(); toggleOffAction.Disable(); GameObject val = new GameObject("TimeStop"); val.AddComponent<Fixer>(); val.SetActive(true); Debug.LogWarning((object)"TimeStopDestroy"); } }