The BepInEx console will not appear when launching like it does for other games on Thunderstore. This is normal (and helps prevent crashes during startup). You can turn it back on in your BepInEx.cfg file.
Decompiled source of TieEmTogether v1.1.0
TieEmTogether.dll
Decompiled 3 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Photon.Pun; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("InventoryPlus")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("InventoryPlus")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c15a98e4-d38c-4e0e-a71d-d8ffa4752dc2")] [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 TieEmTogether; [BepInPlugin("R3dRazor.TieEmTogether", "Tie Em Together", "1.1.0")] [BepInProcess("PEAK.exe")] public class TieEmTogether : BaseUnityPlugin { [CompilerGenerated] private sealed class <Start>d__19 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public TieEmTogether <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Start>d__19(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.CreateCustomHoldPrompt(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WaitForAnyInput>d__22 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Action<string> onBindSelected; public TieEmTogether <>4__this; private float <triggerAxis>5__1; private float <dpadH>5__2; private float <dpadV>5__3; private int <i>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForAnyInput>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; ((BaseUnityPlugin)<>4__this).Logger.LogInfo((object)"Waiting for any controller input..."); break; case 1: <>1__state = -1; break; } <i>5__4 = 0; while (<i>5__4 <= 19) { if (Input.GetKeyDown((KeyCode)(330 + <i>5__4))) { onBindSelected?.Invoke($"JoystickButton{<i>5__4}"); return false; } <i>5__4++; } <triggerAxis>5__1 = Input.GetAxis("3rd Axis"); if (<triggerAxis>5__1 > 0.5f) { onBindSelected?.Invoke("RightTrigger"); return false; } if (<triggerAxis>5__1 < -0.5f) { onBindSelected?.Invoke("LeftTrigger"); return false; } <dpadH>5__2 = Input.GetAxis("DPadHorizontal"); <dpadV>5__3 = Input.GetAxis("DPadVertical"); if (Mathf.Abs(<dpadH>5__2) > 0.5f) { onBindSelected?.Invoke((<dpadH>5__2 > 0f) ? "DPadRight" : "DPadLeft"); return false; } if (Mathf.Abs(<dpadV>5__3) > 0.5f) { onBindSelected?.Invoke((<dpadV>5__3 > 0f) ? "DPadUp" : "DPadDown"); return false; } <>2__current = null; <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const string modGUID = "R3dRazor.TieEmTogether"; private const string modName = "Tie Em Together"; private const string modVersion = "1.1.0"; private const ushort RopeItemID = 65; private const float holdDuration = 2f; private readonly Harmony harmony = new Harmony("R3dRazor.TieEmTogether"); private readonly int instanceId = Environment.TickCount; private GameObject customHoldPromptGO; private Image customHoldPromptFillImage; private bool promptVisible = false; private bool showPromptWarningLogged = false; private bool isHoldingKey = false; private float holdTimer = 0f; private bool actionTriggered = false; private ConfigEntry<bool> enableMaxCap; private ConfigEntry<float> maxRopeLength; private ConfigEntry<KeyCode> combineKey; private ConfigEntry<string> controllerBind; private void Awake() { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown enableMaxCap = ((BaseUnityPlugin)this).Config.Bind<bool>("Rope Combining", "Enable Max Rope Length Cap", false, "Whether the rope length should be capped at a maximum value."); maxRopeLength = ((BaseUnityPlugin)this).Config.Bind<float>("Rope Combining", "Max Rope Length", 60f, "The maximum rope length allowed when combining. Only used if the cap is enabled. Default Game Value is 60"); combineKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "Combine Key", (KeyCode)99, "The key used to hold and trigger the rope combine action."); controllerBind = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "ControllerCombineKey", "None", new ConfigDescription("Controller axis or D-pad input to trigger rope combine. Dropdown supported.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[7] { "DPadRight", "DPadLeft", "DPadUp", "DPadDown", "RightTrigger", "LeftTrigger", "None" }), Array.Empty<object>())); string[] source = new string[7] { "DPadRight", "DPadLeft", "DPadUp", "DPadDown", "RightTrigger", "LeftTrigger", "None" }; if (!source.Contains(controllerBind.Value)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("'" + controllerBind.Value + "' is not a supported controller axis bind. Use dropdown values only.")); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Config loaded."); harmony.PatchAll(); if ((Object)(object)((Component)this).GetComponent<PhotonView>() == (Object)null) { ((Component)this).gameObject.AddComponent<PhotonView>(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Tie Em Together mod loaded!"); } [IteratorStateMachine(typeof(<Start>d__19))] private IEnumerator Start() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Start>d__19(0) { <>4__this = this }; } private void Update() { HandleHoldKey(); } private void HandleHoldKey() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (Time.timeScale == 0f) { if (!IsControllerBindPressed() && promptVisible) { ShowCustomHoldPrompt(show: false); } return; } Player localPlayer = Player.localPlayer; if (!CanPerformCombine(localPlayer) || !HasAtLeastTwoRopes(localPlayer)) { if (promptVisible) { ShowCustomHoldPrompt(show: false); } } else if (Input.GetKey(combineKey.Value) || IsControllerBindPressed()) { if (!isHoldingKey) { isHoldingKey = true; holdTimer = 0f; actionTriggered = false; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Started holding key to combine ropes..."); ShowCustomHoldPrompt(show: true); } if (actionTriggered) { return; } holdTimer += Time.deltaTime; UpdateCustomHoldPromptFill(holdTimer / 2f); if (!(holdTimer >= 2f)) { return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hold duration met — attempting to combine ropes."); if (PhotonNetwork.IsMasterClient) { TryCombineRopes(localPlayer); } else { PhotonView component = ((Component)localPlayer).GetComponent<PhotonView>(); PhotonView component2 = ((Component)this).GetComponent<PhotonView>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component != (Object)null) { component2.RPC("RPC_TryCombineRopes", (RpcTarget)2, new object[1] { component.ViewID }); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not send RPC_TryCombineRopes — missing PhotonView."); } } actionTriggered = true; ShowCustomHoldPrompt(show: false); } else { if (isHoldingKey && !actionTriggered) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Canceled rope combine — key released early."); } isHoldingKey = false; holdTimer = 0f; actionTriggered = false; ShowCustomHoldPrompt(show: false); } } [IteratorStateMachine(typeof(<WaitForAnyInput>d__22))] private IEnumerator WaitForAnyInput(Action<string> onBindSelected) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitForAnyInput>d__22(0) { <>4__this = this, onBindSelected = onBindSelected }; } private bool IsControllerBindPressed() { string value = controllerBind.Value; if (string.IsNullOrEmpty(value) || value == "None") { return false; } return value switch { "RightTrigger" => Input.GetAxis("3rd Axis") > 0.5f, "LeftTrigger" => Input.GetAxis("3rd Axis") < -0.5f, "DPadRight" => Input.GetAxis("DPadHorizontal") > 0.5f, "DPadLeft" => Input.GetAxis("DPadHorizontal") < -0.5f, "DPadUp" => Input.GetAxis("DPadVertical") > 0.5f, "DPadDown" => Input.GetAxis("DPadVertical") < -0.5f, _ => false, }; } private bool IsHoldingRope(Player player) { if ((Object)(object)player == (Object)null || player.tempFullSlot == null || player.tempFullSlot.IsEmpty()) { return false; } return (Object)(object)player.tempFullSlot.prefab != (Object)null && player.tempFullSlot.prefab.itemID == 65; } private void CreateCustomHoldPrompt() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[{instanceId}] CreateCustomHoldPrompt called."); if ((Object)(object)customHoldPromptGO != (Object)null) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[{instanceId}] Custom hold prompt already created."); return; } GameObject val = new GameObject("TieEmTogetherCanvas"); Object.DontDestroyOnLoad((Object)(object)val); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 1000; val.AddComponent<CanvasScaler>(); val.AddComponent<GraphicRaycaster>(); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[{instanceId}] Canvas created."); customHoldPromptGO = new GameObject("HoldPrompt"); customHoldPromptGO.transform.SetParent(val.transform); ((BaseUnityPlugin)this).Logger.LogInfo((object)"HoldPrompt GameObject created."); RectTransform val3 = customHoldPromptGO.AddComponent<RectTransform>(); val3.sizeDelta = new Vector2(200f, 30f); Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(0.5f, 0.5f); val3.anchorMax = val4; val3.anchorMin = val4; val3.anchoredPosition = Vector2.zero; Image val5 = customHoldPromptGO.AddComponent<Image>(); ((Graphic)val5).color = new Color(0f, 0f, 0f, 0.6f); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Background image added."); GameObject val6 = new GameObject("Fill"); val6.transform.SetParent(customHoldPromptGO.transform); RectTransform val7 = val6.AddComponent<RectTransform>(); val7.anchorMin = new Vector2(0f, 0f); val7.anchorMax = new Vector2(0f, 1f); val7.pivot = new Vector2(0f, 0.5f); val7.anchoredPosition = Vector2.zero; val7.sizeDelta = new Vector2(0f, 30f); customHoldPromptFillImage = val6.AddComponent<Image>(); ((Graphic)customHoldPromptFillImage).color = Color.green; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Fill image created."); customHoldPromptGO.SetActive(false); promptVisible = false; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Custom hold prompt created and hidden."); } private void UpdateCustomHoldPromptFill(float fillAmount) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)customHoldPromptFillImage == (Object)null)) { RectTransform rectTransform = ((Graphic)customHoldPromptFillImage).rectTransform; rectTransform.sizeDelta = new Vector2(200f * Mathf.Clamp01(fillAmount), 30f); } } private void ShowCustomHoldPrompt(bool show) { if ((Object)(object)customHoldPromptGO == (Object)null) { if (!showPromptWarningLogged) { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"[{instanceId}] ShowCustomHoldPrompt called but customHoldPromptGO is null"); showPromptWarningLogged = true; } } else if (promptVisible != show) { ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[{instanceId}] Showing prompt: {show}"); customHoldPromptGO.SetActive(show); if (!show) { UpdateCustomHoldPromptFill(0f); } promptVisible = show; showPromptWarningLogged = false; } } private bool CanPerformCombine(Player player) { if ((Object)(object)player == (Object)null || player.itemSlots == null) { return false; } Character character = player.character; if ((Object)(object)character == (Object)null || (Object)(object)character.data == (Object)null) { return false; } return !character.data.dead && !character.data.fullyPassedOut && !character.data.isClimbingAnything; } private bool HasAtLeastTwoRopes(Player player) { if (player?.itemSlots == null) { return false; } int num = player.itemSlots.Count((ItemSlot slot) => slot != null && !slot.IsEmpty() && (Object)(object)slot.prefab != (Object)null && slot.prefab.itemID == 65); return num >= 2; } [PunRPC] private void RPC_TryCombineRopes(int viewID) { PhotonView val = PhotonView.Find(viewID); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("RPC_TryCombineRopes: PhotonView not found for ViewID: " + viewID)); return; } Player component = ((Component)val).GetComponent<Player>(); if ((Object)(object)component == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"RPC_TryCombineRopes: Player not found on PhotonView."); } else { TryCombineRopes(component); } } private void TryCombineRopes(Player player) { if ((Object)(object)player == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Player is null!"); return; } ItemSlot[] array = player.itemSlots.Where((ItemSlot slot) => slot != null && !slot.IsEmpty() && (Object)(object)slot.prefab != (Object)null && slot.prefab.itemID == 65).Take(2).ToArray(); if (array.Length < 2) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Less than two ropes found. Cannot combine."); return; } ItemSlot val = array[0]; ItemSlot val2 = array[1]; FloatItemData val3 = default(FloatItemData); FloatItemData val4 = default(FloatItemData); if (!val.data.TryGetDataEntry<FloatItemData>((DataEntryKey)10, ref val3) || !val2.data.TryGetDataEntry<FloatItemData>((DataEntryKey)10, ref val4)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"One of the ropes is missing Fuel data."); return; } float value = val3.Value; float value2 = val4.Value; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Lengths before combine: {value} + {value2}"); float num = value + value2; if (enableMaxCap.Value) { num = Mathf.Min(num, maxRopeLength.Value); } val2.EmptyOut(); val3.Value = num; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"Combined two ropes: {value} + {value2} => {num}"); } }