using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using MelonLoader;
using NPCControlMod;
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(Main), "NPC Control", "1.0.0", "Natino", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("NPC Control")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("NPC Control")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d3ee4f8-098b-4c5e-a1ac-df2bdcdb66a9")]
[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 NPCControlMod;
public class Main : MelonMod
{
private const float Radius = 35f;
private bool isAttracted = false;
public override void OnInitializeMelon()
{
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)
//IL_003b: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
Page val = Page.Root.CreatePage("NPC Control", Color.red, 0, true);
val.CreateFunction("Attracted to you", Color.green, (Action)ToggleAttracted);
val.CreateFunction("Smash NPCs Together", Color.red, (Action)CommandAttack);
val.CreateFunction("Launch Upward", Color.white, (Action)CommandLaunch);
val.CreateFunction("Force Push", Color.yellow, (Action)CommandForcePush);
val.CreateFunction("Toggle Zero Gravity", Color.cyan, (Action)CommandZeroGravity);
val.CreateFunction("Tornado Spin", Color.blue, (Action)CommandSpin);
val.CreateFunction("Toggle Freeze (Stasis)", Color.magenta, (Action)CommandFreeze);
}
private void ToggleAttracted()
{
isAttracted = !isAttracted;
}
public override void OnUpdate()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: 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_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
if (!isAttracted)
{
return;
}
Vector3 playerPosition = GetPlayerPosition();
if (playerPosition == Vector3.zero)
{
return;
}
foreach (Rigidbody nearbyNPCRigidbody in GetNearbyNPCRigidbodies())
{
if (!((Object)(object)nearbyNPCRigidbody == (Object)null))
{
Vector3 val = playerPosition - ((Component)nearbyNPCRigidbody).transform.position;
float magnitude = ((Vector3)(ref val)).magnitude;
if (magnitude > 2f && magnitude < 35f)
{
Vector3 normalized = ((Vector3)(ref val)).normalized;
nearbyNPCRigidbody.AddForce(normalized * 8f, (ForceMode)5);
}
}
}
}
private Vector3 GetPlayerPosition()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Player.RigManager != (Object)null && (Object)(object)Player.RigManager.physicsRig != (Object)null)
{
return ((Rig)Player.RigManager.physicsRig).m_pelvis.position;
}
return Vector3.zero;
}
private List<Rigidbody> GetNearbyNPCRigidbodies()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
List<Rigidbody> list = new List<Rigidbody>();
Vector3 playerPosition = GetPlayerPosition();
if (playerPosition == Vector3.zero)
{
return list;
}
Rigidbody[] array = Il2CppArrayBase<Rigidbody>.op_Implicit(Object.FindObjectsOfType<Rigidbody>());
Rigidbody[] array2 = array;
foreach (Rigidbody val in array2)
{
if (!((Object)(object)val == (Object)null) && (!((Object)(object)Player.RigManager != (Object)null) || !((Object)(object)((Component)val).transform.root == (Object)(object)((Component)Player.RigManager).transform)) && !((Object)(object)((Component)((Component)val).transform.root).GetComponentInChildren<Animator>() == (Object)null))
{
float num = Vector3.Distance(playerPosition, ((Component)val).transform.position);
if (num <= 35f)
{
list.Add(val);
}
}
}
return list;
}
private void CommandAttack()
{
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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)
List<Rigidbody> nearbyNPCRigidbodies = GetNearbyNPCRigidbodies();
foreach (Rigidbody item in nearbyNPCRigidbodies)
{
Rigidbody val = null;
float num = float.MaxValue;
foreach (Rigidbody item2 in nearbyNPCRigidbodies)
{
if (!((Object)(object)item2 == (Object)(object)item) && !((Object)(object)((Component)item2).transform.root == (Object)(object)((Component)item).transform.root))
{
float num2 = Vector3.Distance(((Component)item).transform.position, ((Component)item2).transform.position);
if (num2 < num)
{
num = num2;
val = item2;
}
}
}
if ((Object)(object)val != (Object)null)
{
Vector3 val2 = ((Component)val).transform.position - ((Component)item).transform.position;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
item.AddForce(normalized * 20f, (ForceMode)2);
}
}
}
private void CommandLaunch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
foreach (Rigidbody nearbyNPCRigidbody in GetNearbyNPCRigidbodies())
{
nearbyNPCRigidbody.AddForce(Vector3.up * 25f, (ForceMode)2);
}
}
private void CommandForcePush()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
Vector3 playerPosition = GetPlayerPosition();
if (playerPosition == Vector3.zero)
{
return;
}
foreach (Rigidbody nearbyNPCRigidbody in GetNearbyNPCRigidbodies())
{
Vector3 val = ((Component)nearbyNPCRigidbody).transform.position - playerPosition;
Vector3 normalized = ((Vector3)(ref val)).normalized;
normalized.y = 0.3f;
nearbyNPCRigidbody.AddForce(normalized * 30f, (ForceMode)2);
}
}
private void CommandZeroGravity()
{
foreach (Rigidbody nearbyNPCRigidbody in GetNearbyNPCRigidbodies())
{
nearbyNPCRigidbody.useGravity = !nearbyNPCRigidbody.useGravity;
}
}
private void CommandSpin()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
foreach (Rigidbody nearbyNPCRigidbody in GetNearbyNPCRigidbodies())
{
nearbyNPCRigidbody.AddTorque(Vector3.up * 400f, (ForceMode)2);
}
}
private void CommandFreeze()
{
foreach (Rigidbody nearbyNPCRigidbody in GetNearbyNPCRigidbodies())
{
nearbyNPCRigidbody.isKinematic = !nearbyNPCRigidbody.isKinematic;
}
}
}