Decompiled source of Adjust Drone Speed v1.1.0

AdjustableDroneSpeed.dll

Decompiled 2 weeks ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AdjustableDroneSpeed.patches;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using SpaceCraft;
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("AdjustableDroneSpeed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AdjustableDroneSpeed")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f3320452-28da-4005-83dc-1990e6366a78")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AdjustableDroneSpeed
{
	[BepInPlugin("blue.nova.AdjustableDroneSpeed", "AdjustableDroneSpeed", "1.1.0")]
	public class AdjustableDroneSpeedBase : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("blue.nova.AdjustableDroneSpeed");

		private static AdjustableDroneSpeedBase instance;

		public static ManualLogSource mls;

		public static ConfigEntry<float> droneSpeed;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			droneSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Drone Speed", 21.93769f, "The Base speed of the drone. That applies to all drones. (even T1)");
			mls = Logger.CreateLogSource("blue.nova.AdjustableDroneSpeed");
			mls.LogInfo((object)"AdjustableDroneSpeed loaded");
			harmony.PatchAll(typeof(AdjustableDroneSpeedBase));
			harmony.PatchAll(typeof(dronePatch));
		}
	}
}
namespace AdjustableDroneSpeed.patches
{
	[HarmonyPatch(typeof(Drone), "Awake")]
	internal class dronePatch
	{
		private const float defaultSpeed = 21f;

		private static float droneSpeed;

		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void speedDronePatch(Drone __instance)
		{
			if (AdjustableDroneSpeedBase.droneSpeed != null)
			{
				droneSpeed = AdjustableDroneSpeedBase.droneSpeed.Value;
			}
			else
			{
				droneSpeed = 21f;
			}
			__instance.forwardSpeed = droneSpeed;
			__instance.rotationSpeed = 100f;
		}
	}
}