Latest versions of MelonLoader are known to have issues with some games. Use version 0.5.4 until the issue has been fixed!
Decompiled source of Weldgun v3.0.0
Mods/WeldGun.dll
Decompiled 3 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using MelonLoader; using ModThatIsNotMod; using StressLevelZero.Interaction; using StressLevelZero.Pool; using StressLevelZero.Props.Weapons; using StressLevelZero.SFX; using TMPro; using UnhollowerRuntimeLib; using UnityEngine; using WeldGunMod; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(Base), "WeldGun", "3.0.0", "L4rs", null)] [assembly: MelonGame("Stress Level Zero", "BONEWORKS")] [assembly: AssemblyTitle("WeldGun")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("WeldGun")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("14243dda-90bb-4f41-aaef-c189e425a403")] [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 WeldGunMod; public class Base : MelonMod { public override void OnApplicationStart() { ClassInjector.RegisterTypeInIl2Cpp<WeldingGun>(); Action<GameObject, Hand> action = delegate(GameObject go, Hand hand) { if (((Object)go.transform.root).name.Contains("WPN_Tool_GravityWelder") && (Object)(object)((Component)go.transform.root).gameObject.GetComponent<WeldingGun>() == (Object)null) { ((Component)go.transform.root).gameObject.AddComponent<WeldingGun>(); } }; Hooking.OnGrabObject += action; } } internal class WeldingGun : MonoBehaviour { private enum WeldType { Fixed, Spring, Hinge, Unweld } private TextMeshPro ScreenText; private InteractableHost interactableHost; private GravGunSFX SFX; private Transform FirePoint; private Transform BlastLine; private Rigidbody FirstRB = null; private Rigidbody SecondRB = null; private WeldType CurrentWeldType = WeldType.Fixed; public WeldingGun(IntPtr intPtr) : base(intPtr) { } private void Awake() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) interactableHost = ((Component)this).gameObject.GetComponent<InteractableHost>(); SFX = ((Component)this).gameObject.GetComponent<GravGunSFX>(); FirePoint = ((Component)this).transform.Find("FirePoint"); BlastLine = ((Component)this).transform.Find("Effect Elements").Find("BlastLine"); ((Behaviour)((Component)this).gameObject.GetComponent<GravityGun>()).enabled = false; ((Component)((Component)this).transform.Find("GravityManipulator")).gameObject.active = false; GameObject val = new GameObject("WeldText"); ScreenText = val.AddComponent<TextMeshPro>(); ((TMP_Text)ScreenText).text = ""; ((TMP_Text)ScreenText).alignment = (TextAlignmentOptions)514; ScreenText.transform.parent = ((Component)this).transform.Find("tool_GravityWelder").Find("canvas_Screen"); ((Transform)((TMP_Text)ScreenText).rectTransform).localPosition = new Vector3(0f, 0f, -1.1f); ((Transform)((TMP_Text)ScreenText).rectTransform).localRotation = Quaternion.identity; ((TMP_Text)ScreenText).rectTransform.sizeDelta = ((TMP_Text)ScreenText).rectTransform.GetParentSize(); ((TMP_Text)ScreenText).fontSize = 0.2f; ((Behaviour)ScreenText).enabled = true; } private void Update() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00ea: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)FirstRB != (Object)null && (Object)(object)SecondRB != (Object)null) { Weld(FirstRB, SecondRB, CurrentWeldType); FirstRB = (SecondRB = null); } if ((Object)interactableHost.GetHand(0) != (Object)null) { RaycastHit val = default(RaycastHit); if (interactableHost.GetHand(0).controller.GetPrimaryInteractionButtonDown() && Physics.Raycast(FirePoint.position, FirePoint.forward, ref val, float.PositiveInfinity)) { if ((Object)(object)BlastLine != (Object)null) { ((Component)BlastLine).gameObject.active = true; } if ((Object)SFX != (Object)null) { SFX.GravFire(); } interactableHost.GetHand(0).controller.haptor.Haptic_WepFire(100f); if ((Object)(object)((RaycastHit)(ref val)).rigidbody != (Object)null && (Object)(object)FirstRB == (Object)null) { FirstRB = ((RaycastHit)(ref val)).rigidbody; PoolSpawner.SpawnSparksBlast(((RaycastHit)(ref val)).point, Quaternion.LookRotation(((Component)this).transform.position)); } else if ((Object)(object)((RaycastHit)(ref val)).rigidbody != (Object)null && (Object)(object)SecondRB == (Object)null) { SecondRB = ((RaycastHit)(ref val)).rigidbody; PoolSpawner.SpawnSparksBlast(((RaycastHit)(ref val)).point, Quaternion.LookRotation(((Component)this).transform.position)); } } if (interactableHost.GetHand(0).controller.GetThumbStickDown() || interactableHost.GetHand(0).controller.GetTouchpadDown() || interactableHost.GetHand(0).controller.GetBButtonDown()) { CurrentWeldType++; if ((int)CurrentWeldType > Enum.GetNames(typeof(WeldType)).Length - 1) { CurrentWeldType = WeldType.Fixed; } } } ((TMP_Text)ScreenText).text = $"{Enum.GetName(typeof(WeldType), CurrentWeldType)} \n {Convert.ToInt32((Object)(object)FirstRB != (Object)null) + Convert.ToInt32((Object)(object)SecondRB != (Object)null)}/2"; } private void Weld(Rigidbody RB1, Rigidbody RB2, WeldType type) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) switch (type) { case WeldType.Fixed: { FixedJoint val = ((Component)RB1).gameObject.AddComponent<FixedJoint>(); ((Joint)val).connectedBody = RB2; break; } case WeldType.Spring: { SpringJoint val3 = ((Component)RB1).gameObject.AddComponent<SpringJoint>(); ((Joint)val3).connectedBody = RB2; val3.spring *= 20f; break; } case WeldType.Hinge: { HingeJoint val2 = ((Component)RB1).gameObject.AddComponent<HingeJoint>(); ((Joint)val2).connectedBody = RB2; ((Joint)val2).axis = Vector3.one; break; } case WeldType.Unweld: foreach (Joint component in ((Component)RB1).gameObject.GetComponents<Joint>()) { if ((Object)(object)component.connectedBody == (Object)(object)RB2) { Object.Destroy((Object)(object)component); } } { foreach (Joint component2 in ((Component)RB2).gameObject.GetComponents<Joint>()) { if ((Object)(object)component2.connectedBody == (Object)(object)RB1) { Object.Destroy((Object)(object)component2); } } break; } } } }