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 Fall_impact_damage;
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(Fallimpactdamage), "Fall-impact damage", "1.0.0", "CooladTheGreat", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("Fall-impact damage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Fall-impact damage")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("71485f96-704f-479a-a4bf-bf6a5f150321")]
[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 Fall_impact_damage;
public class Fallimpactdamage : MelonMod
{
public static bool enabled = true;
public static float damageMultiplier = 1f;
public static float minDamageThreshold = 5.5f;
public static float maxDamageThreshold = 20f;
public static float cooldown = 1f;
private Rigidbody trackingBody;
private Vector3 lastVelocity = Vector3.zero;
private float currentCooldown = 0f;
public override void OnInitializeMelon()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
Hooking.OnUIRigCreated += delegate
{
trackingBody = Player.PhysicsRig.physG._rb;
};
Page val = Page.Root.CreatePage("Impact Damage", Color.red, 0, true);
val.CreateBool("Enabled", Color.green, enabled, (Action<bool>)delegate(bool b)
{
enabled = b;
});
val.CreateFloat("Damage Multiplier", Color.yellow, damageMultiplier, 0.1f, 0.5f, 5f, (Action<float>)delegate(float f)
{
damageMultiplier = f;
});
val.CreateFloat("Min Threshold", Color.blue, minDamageThreshold, 2f, 5f, 15f, (Action<float>)delegate(float f)
{
minDamageThreshold = f;
});
val.CreateFloat("Max Threshold", Color.red, maxDamageThreshold, 10f, 20f, 50f, (Action<float>)delegate(float f)
{
maxDamageThreshold = f;
});
}
public override void OnUpdate()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
if (!enabled || (Object)(object)trackingBody == (Object)null)
{
return;
}
if (currentCooldown > 0f)
{
currentCooldown -= Time.deltaTime;
return;
}
Vector3 velocity = trackingBody.velocity;
Vector3 val = velocity - lastVelocity;
float magnitude = ((Vector3)(ref val)).magnitude;
if (magnitude > minDamageThreshold)
{
float num = Mathf.Clamp((magnitude - minDamageThreshold) * damageMultiplier, 1f, 100f);
Player.RigManager.health.TAKEDAMAGE(num);
currentCooldown = cooldown;
}
lastVelocity = velocity;
}
}