using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using Microsoft.CodeAnalysis; using ScrapIsFuel.Config; using ScrapIsFuel.Input; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.PhysicsModule")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ScrapIsFuel")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("MANKIND IS DEAD. SCRAP IS FUEL. MOONS ARE FULL.")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0")] [assembly: AssemblyProduct("ScrapIsFuel")] [assembly: AssemblyTitle("ScrapIsFuel")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ScrapIsFuel { [BepInPlugin("ScrapIsFuel", "ScrapIsFuel", "2.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ScrapIsFuel : BaseUnityPlugin { internal static ManualLogSource Logger; internal static UltraInputs UltraInputsInstance; internal static UltraConfigs Config; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; UltraInputsInstance = new UltraInputs(); Config = new UltraConfigs(((BaseUnityPlugin)this).Config); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "ScrapIsFuel"); Logger.LogInfo((object)"Plugin ScrapIsFuel is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "ScrapIsFuel"; public const string PLUGIN_NAME = "ScrapIsFuel"; public const string PLUGIN_VERSION = "2.0.0"; } } namespace ScrapIsFuel.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { private static bool sliding = false; private static bool slideJumped = false; private static float slideTimer = ScrapIsFuel.Config.MOMENTUM_PERIOD.Value; private static bool slamming = false; private static float slamHeight = 0f; private static float slamTimer = ScrapIsFuel.Config.SLAM_JUMP_PERIOD.Value; private static bool slamStorage = false; private static bool dashing = false; private static float dashTimer = 0f; private static Vector3 dashVector; private static int wallJumps = 0; private static float wallClingTimer = 0f; private static float floatTimer = 0f; private static float previousY; private static Vector3 momentumVector; [HarmonyPatch("Awake")] [HarmonyPostfix] private static void AwakePostfix() { IngamePlayerSettings.Instance.playerInput.actions.FindAction("Crouch", false).Disable(); } [HarmonyPatch("Jump_performed")] [HarmonyTranspiler] [HarmonyPriority(800)] public static IEnumerable Jump_performedTranspiler(IEnumerable instructions) { List list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (((object)list[i]).ToString().Contains("0.08")) { list.RemoveRange(i - 3, 9); } } return list.AsEnumerable(); } private static float directionsToRotation(bool forward, bool left, bool back, bool right) { float num = 0f; if (forward) { if (left) { num -= 45f; } if (right) { num += 45f; } } else if (back) { num += 180f; if (left) { num += 45f; } if (right) { num -= 45f; } } else { if (left) { num -= 90f; } if (right) { num += 90f; } } return num; } [HarmonyPatch("Update")] [HarmonyPostfix] public static void UpdatePostfix(PlayerControllerB __instance) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0653: Unknown result type (might be due to invalid IL or missing references) //IL_059f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_074c: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_086e: Unknown result type (might be due to invalid IL or missing references) //IL_0873: Unknown result type (might be due to invalid IL or missing references) //IL_0d51: Unknown result type (might be due to invalid IL or missing references) //IL_07bd: Unknown result type (might be due to invalid IL or missing references) //IL_07c2: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Unknown result type (might be due to invalid IL or missing references) //IL_093d: Unknown result type (might be due to invalid IL or missing references) //IL_0942: Unknown result type (might be due to invalid IL or missing references) //IL_0946: Unknown result type (might be due to invalid IL or missing references) //IL_095b: Unknown result type (might be due to invalid IL or missing references) //IL_0960: Unknown result type (might be due to invalid IL or missing references) //IL_0981: Unknown result type (might be due to invalid IL or missing references) //IL_0986: Unknown result type (might be due to invalid IL or missing references) //IL_098b: Unknown result type (might be due to invalid IL or missing references) //IL_0990: Unknown result type (might be due to invalid IL or missing references) //IL_0995: Unknown result type (might be due to invalid IL or missing references) //IL_09a0: Unknown result type (might be due to invalid IL or missing references) //IL_09aa: Unknown result type (might be due to invalid IL or missing references) //IL_09af: Unknown result type (might be due to invalid IL or missing references) //IL_0812: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Unknown result type (might be due to invalid IL or missing references) //IL_0a5a: Unknown result type (might be due to invalid IL or missing references) //IL_0a5f: Unknown result type (might be due to invalid IL or missing references) //IL_0a75: Unknown result type (might be due to invalid IL or missing references) //IL_0a7a: Unknown result type (might be due to invalid IL or missing references) //IL_0a7c: Unknown result type (might be due to invalid IL or missing references) //IL_0a86: Unknown result type (might be due to invalid IL or missing references) //IL_0a8b: Unknown result type (might be due to invalid IL or missing references) //IL_0a90: Unknown result type (might be due to invalid IL or missing references) //IL_0a95: Unknown result type (might be due to invalid IL or missing references) //IL_0a9a: Unknown result type (might be due to invalid IL or missing references) //IL_0c40: Unknown result type (might be due to invalid IL or missing references) //IL_0c45: Unknown result type (might be due to invalid IL or missing references) //IL_0abc: Unknown result type (might be due to invalid IL or missing references) //IL_0abe: Unknown result type (might be due to invalid IL or missing references) //IL_0ac5: Unknown result type (might be due to invalid IL or missing references) //IL_0adf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae9: Unknown result type (might be due to invalid IL or missing references) //IL_0b0d: Unknown result type (might be due to invalid IL or missing references) //IL_0b06: Unknown result type (might be due to invalid IL or missing references) //IL_0b8c: Unknown result type (might be due to invalid IL or missing references) //IL_0b91: Unknown result type (might be due to invalid IL or missing references) //IL_0b9c: Unknown result type (might be due to invalid IL or missing references) //IL_0bb8: Unknown result type (might be due to invalid IL or missing references) //IL_0bcd: Unknown result type (might be due to invalid IL or missing references) //IL_0bd7: Unknown result type (might be due to invalid IL or missing references) //IL_0bdc: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsOwner || !__instance.isPlayerControlled) { return; } __instance.takingFallDamage = ScrapIsFuel.Config.FALL_DAMAGE_ENABLED.Value; momentumVector.y = 0f; if (!ScrapIsFuel.Config.MOMENTUM_ENABLED.Value) { momentumVector = Vector3.zero; } dashTimer += Time.deltaTime; if (dashing) { if (__instance.thisController.isGrounded && __instance.playerActions.FindAction("Jump", false).WasPressedThisFrame()) { dashTimer = ScrapIsFuel.Config.DASH_DURATION.Value; dashing = false; IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).Enable(); } else if (dashTimer < ScrapIsFuel.Config.DASH_DURATION.Value && (!__instance.thisController.isGrounded || !__instance.playerActions.FindAction("Move", false).IsPressed())) { __instance.thisController.Move(dashVector * Time.deltaTime); } else { if (!__instance.thisController.isGrounded || __instance.playerActions.FindAction("Move", false).IsPressed()) { momentumVector = Vector3.zero; } dashing = false; IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).Enable(); } } if (!__instance.isClimbingLadder && !__instance.inTerminalMenu && !__instance.thisController.isGrounded && (momentumVector.x != 0f || momentumVector.z != 0f)) { __instance.thisController.Move(momentumVector * Time.deltaTime); } bool flag = Physics.Raycast(new Ray(((Component)__instance).transform.position + Vector3.up * 2.3f, -((Component)__instance).transform.right), ref __instance.hit, 0.53f, __instance.walkableSurfacesNoPlayersMask, (QueryTriggerInteraction)1); bool flag2 = Physics.Raycast(new Ray(((Component)__instance).transform.position + Vector3.up * 2.3f, ((Component)__instance).transform.right), ref __instance.hit, 0.53f, __instance.walkableSurfacesNoPlayersMask, (QueryTriggerInteraction)1); bool flag3 = Physics.Raycast(new Ray(((Component)__instance).transform.position + Vector3.up * 2.3f, -((Component)__instance).transform.forward), ref __instance.hit, 0.53f, __instance.walkableSurfacesNoPlayersMask, (QueryTriggerInteraction)1); bool flag4 = Physics.Raycast(new Ray(((Component)__instance).transform.position + Vector3.up * 2.3f, ((Component)__instance).transform.forward), ref __instance.hit, 0.53f, __instance.walkableSurfacesNoPlayersMask, (QueryTriggerInteraction)1); Vector2 val = __instance.playerActions.FindAction("Move", false).ReadValue(); bool flag5 = val.y > 0f; bool flag6 = val.x < 0f; bool flag7 = val.y < 0f; bool flag8 = val.x > 0f; if (flag4 || flag || flag3 || flag2) { if (ScrapIsFuel.Config.WALL_CLINGING_ENABLED.Value && ((flag4 && flag5) || (flag && flag6) || (flag3 && flag7) || (flag2 && flag8))) { momentumVector = Vector3.Lerp(momentumVector, Vector3.zero, Time.deltaTime * 5f); if (((Component)__instance).transform.position.y < previousY) { wallClingTimer += Time.deltaTime; __instance.fallValue /= Mathf.Lerp(ScrapIsFuel.Config.WALL_CLINGING_SLOWDOWN.Value, 1f, wallClingTimer); } } if (!sliding && ScrapIsFuel.Config.WALL_JUMPING_ENABLED.Value && __instance.playerActions.FindAction("Jump", false).WasPressedThisFrame() && !__instance.thisController.isGrounded && wallJumps < ScrapIsFuel.Config.MAX_WALL_JUMPS.Value) { if (ScrapIsFuel.Config.SLAM_STORAGE_ENABLED.Value && ScrapIsFuel.UltraInputsInstance.SlamNSlide.WasPressedThisFrame()) { slamStorage = true; slamTimer = 0f; slamHeight = ScrapIsFuel.Config.SLAM_STORAGE_HEIGHT.Value; } wallJumps++; ((MonoBehaviour)__instance).StartCoroutine(WallJump(__instance, flag4, flag, flag3, flag2)); } } else { wallClingTimer = 0f; } if (__instance.fallValue >= 0f) { floatTimer = 0f; } if (slamming) { if (__instance.thisController.isGrounded) { slamming = false; slamTimer = 0f; slamHeight = Mathf.Min(slamHeight - ((Component)__instance).transform.position.y, (float)(ScrapIsFuel.Config.SLAM_STORAGE_HEIGHT.Value - 50)); __instance.takingFallDamage = false; if (!sliding) { IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).Enable(); } IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).Enable(); } else { __instance.takingFallDamage = false; __instance.thisController.Move(Vector3.down * (float)ScrapIsFuel.Config.SLAM_AMPLITUDE.Value * Time.deltaTime); } } else if (((Component)__instance).transform.position.y < previousY) { floatTimer += Time.deltaTime * 5f; __instance.fallValue = Mathf.Clamp(__instance.fallValue / Mathf.Lerp(1.01f, 1f, Math.Min(Mathf.Log(floatTimer, 2f) + 0.5f, 1f)), (float)ScrapIsFuel.Config.MAX_FALL_VALUE.Value, float.PositiveInfinity); } if (__instance.thisController.isGrounded) { slamTimer += Time.deltaTime; if (!sliding) { slideTimer += Time.deltaTime; } if (__instance.playerActions.FindAction("Move", false).IsPressed()) { momentumVector = Vector3.zero; } wallJumps = 0; if (slamTimer >= ScrapIsFuel.Config.SLAM_JUMP_PERIOD.Value) { slamStorage = false; } if (dashTimer >= ScrapIsFuel.Config.MOMENTUM_PERIOD.Value && slideTimer >= ScrapIsFuel.Config.MOMENTUM_PERIOD.Value) { momentumVector = Vector3.Lerp(momentumVector, Vector3.zero, Time.deltaTime * 5f); if (Mathf.Abs(momentumVector.x) < 0.1f && Mathf.Abs(momentumVector.z) < 0.1f) { momentumVector = Vector3.zero; } } } if (!slideJumped && slideTimer < ScrapIsFuel.Config.MOMENTUM_PERIOD.Value && !__instance.thisController.isGrounded) { slideJumped = true; momentumVector *= ScrapIsFuel.Config.SLIDE_JUMP_MULTIPLIER.Value; } if (!__instance.isClimbingLadder && !__instance.inTerminalMenu) { if (ScrapIsFuel.Config.DASH_ENABLED.Value && __instance.sprintMeter >= ScrapIsFuel.Config.DASH_STAMINA.Value && ScrapIsFuel.UltraInputsInstance.Dash.WasPressedThisFrame()) { dashing = true; slamming = false; IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).Disable(); __instance.sprintMeter = Mathf.Clamp(__instance.sprintMeter - ScrapIsFuel.Config.DASH_STAMINA.Value, 0f, 1f); Vector3 forward = ((Component)__instance.gameplayCamera).transform.forward; dashVector = ((Vector3)(ref forward)).normalized * (float)ScrapIsFuel.Config.DASH_AMPLITUDE.Value; dashVector.y = 0f; dashVector = Quaternion.AngleAxis(directionsToRotation(flag5, flag6, flag7, flag8), Vector3.up) * dashVector; __instance.thisController.Move(dashVector * Time.deltaTime); momentumVector.x = dashVector.x * ScrapIsFuel.Config.DASH_MOMENTUM.Value; momentumVector.z = dashVector.z * ScrapIsFuel.Config.DASH_MOMENTUM.Value; dashTimer = 0f; } else if (ScrapIsFuel.UltraInputsInstance.SlamNSlide.WasPressedThisFrame()) { if (ScrapIsFuel.Config.SLIDE_ENABLED.Value && __instance.thisController.isGrounded) { Vector3 forward2 = ((Component)__instance.gameplayCamera).transform.forward; forward2.y = 0f; ((Vector3)(ref forward2)).Normalize(); momentumVector = Quaternion.AngleAxis(Vector3.SignedAngle(momentumVector, forward2, Vector3.up), Vector3.up) * momentumVector; if (slamTimer < ScrapIsFuel.Config.SLAM_JUMP_PERIOD.Value) { momentumVector = forward2; ((MonoBehaviour)__instance).StartCoroutine(Slide(__instance, momentumVector * Mathf.Max(slamHeight - 20f, 2f) / 2f)); } else { ((MonoBehaviour)__instance).StartCoroutine(Slide(__instance, slideJumped ? momentumVector : Vector3.zero)); slideJumped = false; } } else if (!slamming && !slamStorage) { IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).Disable(); IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).Disable(); slamming = true; momentumVector = Vector3.zero; slamHeight = ((Component)__instance).transform.position.y; __instance.takingFallDamage = false; __instance.thisController.Move(Vector3.down * (float)ScrapIsFuel.Config.SLAM_AMPLITUDE.Value * Time.deltaTime); } } else if (!sliding && __instance.thisController.isGrounded && __instance.playerActions.FindAction("Jump", false).WasPressedThisFrame()) { if (slamTimer < ScrapIsFuel.Config.SLAM_JUMP_PERIOD.Value) { momentumVector = Vector3.zero; ((MonoBehaviour)__instance).StartCoroutine(ExtendJump(__instance, Mathf.Lerp(0f, ScrapIsFuel.Config.SLAM_JUMP_MAX_DURATION.Value, Mathf.Min(slamHeight / (float)ScrapIsFuel.Config.SLAM_JUMP_DURATION_DIVISOR.Value + ScrapIsFuel.Config.SLAM_JUMP_DURATION_OFFSET.Value, 1f)), slamStorage ? ((float)ScrapIsFuel.Config.SLAM_STORAGE_FORCE.Value) : Mathf.Lerp((float)ScrapIsFuel.Config.SLAM_JUMP_FORCE_MIN.Value, (float)ScrapIsFuel.Config.SLAM_JUMP_FORCE_MAX.Value, Mathf.Min(new float[1] { slamHeight / (float)ScrapIsFuel.Config.SLAM_JUMP_FORCE_DIVISOR.Value + ScrapIsFuel.Config.SLAM_JUMP_FORCE_OFFSET.Value })))); slamStorage = false; } else { ((MonoBehaviour)__instance).StartCoroutine(ExtendJump(__instance, ScrapIsFuel.Config.JUMP_DURATION.Value, ScrapIsFuel.Config.JUMP_FORCE.Value)); } } } previousY = ((Component)__instance).transform.position.y; } public static IEnumerator ExtendJump(PlayerControllerB instance, float duration, float startForce) { slamTimer = ScrapIsFuel.Config.SLAM_JUMP_PERIOD.Value; float timeElapsed = 0f; while (!slamming && timeElapsed < duration && (!(timeElapsed > 0.01f) || !instance.thisController.isGrounded)) { instance.fallValue = 0f; timeElapsed += Time.deltaTime; instance.thisController.Move(Vector3.Lerp(new Vector3(0f, startForce, 0f), Vector3.up, timeElapsed / duration) * Time.deltaTime); yield return null; } } public static IEnumerator WallJump(PlayerControllerB instance, bool forwardHit, bool leftHit, bool backHit, bool rightHit) { instance.ResetFallGravity(); float timeElapsed = 0f; Vector3 direction = Quaternion.AngleAxis(directionsToRotation(forwardHit, leftHit, backHit, rightHit) + 180f, Vector3.up) * ((Component)instance).transform.forward; direction.y = 1.5f; while (!slamming && timeElapsed < 0.33f) { instance.ResetFallGravity(); timeElapsed += Time.deltaTime; instance.thisController.Move(Vector3.Lerp(direction * 15f, direction, timeElapsed / 0.33f) * Time.deltaTime); yield return null; } } public static IEnumerator Slide(PlayerControllerB instance, Vector3 initialBuildup) { //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) IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).Disable(); IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).Disable(); instance.Crouch(true); sliding = true; slamTimer = ScrapIsFuel.Config.SLAM_JUMP_PERIOD.Value; float timeElapsed = 0f; Vector3 oldPos = new Vector3(0f, 0f, 0f); Vector3 newPos = ((Component)instance).transform.position; Vector3 forward = ((Component)instance.gameplayCamera).transform.forward; Vector3 direction = ((Vector3)(ref forward)).normalized * 10f; direction.y = 0f; while (!instance.isSinking && !ScrapIsFuel.UltraInputsInstance.Dash.WasPressedThisFrame() && ScrapIsFuel.UltraInputsInstance.SlamNSlide.IsPressed() && Mathf.Abs(oldPos.x - newPos.x) > 0f && Mathf.Abs(oldPos.z - newPos.z) > 0f) { instance.playerBodyAnimator.SetBool("crouching", true); timeElapsed += Time.deltaTime; slideTimer = 0f; Vector3 buildupVector = Vector3.Lerp(initialBuildup, Vector3.zero, timeElapsed / 1f); oldPos = newPos; instance.thisController.Move((direction + buildupVector) * Time.deltaTime); newPos = ((Component)instance).transform.position; momentumVector = direction + buildupVector; yield return null; } sliding = false; instance.Crouch(false); instance.playerBodyAnimator.SetBool("crouching", false); IngamePlayerSettings.Instance.playerInput.actions.FindAction("Jump", false).Enable(); IngamePlayerSettings.Instance.playerInput.actions.FindAction("Move", false).Enable(); } } [HarmonyPatch] internal class PlayerJumpPatch { [HarmonyTargetMethod] private static MethodBase targetMoveNext() { return AccessTools.Method(AccessTools.FirstInner(typeof(PlayerControllerB), (Func)((Type t) => t.Name.Contains("d__421"))), "MoveNext", (Type[])null, (Type[])null); } [HarmonyPatch] [HarmonyTranspiler] [HarmonyPriority(0)] private static IEnumerable MoveNextTranspiler(IEnumerable instructions) { List list = instructions.ToList(); for (int i = 0; i < list.Count; i++) { if (list[i].opcode == OpCodes.Newobj && list[i - 1].opcode == OpCodes.Ldc_R4) { list.RemoveRange(i - 2, 4); } } return list.AsEnumerable(); } } } namespace ScrapIsFuel.Input { public class UltraInputs : LcInputActions { [InputAction("/f", Name = "Dash")] public InputAction Dash { get; set; } [InputAction("/leftCtrl", Name = "SlamNSlide")] public InputAction SlamNSlide { get; set; } } } namespace ScrapIsFuel.Config { [DataContract] public class UltraConfigs : SyncedConfig2 { [field: SyncedEntryField] public SyncedEntry FALL_DAMAGE_ENABLED { get; set; } [field: SyncedEntryField] public SyncedEntry DASH_ENABLED { get; set; } [field: SyncedEntryField] public SyncedEntry DASH_DURATION { get; set; } [field: SyncedEntryField] public SyncedEntry DASH_MOMENTUM { get; set; } [field: SyncedEntryField] public SyncedEntry DASH_STAMINA { get; set; } [field: SyncedEntryField] public SyncedEntry DASH_AMPLITUDE { get; set; } [field: SyncedEntryField] public SyncedEntry SLIDE_ENABLED { get; set; } [field: SyncedEntryField] public SyncedEntry SLIDE_JUMP_MULTIPLIER { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_ENABLED { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_AMPLITUDE { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_JUMP_PERIOD { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_JUMP_MAX_DURATION { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_JUMP_DURATION_DIVISOR { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_JUMP_DURATION_OFFSET { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_JUMP_FORCE_MIN { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_JUMP_FORCE_MAX { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_JUMP_FORCE_DIVISOR { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_JUMP_FORCE_OFFSET { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_STORAGE_ENABLED { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_STORAGE_HEIGHT { get; set; } [field: SyncedEntryField] public SyncedEntry SLAM_STORAGE_FORCE { get; set; } [field: SyncedEntryField] public SyncedEntry JUMP_DURATION { get; set; } [field: SyncedEntryField] public SyncedEntry JUMP_FORCE { get; set; } [field: SyncedEntryField] public SyncedEntry WALL_CLINGING_ENABLED { get; set; } [field: SyncedEntryField] public SyncedEntry WALL_CLINGING_SLOWDOWN { get; set; } [field: SyncedEntryField] public SyncedEntry WALL_JUMPING_ENABLED { get; set; } [field: SyncedEntryField] public SyncedEntry MAX_WALL_JUMPS { get; set; } [field: SyncedEntryField] public SyncedEntry MOMENTUM_ENABLED { get; set; } [field: SyncedEntryField] public SyncedEntry MOMENTUM_PERIOD { get; set; } [field: SyncedEntryField] public SyncedEntry MAX_FALL_VALUE { get; set; } public UltraConfigs(ConfigFile cfg) : base("ScrapIsFuel") { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Expected O, but got Unknown //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Expected O, but got Unknown //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Expected O, but got Unknown //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Expected O, but got Unknown //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Expected O, but got Unknown //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Expected O, but got Unknown //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Expected O, but got Unknown //IL_043b: Unknown result type (might be due to invalid IL or missing references) //IL_0445: Expected O, but got Unknown //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Expected O, but got Unknown //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Expected O, but got Unknown //IL_050f: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Expected O, but got Unknown //IL_0566: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Expected O, but got Unknown //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Expected O, but got Unknown FALL_DAMAGE_ENABLED = SyncedBindingExtensions.BindSyncedEntry(cfg, "Fall damage", "Enabled", false, "Enables fall damage outside of slamming"); DASH_ENABLED = SyncedBindingExtensions.BindSyncedEntry(cfg, "Dashing", "Enabled", true, "Whether dashing is enabled"); DASH_DURATION = SyncedBindingExtensions.BindSyncedEntry(cfg, "Dashing", "Duration", 0.075f, new ConfigDescription("How long the dash should last", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.15f), Array.Empty())); DASH_MOMENTUM = SyncedBindingExtensions.BindSyncedEntry(cfg, "Dashing", "Momentum preservation", 0.33f, new ConfigDescription("Percentage of momentum kept from dashing", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); DASH_STAMINA = SyncedBindingExtensions.BindSyncedEntry(cfg, "Dashing", "Stamina usage", 0.33f, new ConfigDescription("How much stamina a dash consumes", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); DASH_AMPLITUDE = SyncedBindingExtensions.BindSyncedEntry(cfg, "Dashing", "Amplitude", 125, new ConfigDescription("How fast the dash should be (higher = faster)", (AcceptableValueBase)(object)new AcceptableValueRange(50, 200), Array.Empty())); SLIDE_ENABLED = SyncedBindingExtensions.BindSyncedEntry(cfg, "Sliding", "Enabled", true, "Whether sliding is enabled"); SLIDE_JUMP_MULTIPLIER = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slide jumping", "Multiplier", 1.0025f, new ConfigDescription("How much your momentum gets multiplied by slide jumping", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 1.05f), Array.Empty())); SLAM_ENABLED = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slamming", "Enabled", true, "Whether slamming is enabled"); SLAM_AMPLITUDE = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slamming", "Amplitude", 50, new ConfigDescription("How fast the fall from a slam is (higher = faster)", (AcceptableValueBase)(object)new AcceptableValueRange(10, 150), Array.Empty())); SLAM_JUMP_PERIOD = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam jumping", "Period", 0.5f, new ConfigDescription("Amount of time in which slamming gives a boost to jumping", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); SLAM_JUMP_MAX_DURATION = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam jumping", "Duration", 2f, new ConfigDescription("Maximum amount of time the player can be propelled upwards when slam jumping, makes the jump more floaty", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 5f), Array.Empty())); SLAM_JUMP_DURATION_DIVISOR = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam jumping", "Duration divisor", 200, new ConfigDescription("How much slam height should be divided by to get the duration of the slam jump (lower = higher/floatier jump)", (AcceptableValueBase)(object)new AcceptableValueRange(1, 300), Array.Empty())); SLAM_JUMP_DURATION_OFFSET = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam jumping", "Duration offset", 0.4f, new ConfigDescription("How close the slam jump should be to the maximum amount of propelling time by default (higher = higher/floatier jump)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); SLAM_JUMP_FORCE_MIN = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam jumping", "Minimum force", 10, new ConfigDescription("Minimum starting force of the slam jump", (AcceptableValueBase)(object)new AcceptableValueRange(1, 39), Array.Empty())); SLAM_JUMP_FORCE_MAX = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam jumping", "Maximum force", 55, new ConfigDescription("Maximum starting force of the slam jump", (AcceptableValueBase)(object)new AcceptableValueRange(40, 80), Array.Empty())); SLAM_JUMP_FORCE_DIVISOR = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam jumping", "Force divisor", 150, new ConfigDescription("How much slam height should be divided by to get the starting force (lower = stronger jump)", (AcceptableValueBase)(object)new AcceptableValueRange(1, 200), Array.Empty())); SLAM_JUMP_FORCE_OFFSET = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam jumping", "Force offset", 0.35f, new ConfigDescription("How close the slam jump should be to the maximum starting force by default (high = stronger jump)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); SLAM_STORAGE_ENABLED = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam storage", "Enabled", true, "Whether slam storage is enabled"); SLAM_STORAGE_HEIGHT = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam storage", "Height", 275, new ConfigDescription("What slam height slam storage should count as", (AcceptableValueBase)(object)new AcceptableValueRange(150, 450), Array.Empty())); SLAM_STORAGE_FORCE = SyncedBindingExtensions.BindSyncedEntry(cfg, "Slam storage", "Force", 100, new ConfigDescription("How powerful the initial upwards force is (higher = more powerful)", (AcceptableValueBase)(object)new AcceptableValueRange(25, 200), Array.Empty())); JUMP_DURATION = SyncedBindingExtensions.BindSyncedEntry(cfg, "Jumping", "Duration", 0.5f, new ConfigDescription("How long the standard jump should be elongated for (higher = longer)", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); JUMP_FORCE = SyncedBindingExtensions.BindSyncedEntry(cfg, "Jumping", "Force", 20, new ConfigDescription("How powerful the initial upwards force is (higher = more powerful)", (AcceptableValueBase)(object)new AcceptableValueRange(10, 50), Array.Empty())); WALL_CLINGING_ENABLED = SyncedBindingExtensions.BindSyncedEntry(cfg, "Wall clinging", "Enabled", true, "Whether wall clinging is enabled"); WALL_CLINGING_SLOWDOWN = SyncedBindingExtensions.BindSyncedEntry(cfg, "Wall clinging", "Slowdown", 1.25f, new ConfigDescription("How much wall clinging will slow down donwards velocity (1 = no slowdown)", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 2f), Array.Empty())); WALL_JUMPING_ENABLED = SyncedBindingExtensions.BindSyncedEntry(cfg, "Wall jumping", "Enabled", true, "Whether wall jumping is enabled"); MAX_WALL_JUMPS = SyncedBindingExtensions.BindSyncedEntry(cfg, "Wall jumping", "Max wall jumps", 3, new ConfigDescription("How many wall jumps can be performed before needing to be grounded", (AcceptableValueBase)(object)new AcceptableValueRange(0, 10), Array.Empty())); MOMENTUM_ENABLED = SyncedBindingExtensions.BindSyncedEntry(cfg, "Momentum", "Enabled", true, "Whether momentum is enabled"); MOMENTUM_PERIOD = SyncedBindingExtensions.BindSyncedEntry(cfg, "Momentum", "Period", 0.25f, new ConfigDescription("How much time must pass for momentum to start dropping", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); MAX_FALL_VALUE = SyncedBindingExtensions.BindSyncedEntry(cfg, "Falling", "Maximum gravity", -50, new ConfigDescription("How big terminal velocity is (closer to zero = smaller)", (AcceptableValueBase)(object)new AcceptableValueRange(-150, -1), Array.Empty())); ConfigManager.Register((SyncedConfig2)this); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }