using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using SolidCompany.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("SolidCompany")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SolidCompany")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b316263b-eb86-414e-afd1-282161c28d53")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace SolidCompany { [BepInPlugin("Fusition.SolidCompany", "Solid Company", "1.1.1.0")] public class SCModBase : BaseUnityPlugin { private const string modGUID = "Fusition.SolidCompany"; private const string modName = "Solid Company"; private const string modVersion = "1.1.1.0"; private readonly Harmony harmony = new Harmony("Fusition.SolidCompany"); private static SCModBase Instance; private readonly float scrollSpeed = 0.4f; internal ManualLogSource fusLogSource; private void Awake() { //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; fusLogSource = Logger.CreateLogSource("Fusition.SolidCompany"); string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "solidcompanyassets"); AssetBundle val = AssetBundle.LoadFromFile(text); string[] allAssetNames = val.GetAllAssetNames(); foreach (string text2 in allAssetNames) { fusLogSource.LogInfo((object)text2); } Item val2 = val.LoadAsset("Assets/Scrap/CheeseWheelItem.asset"); if ((Object)(object)val2 == (Object)null) { fusLogSource.LogError((object)"Failed to load prefab from asset bundle"); } NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, 60, (LevelTypes)(-1)); fusLogSource.LogInfo((object)"SolidCompany awoken"); MethodInfo methodInfo = AccessTools.Method(typeof(PlayerControllerB), "RaycastSpectateCameraAroundPivot", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeof(PlayerControllerB_Patch), "RaycastSpectateCameraAroundPivot_Patch", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (UnityInput.Current.mouseScrollDelta.y != 0f) { PlayerControllerB_Patch.zoomDistance = (PlayerControllerB_Patch.zoomDistance + UnityInput.Current.mouseScrollDelta.y / -120f * scrollSpeed).Clamp(1f, 15f); } if (UnityInput.Current.GetKeyDown((KeyCode)112)) { PlayerControllerB_Patch.firstPersonSpectatorToggle = !PlayerControllerB_Patch.firstPersonSpectatorToggle; } } } internal static class Util { public static T Clamp(this T val, T min, T max) where T : IComparable { if (val.CompareTo(min) < 0) { return min; } if (val.CompareTo(max) > 0) { return max; } return val; } } } namespace SolidCompany.Patches { [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerControllerB_Patch { public static float zoomDistance = 1.4f; public static bool firstPersonSpectatorToggle = false; [HarmonyPatch("Update")] [HarmonyPrefix] public static bool RaycastSpectateCameraAroundPivot_Patch(PlayerControllerB __instance, RaycastHit ___hit, int ___walkableSurfacesNoPlayersMask) { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) if (!firstPersonSpectatorToggle) { Ray val = default(Ray); ((Ray)(ref val))..ctor(__instance.spectateCameraPivot.position, -__instance.spectateCameraPivot.forward); if (Physics.Raycast(val, ref ___hit, zoomDistance, ___walkableSurfacesNoPlayersMask, (QueryTriggerInteraction)1)) { ((Component)__instance.playersManager.spectateCamera).transform.position = ((Ray)(ref val)).GetPoint(((RaycastHit)(ref ___hit)).distance - 0.25f); } else { ((Component)__instance.playersManager.spectateCamera).transform.position = ((Ray)(ref val)).GetPoint(zoomDistance - 0.1f); } ((Component)__instance.playersManager.spectateCamera).transform.LookAt(__instance.spectateCameraPivot); } else { ((Component)__instance.playersManager.spectateCamera).transform.position = __instance.spectateCameraPivot.position + new Vector3(0f, 0.0354f, 0f); } return false; } } }