Decompiled source of FootKicking v1.1.0

Mods/FootKicking.dll

Decompiled 3 days ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppSLZ.Marrow;
using MelonLoader;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(KickMod), "Leg Kick", "4.4.3", "Idris", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("FootKicking")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FootKicking")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d821f356-8622-4c18-931d-e205529edb39")]
[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")]
public class KickMod : MelonMod
{
	private static bool enabledMod = true;

	private static float duration = 0.18f;

	private static float cooldown = 0.8f;

	private static float force = 1650f;

	private static float forwardMultiplier = 25f;

	private static float upwardMultiplier = 0f;

	private static bool isKicking = false;

	private static float timer = 0f;

	private static float cooldownTimer = 0f;

	private static bool menuCreated = false;

	public override void OnInitializeMelon()
	{
		Hooking.OnLevelLoaded += OnLevelLoaded;
	}

	private void OnLevelLoaded(LevelInfo info)
	{
		if (!menuCreated)
		{
			menuCreated = true;
			SetupMenu();
		}
	}

	private void SetupMenu()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		Page val = Page.Root.CreatePage("Kick Mod", Color.yellow, 0, true);
		val.CreateBool("Enable Kick", Color.white, enabledMod, (Action<bool>)delegate(bool v)
		{
			enabledMod = v;
		});
	}

	public override void OnUpdate()
	{
		if (!enabledMod || (Object)(object)Player.RigManager == (Object)null || (Object)(object)Player.PhysicsRig == (Object)null)
		{
			return;
		}
		cooldownTimer += Time.deltaTime;
		if (!isKicking && cooldownTimer >= cooldown && (Object)(object)Player.RightController != (Object)null && Player.RightController.GetThumbStickDown())
		{
			StartKick();
		}
		if (isKicking)
		{
			timer += Time.deltaTime;
			ApplyKickForce();
			if (timer >= duration)
			{
				EndKick();
			}
		}
	}

	private static void StartKick()
	{
		PhysicsRig physicsRig = Player.PhysicsRig;
		if (!((Object)(object)physicsRig == (Object)null))
		{
			isKicking = true;
			timer = 0f;
			cooldownTimer = 0f;
			physicsRig.PhysicalLegs();
			physicsRig.DisableBallLoco();
		}
	}

	private static void ApplyKickForce()
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_007f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		PhysicsRig physicsRig = Player.PhysicsRig;
		if (!((Object)(object)physicsRig == (Object)null))
		{
			Vector3 forward = ((Component)((Rig)Player.RigManager.physicsRig).m_head).transform.forward;
			forward.y = 0f;
			((Vector3)(ref forward)).Normalize();
			Vector3 val = forward * (force * forwardMultiplier);
			Vector3 val2 = Vector3.up * (force * upwardMultiplier);
			Vector3 val3 = val + val2;
			Vector3 normalized = ((Vector3)(ref val3)).normalized;
			float num = force * 1.2f;
			if ((Object)(object)physicsRig._feetRb != (Object)null)
			{
				physicsRig._feetRb.AddForce(normalized * num, (ForceMode)5);
			}
			if ((Object)(object)physicsRig._kneeRb != (Object)null)
			{
				physicsRig._kneeRb.AddForce(normalized * (num * 0.35f), (ForceMode)5);
			}
		}
	}

	private static void EndKick()
	{
		PhysicsRig physicsRig = Player.PhysicsRig;
		if (!((Object)(object)physicsRig == (Object)null))
		{
			isKicking = false;
			physicsRig.TurnOnRig();
			physicsRig.UnRagdollRig();
			physicsRig.EnableBallLoco();
		}
	}
}