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 KnucklesMod v2.0.3
KnucklesMod.dll
Decompiled 2 years agousing 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.Bootstrap; using BepInEx.Configuration; using KnucklesMod; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Modules; using UnityEngine; [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 = "")] [assembly: AssemblyCompany("AmesBoys")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds Knuckles as collectible scrap")] [assembly: AssemblyFileVersion("2.0.3.0")] [assembly: AssemblyInformationalVersion("2.0.3")] [assembly: AssemblyProduct("KnucklesMod")] [assembly: AssemblyTitle("KnucklesMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.3.0")] [module: UnverifiableCode] public class KnucklesItem : GrabbableObject { private static ILogger logger = Debug.unityLogger; public AudioClip scream; public AudioSource screamPlayer; private bool isScared; private bool isScreaming; private float noiseInterval; private RoundManager roundManager; private int timesPlayedWithoutTurningOff; private const int LAYERMASK = 524288; public override void Start() { base.grabbable = true; base.isInFactory = true; ((GrabbableObject)this).Start(); isScreaming = false; roundManager = Object.FindObjectOfType<RoundManager>(); screamPlayer.loop = true; screamPlayer.clip = scream; } public override void Update() { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (!KnucklesPlugin.screamNearEnemies.Value) { if (isScreaming) { screamPlayer.Stop(); isScreaming = false; timesPlayedWithoutTurningOff = 0; } return; } if (nearEnemy()) { isScared = true; } else { isScared = false; } if (isScared && base.isHeld) { screamPlayer.volume = KnucklesPlugin.screamVolume.Value; if (isScreaming) { if (noiseInterval <= 0f) { noiseInterval = 1f; timesPlayedWithoutTurningOff++; roundManager.PlayAudibleNoise(((Component)this).transform.position, 16f, KnucklesPlugin.screamVolume.Value, timesPlayedWithoutTurningOff, false, 5); } else { noiseInterval -= Time.deltaTime; } } else { screamPlayer.Play(); isScreaming = true; } } else if (isScreaming) { screamPlayer.Stop(); isScreaming = false; timesPlayedWithoutTurningOff = 0; } } private bool nearEnemy() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) int layer = ((Component)this).gameObject.layer; ((Component)this).gameObject.layer = 0; Vector3 position = ((Component)this).transform.position; bool result = Physics.CheckSphere(position, KnucklesPlugin.enemyCheckRadius.Value, 524288); ((Component)this).gameObject.layer = layer; return result; } } namespace KnucklesMod; [BepInPlugin("KnucklesMod", "KnucklesMod", "2.0.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class KnucklesPlugin : BaseUnityPlugin { public static AssetBundle knuckles_bundle; public static ConfigEntry<bool> screamNearEnemies; public static ConfigEntry<float> screamVolume; public static ConfigEntry<float> enemyCheckRadius; private void Awake() { screamNearEnemies = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Scream Near Enemies", true, "Whether or not Knucks screams when nearby enemies."); screamVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Scream Volume", 0.7f, "Quantifies the level of Knucks' fear around enemies."); enemyCheckRadius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Enemy Fear Radius", 20f, "How close an enemy needs to be for Knucks to be afraid of it."); if (Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig")) { LethalConfiguration.setupLethalConfig(); } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); knuckles_bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "knucklesbundle")); if ((Object)(object)knuckles_bundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets."); return; } int num = 70; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading Knuckles Item"); Item val = knuckles_bundle.LoadAsset<Item>("Knuckles"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Configuring KnucklesItem Component"); val.spawnPrefab.AddComponent(typeof(KnucklesItem)); val.spawnPrefab.GetComponent<KnucklesItem>().scream = knuckles_bundle.LoadAsset<AudioClip>("cartoon-scream"); val.spawnPrefab.GetComponent<KnucklesItem>().screamPlayer = val.spawnPrefab.GetComponent<AudioSource>(); ((GrabbableObject)val.spawnPrefab.GetComponent<KnucklesItem>()).itemProperties = val; ((GrabbableObject)val.spawnPrefab.GetComponent<KnucklesItem>()).mainObjectRenderer = val.spawnPrefab.GetComponent<MeshRenderer>(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Registering Knuckles as scrap"); Utilities.FixMixerGroups(val.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin KnucklesMod is loaded!"); } } internal class LethalConfiguration { public static void setupLethalConfig() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown BoolCheckBoxConfigItem val = new BoolCheckBoxConfigItem(KnucklesPlugin.screamNearEnemies, false); ConfigEntry<float> screamVolume = KnucklesPlugin.screamVolume; FloatSliderOptions val2 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val2).Min = 0f; ((BaseRangeOptions<float>)val2).Max = 1f; ((BaseOptions)val2).RequiresRestart = false; FloatSliderConfigItem val3 = new FloatSliderConfigItem(screamVolume, val2); ConfigEntry<float> enemyCheckRadius = KnucklesPlugin.enemyCheckRadius; FloatSliderOptions val4 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val4).Min = 0f; ((BaseRangeOptions<float>)val4).Max = 30f; ((BaseOptions)val4).RequiresRestart = false; FloatSliderConfigItem val5 = new FloatSliderConfigItem(enemyCheckRadius, val4); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val5); } } public static class PluginInfo { public const string PLUGIN_GUID = "KnucklesMod"; public const string PLUGIN_NAME = "KnucklesMod"; public const string PLUGIN_VERSION = "2.0.3"; }