Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of v40FallDamage v1.1.1
v40FallDamage/v40FallDamage.dll
Decompiled 2 years agousing System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using TerminalApi; using TerminalApi.Events; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("OldFallDamageMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("OldFallDamageMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("30667208-0a0f-493a-b3df-17c33f658d78")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace OldFallDamageMod { [BepInPlugin("Confusified.v40FallDamage", "v40 Fall Damage", "1.1.1")] [BepInDependency("atomic.terminalapi", "1.2.0")] public class FallDamagePatchBase : BaseUnityPlugin { private const string modGUID = "Confusified.v40FallDamage"; private const string modName = "v40 Fall Damage"; private const string modVersion = "1.1.1"; private readonly Harmony _harmony = new Harmony("Confusified.v40FallDamage"); public ConfigFile Configuration = new ConfigFile(Utility.CombinePaths(new string[2] { Paths.ConfigPath + "\\Confusified\\", "Confusified.v40FallDamage".Substring(12) + ".cfg" }), false); public static ConfigEntry<bool> ModEnabled; private void Awake() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown SetModConfig(); Events.TerminalAwake += new TerminalEventHandler(TerminalIsAwake); Events.TerminalParsedSentence += new TerminalParseSentenceEventHandler(TextSubmitted); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Terminal Commands"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"v40 Fall Damage 1.1.1 has loaded"); } private void SetModConfig() { ModEnabled = Configuration.Bind<bool>("Mod Settings", "Enabled", true, "Toggle the mod"); } private void TerminalIsAwake(object sender, TerminalEventArgs e) { TerminalApi.AddCommand("v40falldamage", "v40 Fall Damage has been toggled\n\n", "toggle", true); } private void TextSubmitted(object sender, TerminalParseSentenceEventArgs e) { if (e.SubmittedText.ToLower().Contains("v40falldamage")) { ModEnabled.Value = !ModEnabled.Value; ((BaseUnityPlugin)this).Logger.LogMessage((object)$"Toggled v40 Fall Damage, enabled: {ModEnabled.Value}"); } } } } namespace OldFallDamageMod.Patch { [HarmonyPatch(typeof(PlayerControllerB))] internal class PatchFallDamage { [HarmonyPatch("PlayerHitGroundEffects")] [HarmonyPrefix] private static void PatchedFallDamage(PlayerControllerB __instance) { //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) __instance.GetCurrentMaterialStandingOn(); if (__instance.fallValue < -9f) { if (__instance.fallValue < -16f) { __instance.movementAudio.PlayOneShot(StartOfRound.Instance.playerHitGroundHard, 1f); WalkieTalkie.TransmitOneShotAudio(__instance.movementAudio, StartOfRound.Instance.playerHitGroundHard, 1f); } else if (__instance.fallValue < -2f) { __instance.movementAudio.PlayOneShot(StartOfRound.Instance.playerHitGroundSoft, 1f); } __instance.LandFromJumpServerRpc(__instance.fallValue < -16f); } if (__instance.fallValueUncapped < -30f && FallDamagePatchBase.ModEnabled.Value) { __instance.takingFallDamage = true; } if (__instance.takingFallDamage && !__instance.jetpackControls && !__instance.disablingJetpackControls && !__instance.isSpeedCheating) { if (__instance.fallValueUncapped < -50f) { __instance.DamagePlayer(100, true, true, (CauseOfDeath)2, 0, false, default(Vector3)); } else { int num = 40; if (FallDamagePatchBase.ModEnabled.Value) { num = 20; } __instance.DamagePlayer(num, true, true, (CauseOfDeath)2, 0, false, default(Vector3)); } } if (__instance.fallValue < -16f) { RoundManager.Instance.PlayAudibleNoise(((Component)__instance).transform.position, 7f, 0.5f, 0, false, 0); } } } }