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 DingusThings v1.5.1
milodinosaur.DingusThings.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.Logging; using DingusThings.Behaviours; using DingusThings.CustomScriptableObject; using DingusThings.Patches; using HarmonyLib; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; 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 = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("milodinosaur.DingusThings")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.5.1.0")] [assembly: AssemblyInformationalVersion("1.5.1+9aefea8591778702c3e78fb26cfa4eb36dec9492")] [assembly: AssemblyProduct("DingusThings")] [assembly: AssemblyTitle("milodinosaur.DingusThings")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 DingusThings { [BepInPlugin("milodinosaur.DingusThings", "DingusThings", "1.5.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class DingusThings : BaseUnityPlugin { public static AssetBundle? Bundle; public static string PluginString = "DingusThings v1.5.1"; private static Terminal? terminalInstance; private static int randomMapSeed = 0; public static DingusThings Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } public static Terminal? GetTerminalInstance() { if ((Object)(object)terminalInstance != (Object)null) { return terminalInstance; } return null; } public static void SetTerminalInstance(Terminal terminal) { terminalInstance = terminal; } public static int GetRandomMapSeed() { return randomMapSeed; } public static void SetRandomMapSeed(int s) { randomMapSeed = s; KeyboardPhysicsProp.OnSeedUpdate(); } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); Bundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "dingus")); if ((Object)(object)Bundle == (Object)null) { Logger.LogError((object)(PluginString + ": Failed to load custom assets.")); return; } Harmony.CreateAndPatchAll(typeof(TerminalPatch), (string)null); Harmony.CreateAndPatchAll(typeof(SeedPatch), (string)null); MyHeartItem.Register(); SteamGiftCardItem.Register(); LifebuoyBarSoapItem.Register(); InstantNoodlePackItem.Register(); KeyboardItem.Register(); NerdItem.Register(); Logger.LogInfo((object)(PluginString + " has loaded!")); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "milodinosaur.DingusThings"; public const string PLUGIN_NAME = "DingusThings"; public const string PLUGIN_VERSION = "1.5.1"; } } namespace DingusThings.Patches { internal class SeedPatch { [HarmonyPatch(typeof(StartOfRound), "ChooseNewRandomMapSeed")] [HarmonyPostfix] public static void StartOfRound_ChooseNewRandomMapSeed(StartOfRound __instance) { DingusThings.SetRandomMapSeed(__instance.randomMapSeed); } } internal class SteamGiftPatch { [HarmonyPatch(typeof(GrabbableObject), "EquipItem")] [HarmonyPrefix] public static void GrabbableObject_EquipItem(GrabbableObject __instance) { if (__instance.itemProperties.itemName == "Steam Gift Card" && ((NetworkBehaviour)__instance).IsOwner) { HUDManager.Instance.ChangeControlTip(2, (__instance.scrapValue <= 0) ? "ALREADY REDEEMED" : "Redeem: [LMB]", false); } } } internal class TerminalPatch { [HarmonyPatch(typeof(Terminal), "Start")] [HarmonyPostfix] public static void Terminal_Start(Terminal __instance) { DingusThings.SetTerminalInstance(__instance); } } } namespace DingusThings.CustomScriptableObject { internal class InstantNoodlePackItem { public static void Register() { AssetBundle bundle = DingusThings.Bundle; if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)"Instant noodle packs failed to load."); return; } int num = 70; Item val = bundle.LoadAsset<Item>("Assets/DingusThings/Items/MaggiInstantNoodlePack.asset"); PhysicsProp val2 = val.spawnPrefab.AddComponent<PhysicsProp>(); ((GrabbableObject)val2).grabbable = true; ((GrabbableObject)val2).grabbableToEnemies = true; ((GrabbableObject)val2).isInFactory = true; ((GrabbableObject)val2).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); Item val3 = bundle.LoadAsset<Item>("Assets/DingusThings/Items/IndomieInstantNoodlePack.asset"); PhysicsProp val4 = val3.spawnPrefab.AddComponent<PhysicsProp>(); ((GrabbableObject)val4).grabbable = true; ((GrabbableObject)val4).grabbableToEnemies = true; ((GrabbableObject)val4).isInFactory = true; ((GrabbableObject)val4).itemProperties = val3; NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab); Utilities.FixMixerGroups(val3.spawnPrefab); Items.RegisterScrap(val3, num, (LevelTypes)(-1)); } } internal class KeyboardItem { public static void Register() { string text = "Keyboard"; AssetBundle bundle = DingusThings.Bundle; if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)(text + " failed to load.")); return; } int num = 30; Item val = bundle.LoadAsset<Item>("Assets/DingusThings/Items/Keyboard.asset"); val.toolTips = new string[1] { "Type: [LMB]" }; KeyboardPhysicsProp keyboardPhysicsProp = val.spawnPrefab.AddComponent<KeyboardPhysicsProp>(); ((GrabbableObject)keyboardPhysicsProp).grabbable = true; ((GrabbableObject)keyboardPhysicsProp).grabbableToEnemies = true; ((GrabbableObject)keyboardPhysicsProp).isInFactory = true; ((GrabbableObject)keyboardPhysicsProp).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); } } internal class LifebuoyBarSoapItem { public static void Register() { string text = "Lifebuoy Bar Soap"; AssetBundle bundle = DingusThings.Bundle; if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)(text + " failed to load.")); return; } int num = 100; Item val = bundle.LoadAsset<Item>("Assets/DingusThings/Items/LifebuoyBarSoap.asset"); PhysicsProp val2 = val.spawnPrefab.AddComponent<PhysicsProp>(); ((GrabbableObject)val2).grabbable = true; ((GrabbableObject)val2).grabbableToEnemies = true; ((GrabbableObject)val2).isInFactory = true; ((GrabbableObject)val2).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); } } internal class MyHeartItem { public static void Register() { string text = "My Heart"; AssetBundle bundle = DingusThings.Bundle; if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)(text + " failed to load.")); return; } int num = 40; Item val = bundle.LoadAsset<Item>("Assets/DingusThings/Items/MyHeart.asset"); val.toolTips = new string[1] { "What she said: [LMB]" }; MyHeartPhysicsProp myHeartPhysicsProp = val.spawnPrefab.AddComponent<MyHeartPhysicsProp>(); ((GrabbableObject)myHeartPhysicsProp).grabbable = true; ((GrabbableObject)myHeartPhysicsProp).grabbableToEnemies = true; ((GrabbableObject)myHeartPhysicsProp).isInFactory = true; ((GrabbableObject)myHeartPhysicsProp).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); } } internal class NerdItem { public static void Register() { string text = "Nerd"; AssetBundle bundle = DingusThings.Bundle; if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)(text + " failed to load.")); return; } int num = 40; Item val = bundle.LoadAsset<Item>("Assets/DingusThings/Items/Nerd.asset"); val.toolTips = new string[1] { "Ackchually: [LMB]" }; NerdPhysicsProp nerdPhysicsProp = val.spawnPrefab.AddComponent<NerdPhysicsProp>(); ((GrabbableObject)nerdPhysicsProp).grabbable = true; ((GrabbableObject)nerdPhysicsProp).grabbableToEnemies = true; ((GrabbableObject)nerdPhysicsProp).isInFactory = true; ((GrabbableObject)nerdPhysicsProp).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); } } internal class SteamGiftCardItem { public static void Register() { string text = "Steam Gift Card"; AssetBundle bundle = DingusThings.Bundle; if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)(text + " failed to load.")); return; } Harmony.CreateAndPatchAll(typeof(SteamGiftPatch), (string)null); int num = 60; Item val = bundle.LoadAsset<Item>("Assets/DingusThings/Items/SteamGiftCard.asset"); val.toolTips = new string[1] { "Inspect: [Z]" }; SteamGiftPhysicsProp steamGiftPhysicsProp = val.spawnPrefab.AddComponent<SteamGiftPhysicsProp>(); ((GrabbableObject)steamGiftPhysicsProp).grabbable = true; ((GrabbableObject)steamGiftPhysicsProp).grabbableToEnemies = true; ((GrabbableObject)steamGiftPhysicsProp).isInFactory = true; ((GrabbableObject)steamGiftPhysicsProp).itemProperties = val; NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab); Utilities.FixMixerGroups(val.spawnPrefab); Items.RegisterScrap(val, num, (LevelTypes)(-1)); } } } namespace DingusThings.Behaviours { internal class KeyboardPhysicsProp : PhysicsProp { private readonly float cooldown = 5f; private float _lastTriggeredTime; private static Random? randomizer; public static void OnSeedUpdate() { randomizer = new Random(DingusThings.GetRandomMapSeed()); } public override void Start() { ((GrabbableObject)this).Start(); int itemId = ((GrabbableObject)this).itemProperties.itemId; randomizer = new Random(itemId); } public override void ItemActivate(bool used, bool buttonDown = true) { if (Time.time - _lastTriggeredTime < cooldown) { return; } ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown) { return; } _lastTriggeredTime = Time.time; string text = "Keyboard"; AssetBundle bundle = DingusThings.Bundle; if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)(text + ": Sound failed to play.")); return; } AudioClip[] array = (AudioClip[])(object)new AudioClip[6] { bundle.LoadAsset<AudioClip>("Assets/DingusThings/Sounds/ryan keyboard.ogg"), bundle.LoadAsset<AudioClip>("Assets/DingusThings/Sounds/pingu keyboard.ogg"), bundle.LoadAsset<AudioClip>("Assets/DingusThings/Sounds/mika keyboard.ogg"), bundle.LoadAsset<AudioClip>("Assets/DingusThings/Sounds/kayeo keyboard.ogg"), bundle.LoadAsset<AudioClip>("Assets/DingusThings/Sounds/agam keyboard.ogg"), bundle.LoadAsset<AudioClip>("Assets/DingusThings/Sounds/luna keyboard.ogg") }; int num = 0; if (randomizer != null) { num = randomizer.Next(array.Length); } AudioSource component = ((Component)this).GetComponent<AudioSource>(); component.PlayOneShot(array[num], 1f); } } internal class MyHeartPhysicsProp : PhysicsProp { private readonly float cooldown = 1.1f; private float _lastTriggeredTime; public override void ItemActivate(bool used, bool buttonDown = true) { if (Time.time - _lastTriggeredTime < cooldown) { return; } ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown) { _lastTriggeredTime = Time.time; AssetBundle bundle = DingusThings.Bundle; string text = "My Heart"; if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)(text + ": Sound failed to play.")); return; } AudioClip val = bundle.LoadAsset<AudioClip>("Assets/DingusThings/Sounds/SheSaid.ogg"); AudioSource component = ((Component)this).GetComponent<AudioSource>(); component.PlayOneShot(val, 1f); } } } internal class NerdPhysicsProp : PhysicsProp { private readonly float cooldown = 1.1f; private float _lastTriggeredTime; public override void ItemActivate(bool used, bool buttonDown = true) { if (Time.time - _lastTriggeredTime < cooldown) { return; } ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown) { _lastTriggeredTime = Time.time; AssetBundle bundle = DingusThings.Bundle; string text = "Nerd"; if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)(text + ": Sound failed to play.")); return; } AudioClip val = bundle.LoadAsset<AudioClip>("Assets/DingusThings/Sounds/akchually.ogg"); AudioSource component = ((Component)this).GetComponent<AudioSource>(); component.PlayOneShot(val, 1f); } } } internal class SteamGiftPhysicsProp : PhysicsProp { private void ChangeTooltip() { if (((NetworkBehaviour)this).IsOwner) { HUDManager.Instance.ChangeControlTip(2, (((GrabbableObject)this).scrapValue <= 0) ? "ALREADY REDEEMED" : "Redeem: [LMB]", false); } } public override void ItemActivate(bool used, bool buttonDown = true) { if (((GrabbableObject)this).scrapValue <= 0) { return; } ((GrabbableObject)this).ItemActivate(used, buttonDown); if (!buttonDown) { return; } AssetBundle bundle = DingusThings.Bundle; string text = "Steam Gift Card"; Terminal terminalInstance = DingusThings.GetTerminalInstance(); if ((Object)(object)terminalInstance != (Object)null) { terminalInstance.groupCredits += ((GrabbableObject)this).scrapValue; ((GrabbableObject)this).SetScrapValue(0); ChangeTooltip(); if ((Object)(object)bundle == (Object)null) { DingusThings.Logger.LogError((object)(text + ": Sound failed to play.")); return; } AudioClip val = bundle.LoadAsset<AudioClip>("Assets/DingusThings/Sounds/steam_achievement.ogg"); AudioSource component = ((Component)this).GetComponent<AudioSource>(); component.PlayOneShot(val, 1f); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }