Decompiled source of Flying Sticks v1.0.0

FlyTurt.dll

Decompiled a month ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using BepInEx;
using BepInEx.Configuration;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("StickFightTheGameMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StickFightTheGameMod")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("07ad7751-658e-41ea-b1ee-8a7e59ffbe73")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FlyMod;

[BepInPlugin("sftg.bayturtleking.flymod", "Fly Mod", "1.0.0")]
public class FlyModPlugin : BaseUnityPlugin
{
	private ConfigEntry<KeyCode> togglekeyyyy;

	private ConfigEntry<float> flyspeeeed;

	private bool imflyin;

	private List<Rigidbody> mybittt = new List<Rigidbody>();

	private float refindaggg;

	private void Awake()
	{
		togglekeyyyy = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "togglekey", (KeyCode)285, "key to toggle flying");
		flyspeeeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "flyspeed", 18f, "how fast u fly");
	}

	private void Update()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKeyDown(togglekeyyyy.Value))
		{
			toggleflyyyy();
		}
	}

	private void toggleflyyyy()
	{
		if (!imflyin)
		{
			findmybittt();
			if (mybittt.Count == 0)
			{
				return;
			}
			foreach (Rigidbody item in mybittt)
			{
				item.useGravity = false;
			}
			imflyin = true;
			return;
		}
		foreach (Rigidbody item2 in mybittt)
		{
			if ((Object)(object)item2 != (Object)null)
			{
				item2.useGravity = true;
			}
		}
		imflyin = false;
	}

	private void findmybittt()
	{
		mybittt.Clear();
		Controller[] array = Object.FindObjectsOfType<Controller>();
		foreach (Controller val in array)
		{
			if (val.HasControl && !val.isAI)
			{
				Rigidbody[] componentsInChildren = ((Component)val).GetComponentsInChildren<Rigidbody>();
				foreach (Rigidbody item in componentsInChildren)
				{
					mybittt.Add(item);
				}
			}
		}
	}

	private void FixedUpdate()
	{
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		if (!imflyin)
		{
			return;
		}
		refindaggg -= Time.unscaledDeltaTime;
		if (refindaggg <= 0f)
		{
			refindaggg = 1f;
			if (mybittt.Count == 0 || (Object)(object)mybittt[0] == (Object)null)
			{
				findmybittt();
			}
		}
		if (mybittt.Count == 0)
		{
			return;
		}
		float num = 0f;
		float num2 = 0f;
		if (Input.GetKey((KeyCode)119))
		{
			num = flyspeeeed.Value * 2f;
		}
		else if (Input.GetKey((KeyCode)115))
		{
			num = 0f - flyspeeeed.Value * 0.5f;
		}
		if (Input.GetKey((KeyCode)97))
		{
			num2 = flyspeeeed.Value;
		}
		else if (Input.GetKey((KeyCode)100))
		{
			num2 = 0f - flyspeeeed.Value;
		}
		Vector3 velocity = default(Vector3);
		((Vector3)(ref velocity))..ctor(0f, num, num2);
		foreach (Rigidbody item in mybittt)
		{
			if (!((Object)(object)item == (Object)null))
			{
				item.velocity = velocity;
			}
		}
	}
}