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 RatScrap v1.1.1
RatScrap.dll
Decompiled 2 years agousing System; 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 LethalLib.Modules; using Microsoft.CodeAnalysis; using RatScrap.MonoBehaviors; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RatScrap")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A template for Lethal Company")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1")] [assembly: AssemblyProduct("RatScrap")] [assembly: AssemblyTitle("RatScrap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.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; } } } namespace RatScrap { [BepInPlugin("RatScrap", "RatScrap", "1.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public static AssetBundle assetBundle; private ConfigEntry<bool> configEnabled; private ConfigEntry<int> configRarity; private ConfigEntry<int> configMinValue; private ConfigEntry<int> configMaxValue; private ConfigEntry<float> configCooldown; private void LogInfo(string message) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[email protected]: " + message)); } private void LogError(string message) { ((BaseUnityPlugin)this).Logger.LogError((object)("[email protected]: " + message)); } 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown LogInfo("Initializing plugin"); configEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, new ConfigDescription("Spawn rats in the facility", (AcceptableValueBase)null, Array.Empty<object>())); configRarity = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Rarity weight", 60, new ConfigDescription("How likely rats are able to spawn", (AcceptableValueBase)null, Array.Empty<object>())); configMinValue = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Min value", 50, new ConfigDescription("Minimum value, must be > 0", (AcceptableValueBase)null, Array.Empty<object>())); configMaxValue = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max value", 70, new ConfigDescription("Maximum value, must be > minimum value", (AcceptableValueBase)null, Array.Empty<object>())); configCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Squish cooldown", 0.5f, new ConfigDescription("How often the rat can be squished (in seconds)", (AcceptableValueBase)null, Array.Empty<object>())); assetBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ratscrap")); Item val = assetBundle.LoadAsset<Item>("Assets/RatScrap/RatScrapItem.asset"); PropBehavior propBehavior = val.spawnPrefab.AddComponent<PropBehavior>(); ((GrabbableObject)propBehavior).itemProperties = val; ((GrabbableObject)propBehavior).useCooldown = configCooldown.Value; propBehavior.audioClips = (AudioClip[])(object)new AudioClip[2] { assetBundle.LoadAsset<AudioClip>("Assets/RatScrap/RatScrapPickup.ogg"), assetBundle.LoadAsset<AudioClip>("Assets/RatScrap/RatScrapDrop.ogg") }; if ((Object)(object)val == (Object)null) { LogError("RatScrapItem could not be loaded"); return; } if (!configEnabled.Value) { LogInfo("Rat spawning disabled in config"); return; } if (configMinValue.Value <= 0 || configMaxValue.Value <= configMinValue.Value) { LogError("Incorrect min/max value, check your config, default values will be used"); val.minValue = 50; val.maxValue = 70; } else { val.minValue = configMinValue.Value; val.maxValue = configMaxValue.Value; } Items.RegisterScrap(val, configRarity.Value, (LevelTypes)(-1)); NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); LogInfo("Plugin successfully loaded"); } } public static class PluginInfo { public const string PLUGIN_GUID = "RatScrap"; public const string PLUGIN_NAME = "RatScrap"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace RatScrap.MonoBehaviors { internal class PropBehavior : PhysicsProp { private AudioSource audioSource; public AudioClip[] audioClips; public override void Start() { ((GrabbableObject)this).Start(); ((GrabbableObject)this).grabbable = true; ((GrabbableObject)this).grabbableToEnemies = true; audioSource = ((Component)this).gameObject.GetComponent<AudioSource>(); } public override void ItemActivate(bool used, bool buttonDown = true) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).ItemActivate(used, buttonDown); if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && buttonDown && !audioSource.isPlaying) { audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Length)]); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 10f, 0.5f, 0, ((GrabbableObject)this).isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); } } } }