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 OurBuddyRusty v1.0.7
RustyMod.dll
Decompiled a month agousing System; using System.Collections.Generic; 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.Configuration; using BepInEx.Logging; using HarmonyLib; using LCSoundTool; using Microsoft.CodeAnalysis; using RustyModUtils; using TerminalApi; using UnityEngine; using UnityEngine.Video; [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: AssemblyCompany("RustyMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("I CAN FLYYYYYYYYYYYYYYYYYYYYYY")] [assembly: AssemblyFileVersion("1.0.6.0")] [assembly: AssemblyInformationalVersion("1.0.6+598c8515558647766b968d4e0eb8cecf77d82b10")] [assembly: AssemblyProduct("RustyMod")] [assembly: AssemblyTitle("RustyMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.6.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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; } } } internal static class Assets { public static AssetBundle AssetBundle { get; private set; } private static Dictionary<string, Object> AssetList { get; set; } private static string AssemblyName => Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0]; public static void PopulateAssets() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown if ((Object)AssetBundle != (Object)null) { RustyModBase.mls.LogWarning((object)"Attempted to load the asset bundle but the bundle was not null!"); return; } AssetBundle = RustyModBase.RustyBundle; if ((Object)AssetBundle == (Object)null) { RustyModBase.mls.LogError((object)("Asset bundle at " + RustyModBase.location + "\rusty failed to load!")); } AssetList = new Dictionary<string, Object>(); Object[] array = AssetBundle.LoadAllAssets(); RustyModBase.mls.LogInfo((object)"Assets from bundle: \n"); Object[] array2 = array; foreach (Object val in array2) { AssetList.Add(val.name, val); RustyModBase.mls.LogInfo((object)val.name); } } public static T GetAsset<T>(string name) where T : Object { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown if (!AssetList.TryGetValue(name, out var value)) { RustyModBase.mls.LogError((object)("Attempted to load asset of name " + name + " but no asset of that name exists!")); return default(T); } T val = (T)(object)((value is T) ? value : null); if ((Object)val == (Object)null) { RustyModBase.mls.LogError((object)("Attempted to load an asset of type " + typeof(T).Name + " but asset of name " + name + " does not match this type!")); return default(T); } return val; } } [HarmonyPatch] internal class EnemyPatches { [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] public static void CreateRustyModel(EnemyAI __instance) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (__instance is RadMechAI) { ((Component)__instance).gameObject.AddComponent<RustyController>(); } } } public class RustyController : MonoBehaviour { private List<string> baseMatNames = new List<string> { "ArmLeft", "ArmRight", "Booster", "Core", "EyeArmL", "EyeArmR" }; private Animator vanillaRadMechAnimator; private Animator rustyAnimator; private AudioSource rustyAudioSource; private int loggedMisslesFired = 0; private AudioClip audioMainSystem; private AudioClip audioAllOrNothing; private AudioClip audioBuddy; private AudioClip audioDontDie; private AudioClip audioHeyBuddy; private AudioClip audioHopeOrDispair; private AudioClip audioIWontMiss; private AudioClip audioImComing1; private AudioClip audioImComing2; private AudioClip audioKeepYouWaiting; private AudioClip audioLockOn; private AudioClip audioNoChoice; private AudioClip audioNoGraverThreat; private AudioClip audioOnlyICanFly; private AudioClip audioRubicon; private AudioClip audioStayCool; private AudioClip audioStepUpMyGame; private AudioClip audioUnderPressure; private AudioClip audioWatchOut; private AudioClip audioWhatDrivesYou; private AudioClip audioYouCanDoBetter; private AudioClip audioYouThereBuddy; private AudioClip audioYoureFast; private AudioClip audioYoureGood; private List<AudioClip> voiceLines; private int voiceCooldown = 0; private RadMechAI RadMechAI { get; set; } private GameObject BaseRustyObject { get; set; } private Material spotlightMat { get; set; } private Material defaultMat { get; set; } private GameObject SecondaryGokuObject { get; set; } private bool takingStep { get; set; } private SkinnedMeshRenderer[] skinnedMeshRenderers { get; set; } private bool IsAttacking { get; set; } private bool IsDead { get; set; } private void Start() { RadMechAI = ((Component)this).GetComponent<RadMechAI>(); UpdateScanNodeData(); try { } catch (Exception ex) { RustyModBase.mls.LogError((object)("RustyMod ARM ERROR: " + ex)); } HideRadMechModel(); CreateRustyModels(); LoadSounds(); rustyAudioSource.loop = true; rustyAudioSource.PlayOneShot(audioMainSystem); } private void Update() { try { bool flag = ((EnemyAI)RadMechAI).currentBehaviourState.name == "Fly"; if (RadMechAI.spotlight.activeSelf) { RadMechAI.spotlight.SetActive(false); } try { if (flag && !rustyAudioSource.isPlaying) { rustyAudioSource.Play(); } if (!flag && rustyAudioSource.isPlaying) { rustyAudioSource.Pause(); } if (flag) { if (voiceCooldown > 0) { voiceCooldown--; } else { int num = new Random().Next(1, RustyModBase.BoundConfig.fastVoiceCooldown.Value ? 21 : 301); if (num == 1) { int index = new Random().Next(1, voiceLines.Count); rustyAudioSource.PlayOneShot(voiceLines[index]); voiceCooldown = (RustyModBase.BoundConfig.fastVoiceCooldown.Value ? 30 : 450); } } } if (rustyAnimator.GetInteger("currentAnim") == 7 || (!RadMechAI.attemptingGrab && rustyAnimator.GetInteger("currentnim") == 3)) { rustyAnimator.SetInteger("currentAnim", 0); } if (!RadMechAI.chargingForward) { rustyAnimator.SetInteger("currentAnim", 7); } if (vanillaRadMechAnimator.GetInteger("currentAnim") < 3) { if (vanillaRadMechAnimator.GetBool("leftFootForward")) { rustyAnimator.SetInteger("currentAnim", 2); } else { rustyAnimator.SetInteger("currentAnim", 1); } } if (RadMechAI.aimingGun && RadMechAI.missilesFired != loggedMisslesFired) { rustyAnimator.SetInteger("currentAnim", 5); } if (RadMechAI.chargingForward) { rustyAnimator.SetInteger("currentAnim", 6); } if (RadMechAI.attemptingGrab) { rustyAnimator.SetInteger("currentAnim", 3); } } catch (Exception ex) { RustyModBase.mls.LogError((object)("Step tracker error: " + ex)); } } catch (Exception ex2) { RustyModBase.mls.LogError((object)("CANNOT CHANGE MATERIAL: " + ex2)); } } private void HideRadMechModel() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) try { Renderer[] componentsInChildren = ((Component)((Component)RadMechAI).transform.Find("MeshContainer")).GetComponentsInChildren<Renderer>(); componentsInChildren[0].enabled = false; } catch (Exception ex) { RustyModBase.mls.LogError((object)("RUSTY MOD HIDE RADMECH ERROR: " + ex.Message)); } } private void CreateRustyModels() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) try { GameObject asset = Assets.GetAsset<GameObject>("rustyPrefab"); BaseRustyObject = Object.Instantiate<GameObject>(asset, ((Component)this).gameObject.transform); ((Object)BaseRustyObject).name = "RustyModel"; try { rustyAudioSource = BaseRustyObject.GetComponentInChildren<AudioSource>(); } catch (Exception ex) { RustyModBase.mls.LogError((object)("Audio source errer: " + ex)); } try { Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(((Component)this).gameObject.transform.position.x, ((Component)this).gameObject.transform.position.y, ((Component)this).gameObject.transform.position.z); Animator[] componentsInChildren = ((Component)((Component)RadMechAI).transform).GetComponentsInChildren<Animator>(); foreach (Animator val2 in componentsInChildren) { if (((Object)val2).name == "AnimContainer") { vanillaRadMechAnimator = val2; } } BaseRustyObject.transform.SetPositionAndRotation(val, ((Component)this).gameObject.transform.rotation); BaseRustyObject.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); } catch (Exception ex2) { RustyModBase.mls.LogError((object)("Positioning error: " + ex2)); } try { rustyAnimator = BaseRustyObject.GetComponentInChildren<Animator>(); } catch (Exception ex3) { RustyModBase.mls.LogError((object)("Animator errer: " + ex3)); } try { rustyAnimator.SetInteger("currentAnim", 0); } catch (Exception ex4) { RustyModBase.mls.LogError((object)("ANIMATOR ERROR: " + ex4)); } } catch (Exception ex5) { RustyModBase.mls.LogError((object)("RUSTY MODEL ERROR: " + ex5)); } } private void LoadSounds() { string soundFolder = RustyModBase.soundFolder; voiceLines = new List<AudioClip>(); audioMainSystem = SoundTool.GetAudioClip(RustyModBase.soundFolder, "mainSystem.mp3"); audioAllOrNothing = SoundTool.GetAudioClip(soundFolder, "allOrNothing.mp3"); voiceLines.Add(audioAllOrNothing); audioBuddy = SoundTool.GetAudioClip(soundFolder, "buddy.mp3"); voiceLines.Add(audioBuddy); audioDontDie = SoundTool.GetAudioClip(soundFolder, "dontDie.mp3"); voiceLines.Add(audioDontDie); audioHeyBuddy = SoundTool.GetAudioClip(soundFolder, "heyBuddy.mp3"); voiceLines.Add(audioHeyBuddy); audioHopeOrDispair = SoundTool.GetAudioClip(soundFolder, "hopeOrDispair.mp3"); voiceLines.Add(audioHopeOrDispair); audioIWontMiss = SoundTool.GetAudioClip(soundFolder, "iWontMiss.mp3"); voiceLines.Add(audioIWontMiss); audioImComing1 = SoundTool.GetAudioClip(soundFolder, "imComing1.mp3"); voiceLines.Add(audioImComing1); audioImComing2 = SoundTool.GetAudioClip(soundFolder, "imComing2.mp3"); voiceLines.Add(audioImComing2); audioKeepYouWaiting = SoundTool.GetAudioClip(soundFolder, "keepYouWaiting.mp3"); voiceLines.Add(audioKeepYouWaiting); audioLockOn = SoundTool.GetAudioClip(soundFolder, "lockOn.mp3"); voiceLines.Add(audioLockOn); audioNoChoice = SoundTool.GetAudioClip(soundFolder, "noChoice.mp3"); voiceLines.Add(audioNoChoice); audioNoGraverThreat = SoundTool.GetAudioClip(soundFolder, "noGraverThreat.mp3"); voiceLines.Add(audioNoGraverThreat); audioOnlyICanFly = SoundTool.GetAudioClip(soundFolder, "onlyICanFly.mp3"); voiceLines.Add(audioOnlyICanFly); audioRubicon = SoundTool.GetAudioClip(soundFolder, "rubicon.mp3"); voiceLines.Add(audioRubicon); audioStayCool = SoundTool.GetAudioClip(soundFolder, "stayCool.mp3"); voiceLines.Add(audioStayCool); audioStepUpMyGame = SoundTool.GetAudioClip(soundFolder, "stepUpMyGame.mp3"); voiceLines.Add(audioStepUpMyGame); audioUnderPressure = SoundTool.GetAudioClip(soundFolder, "underPressure.mp3"); voiceLines.Add(audioUnderPressure); audioWatchOut = SoundTool.GetAudioClip(soundFolder, "watchOut.mp3"); voiceLines.Add(audioWatchOut); audioWhatDrivesYou = SoundTool.GetAudioClip(soundFolder, "whatDrivesYou.mp3"); voiceLines.Add(audioWhatDrivesYou); audioYouCanDoBetter = SoundTool.GetAudioClip(soundFolder, "youCanDoBetter.mp3"); voiceLines.Add(audioYouCanDoBetter); audioYouThereBuddy = SoundTool.GetAudioClip(soundFolder, "youThereBuddy.mp3"); voiceLines.Add(audioYouThereBuddy); audioYoureFast = SoundTool.GetAudioClip(soundFolder, "youreFast.mp3"); voiceLines.Add(audioYoureFast); audioYoureGood = SoundTool.GetAudioClip(soundFolder, "youreGood.mp3"); voiceLines.Add(audioYoureGood); } public void TakeStep1() { rustyAnimator.SetBool("step2", false); rustyAnimator.SetBool("step1", true); } public void TakeStep2() { rustyAnimator.SetBool("step1", false); rustyAnimator.SetBool("step2", true); } private void UpdateScanNodeData() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) ((Component)RadMechAI).GetComponentInChildren<ScanNodeProperties>().headerText = "STEEL HAZE /\nV.IV Rusty"; } } [HarmonyPatch] public class RustyTerminal { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] public static void EditTerminal(Terminal __instance) { if (RustyModBase.BoundConfig.logEntry.Value) { int index = __instance.enemyFiles.FindIndex((TerminalNode e) => ((Object)e).name == "RadMechFile"); TerminalNode val = __instance.enemyFiles[index]; val.creatureName = "STEEL HAZE / V.IV Rusty"; val.displayText = "STEEL HAZE / V.IV Rusty\n\nHIGH AND DRYYYYYYYYYYYYY\nI FLY HIIIIIIIIIIIIIIIIIGH\nWATCH THE SUUUUUUUUUN RIIIIIIIIIISE\nIIIIIIIIINTOOOO DAAAAAAAWNNNN\n\nRUST AWAAAAAAAAAAYYYYYYYYYY\nLOST TO WIIIIIIIIIIIIIIIIIND\nWATCH THE SUUUUUUUUUUUN RIIIIIIIISE\nRUUUUUUUUUUSTED PRIIIIIIIIIIDE\n\n"; int num = new Random().Next(0, 20); if (num == 0) { val.displayVideo = Assets.GetAsset<VideoClip>("rustyVideo"); val.loadImageSlowly = true; } else { val.displayVideo = Assets.GetAsset<VideoClip>("rustyTerminal"); val.loadImageSlowly = false; } TerminalKeyword keyword; try { keyword = TerminalApi.GetKeyword("old birds"); keyword.word = "rusty"; } catch (NullReferenceException) { keyword = TerminalApi.GetKeyword("rusty"); } TerminalApi.UpdateKeyword(keyword); RustyModBase.mls.LogDebug((object)("TERMINAL PATCHED (" + num + ")")); } } } internal static class SoundPatches { public static void Patch() { try { RustyModBase.mls.LogInfo((object)("Sound Folder: " + RustyModBase.soundFolder)); AudioClip audioClip = SoundTool.GetAudioClip(RustyModBase.soundFolder, "none.mp3"); AudioClip audioClip2 = SoundTool.GetAudioClip(RustyModBase.soundFolder, "mainSystem.mp3"); SoundTool.ReplaceAudioClip("robotTune", audioClip, "3DLradAudio2"); SoundTool.ReplaceAudioClip("RadMechAmbientSFX", audioClip, "EngineSFX"); SoundTool.ReplaceAudioClip("NeonLightFlicker", audioClip, "VoiceSFX"); SoundTool.ReplaceAudioClip("LRADAlarm3", audioClip, "3DLradAudio"); SoundTool.ReplaceAudioClip("ToWar", audioClip, "3DLradAudio2"); SoundTool.ReplaceAudioClip("LradBrainwashingSignal1", audioClip, "3DLradAudio2"); SoundTool.ReplaceAudioClip("LradBrainwashingSignal4", audioClip, "3DLradAudio2"); SoundTool.ReplaceAudioClip("LradBrainwashingSignal6", audioClip, "3DLradAudio2"); SoundTool.ReplaceAudioClip("LradBrainwashingSignal7", audioClip, "3DLradAudio2"); SoundTool.ReplaceAudioClip("LradBrainwashingSignal8", audioClip, "3DLradAudio2"); SoundTool.ReplaceAudioClip("RadMechWake", audioClip2, "CreatureSFX"); RustyModBase.mls.LogInfo((object)"AAAAAAAAAS"); } catch (Exception ex) { RustyModBase.mls.LogError((object)("SOUND ERROR: " + ex)); } } } [HarmonyPatch] internal class SpawnObjectPatch { [HarmonyPatch(typeof(RoundManager), "SyncNestSpawnPositionsClientRpc")] [HarmonyPostfix] public static void GetMapObject(RoundManager __instance) { //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) try { RustyModBase.mls.LogInfo((object)"Patching RadMech spawn"); RustyModBase.mls.LogInfo((object)("Testing testing: " + __instance.enemyNestSpawnObjects.Count)); List<EnemyAINestSpawnObject> enemyNestSpawnObjects = __instance.enemyNestSpawnObjects; foreach (EnemyAINestSpawnObject item in enemyNestSpawnObjects) { RustyModBase.mls.LogInfo((object)("Game Object: " + ((Object)item).name)); } foreach (EnemyAINestSpawnObject item2 in enemyNestSpawnObjects) { RustyModBase.mls.LogInfo((object)("Outside Object: " + (object)item2.enemyType)); if (!(item2.enemyType.enemyName != "RadMech")) { EnemyAINestSpawnObject val = item2; try { Renderer[] componentsInChildren = ((Component)((Component)item2).transform.Find("MeshContainer")).GetComponentsInChildren<Renderer>(); componentsInChildren[0].enabled = false; ((Component)item2).GetComponentInChildren<ScanNodeProperties>().headerText = "STEEL HAZE /\nV.IV Rusty"; } catch (Exception ex) { RustyModBase.mls.LogError((object)("RUSTY MOD HIDE RADMECH ERROR: " + ex.Message)); } RustyModBase.mls.LogInfo((object)"Adding rusty to inactive mechs"); GameObject asset = Assets.GetAsset<GameObject>("rustyPrefab"); GameObject val2 = Object.Instantiate<GameObject>(asset, ((Component)val).transform); ((Object)val2).name = "RustyModel"; ManualLogSource mls = RustyModBase.mls; Vector3 val3 = val2.transform.position; mls.LogInfo((object)("Rusty Position: " + ((object)(Vector3)(ref val3)).ToString())); ManualLogSource mls2 = RustyModBase.mls; val3 = ((Component)val).transform.position; mls2.LogInfo((object)("Old Bird Position: " + ((object)(Vector3)(ref val3)).ToString())); val2.transform.localScale = new Vector3(0.6f, 0.6f, 0.6f); ManualLogSource mls3 = RustyModBase.mls; val3 = val2.transform.localPosition; mls3.LogInfo((object)("Rusty Position 2: " + ((object)(Vector3)(ref val3)).ToString())); ManualLogSource mls4 = RustyModBase.mls; val3 = ((Component)val).transform.localPosition; mls4.LogInfo((object)("Old Bird Position 2: " + ((object)(Vector3)(ref val3)).ToString())); } } } catch (Exception ex2) { RustyModBase.mls.LogError((object)("Spawn Object Error: " + ex2)); } RustyModBase.mls.LogInfo((object)"RadMech spawn patched"); } } [BepInPlugin("Eyasu.OurBuddyRusty", "Our Buddy Rusty", "1.6")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RustyModBase : BaseUnityPlugin { private const string modGUID = "Eyasu.OurBuddyRusty"; private const string modName = "Our Buddy Rusty"; private const string modVersion = "1.6"; private readonly Harmony Harmony = new Harmony("Eyasu.OurBuddyRusty"); public static ManualLogSource mls; public static AssetBundle RustyBundle; public static Mesh shovelMesh; public static VideoClip rustyVideo; public static Material shovelMat; public static string location; public static string soundFolder; private static RustyModBase Instance; internal static RustyConfig BoundConfig { get; private set; } private void Awake() { mls = Logger.CreateLogSource("Eyasu.OurBuddyRusty"); mls.LogDebug((object)"AMOGUS SUS"); if ((Object)(object)Instance == (Object)null) { Instance = this; } location = Path.Join((ReadOnlySpan<char>)Paths.PluginPath, (ReadOnlySpan<char>)"Eyasu-OurBuddyRusty"); soundFolder = location; mls.LogDebug((object)("Plugin path: " + location)); string text = Path.Join((ReadOnlySpan<char>)location, (ReadOnlySpan<char>)"rusty"); BoundConfig = new RustyConfig(((BaseUnityPlugin)this).Config); mls.LogDebug((object)("Bundle path: " + text)); RustyBundle = AssetBundle.LoadFromFile(text); mls.LogDebug((object)"Loading asset bundle..."); Assets.PopulateAssets(); if ((Object)(object)RustyBundle == (Object)null) { mls.LogError((object)"RUSTY BUNDLE FAILED TO LOAD"); } if (RustyBundle.Contains("Assets/rusty.fbx")) { mls.LogDebug((object)"Contains: Assets/rusty.fbx"); } if (RustyBundle.Contains("Assets/rusty")) { mls.LogDebug((object)"Contains: Assets/rusty"); } if (RustyBundle.Contains("rusty.fbx")) { mls.LogDebug((object)"Contains: rusty.fbx"); } if (RustyBundle.Contains("rusty")) { mls.LogDebug((object)"Contains: rusty"); } if (RustyBundle.Contains("")) { mls.LogDebug((object)"Contains: "); } if (RustyBundle.Contains("rustyVideo.webm")) { mls.LogDebug((object)"Contains: rustyVideo.webm"); } if (RustyBundle.Contains("rustyVideo")) { mls.LogDebug((object)"Contains: rustyVideo"); } if (RustyBundle.Contains("rustyTerminal.webm")) { mls.LogDebug((object)"Contains: rustyTerminal.webm"); } if (RustyBundle.Contains("rustyTerminal")) { mls.LogDebug((object)"Contains: rustyTerminal"); } shovelMesh = RustyBundle.LoadAsset<Mesh>("rusty.fbx"); mls.LogDebug((object)"Rusty BUndle meshes: "); Mesh[] array = RustyBundle.LoadAllAssets<Mesh>(); foreach (Mesh val in array) { mls.LogDebug((object)((Object)val).name); } rustyVideo = Assets.GetAsset<VideoClip>("rustyVideo"); Harmony.PatchAll(typeof(RustyModBase)); Harmony.PatchAll(typeof(EnemyPatches)); Harmony.PatchAll(typeof(RustyTerminal)); SoundPatches.Patch(); try { Harmony.PatchAll(typeof(SpawnObjectPatch)); mls.LogDebug((object)"Patch applied"); } catch (Exception ex) { mls.LogError((object)("Spawn Object Patching Error: " + ex)); } mls.LogDebug((object)("Sound Folder: " + soundFolder)); AudioClip audioClip = SoundTool.GetAudioClip(soundFolder, "none.mp3"); AudioClip audioClip2 = SoundTool.GetAudioClip(soundFolder, "mainSystem.mp3"); mls.LogDebug((object)"AAAAAAAAAS"); } } namespace RustyMod { public static class PluginInfo { public const string PLUGIN_GUID = "RustyMod"; public const string PLUGIN_NAME = "RustyMod"; public const string PLUGIN_VERSION = "1.0.6"; } } namespace RustyModUtils { public class RustyConfig { public readonly ConfigEntry<bool> fastVoiceCooldown; public readonly ConfigEntry<bool> logEntry; public RustyConfig(ConfigFile config) { config.SaveOnConfigSet = false; fastVoiceCooldown = config.Bind<bool>("General", "FastVoiceCooldown", false, "Switch to using the bugged voiceline cooldown timings"); logEntry = config.Bind<bool>("General", "LogEntry", true, "Replaces the Old Bird bestiary entry. This may conflict with other mods, so try disabling it if there's issues with the terminal."); ClearOrphanedEntries(config); config.Save(); config.SaveOnConfigSet = true; } private static void ClearOrphanedEntries(ConfigFile cfg) { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(cfg); dictionary.Clear(); } } internal static class Assets { public static AssetBundle AssetBundle { get; private set; } private static Dictionary<string, Object> AssetList { get; set; } private static string AssemblyName => Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0]; public static void PopulateAssets() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown if ((Object)AssetBundle != (Object)null) { RustyModBase.mls.LogWarning((object)"Attempted to load the asset bundle but the bundle was not null!"); return; } string name = AssemblyName + ".Bundle.gokubracken"; using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name)) { AssetBundle = AssetBundle.LoadFromStream(stream); } if ((Object)AssetBundle == (Object)null) { RustyModBase.mls.LogError((object)("Asset bundle at " + AssemblyName + ".gokubracken failed to load!")); } AssetList = new Dictionary<string, Object>(); Object[] array = AssetBundle.LoadAllAssets(); Object[] array2 = array; foreach (Object val in array2) { AssetList.Add(val.name, val); } } } }