Decompiled source of TinyMissile v1.0.0

plugins/Tiny Missile.dll

Decompiled 3 months ago
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.Configuration;
using BoplFixedMath;
using HarmonyLib;
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("Scen_Maker")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Scen_Maker")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("73007518-1d07-4874-8be4-928927af7047")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TinnyMissile;

[BepInPlugin("com.000diggity000.TinyMissile", "Tiny Missile", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public class Patches
	{
		public static bool Update_Missile_Plug(Missile __instance, FixTransform ___fixTrans, BoplBody ___body, float ___spawnTime, Fix ___accel)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((Component)__instance).gameObject.gameObject.GetComponent<IPhysicsCollider>().Scale = (Fix)SizeConfig.Value;
			return true;
		}
	}

	internal static ConfigFile config = new ConfigFile(Path.Combine(Paths.ConfigPath, "TinyMissileConfig.cfg"), true);

	internal static ConfigEntry<float> SizeConfig;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		Harmony val = new Harmony("com.000diggity000.TinyMissile");
		MethodInfo methodInfo = AccessTools.Method(typeof(Missile), "Update", (Type[])null, (Type[])null);
		MethodInfo methodInfo2 = AccessTools.Method(typeof(Patches), "Update_Missile_Plug", (Type[])null, (Type[])null);
		val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		SizeConfig = config.Bind<float>("Tiny Missile", "Size", 0.4f, "Minimum is 0 and the maximum is 2");
		if (SizeConfig.Value < 0f)
		{
			SizeConfig.Value = 0f;
		}
		if (SizeConfig.Value > 2f)
		{
			SizeConfig.Value = 2f;
		}
	}
}