using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BoneLib; using Il2CppSLZ.Marrow; using MelonLoader; using UnityEngine; using WeightBalanceMod; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(StructuralWeightMod), "Structural Weight Balance", "1.0.0", "picklerick", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: AssemblyTitle("WeightBalanceMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WeightBalanceMod")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("959d5a07-66f8-4055-9853-c3d0263430ac")] [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 WeightBalanceMod; public class StructuralWeightMod : MelonMod { public override void OnUpdate() { if ((Object)(object)Player.RigManager == (Object)null) { return; } PhysicsRig physicsRig = Player.RigManager.physicsRig; if ((Object)(object)physicsRig == (Object)null) { return; } Hand leftHand = physicsRig.leftHand; GameObject val = ((leftHand != null) ? ((Component)leftHand).gameObject : null); Hand rightHand = physicsRig.rightHand; GameObject val2 = ((rightHand != null) ? ((Component)rightHand).gameObject : null); if (!((Object)(object)val == (Object)null) || !((Object)(object)val2 == (Object)null)) { if ((Object)(object)val2 != (Object)null) { AdjustCenterOfMass(val2); } if ((Object)(object)val != (Object)null) { AdjustCenterOfMass(val); } } } private void AdjustCenterOfMass(object handObj) { if (handObj == null) { return; } MethodInfo method = handObj.GetType().GetMethod("GetComponentInParent", new Type[1] { typeof(Type) }); if (method == null) { return; } Type type = Type.GetType("UnityEngine.Rigidbody, Il2CppUnityEngine.PhysicsModule") ?? Type.GetType("UnityEngine.Rigidbody, UnityEngine.PhysicsModule"); if (type == null) { return; } object obj = method.Invoke(handObj, new object[1] { type }); if (obj == null) { return; } object obj2 = handObj.GetType().GetProperty("transform")?.GetValue(handObj); if (obj2 == null) { return; } object obj3 = obj2.GetType().GetProperty("position")?.GetValue(obj2); if (obj3 == null) { return; } object obj4 = obj.GetType().GetProperty("transform")?.GetValue(obj); if (obj4 == null) { return; } object obj5 = obj4.GetType().GetProperty("worldToLocalMatrix")?.GetValue(obj4); if (obj5 == null) { return; } MethodInfo method2 = obj5.GetType().GetMethod("MultiplyPoint3x4"); if (method2 == null) { return; } object obj6 = method2.Invoke(obj5, new object[1] { obj3 }); if (obj6 != null) { PropertyInfo property = obj.GetType().GetProperty("centerOfMass"); if (property != null) { property.SetValue(obj, obj6); } else { obj.GetType().GetField("centerOfMass", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(obj, obj6); } } } }