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 NoDamageFlash v1.0.0
NoDamageFlash\NoDamageFlash.dll
Decompiled a day agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using RoR2; using RoR2.PostProcessing; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NoDamageFlash")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NoDamageFlash")] [assembly: AssemblyTitle("NoDamageFlash")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 NoDamageFlash { [BepInPlugin("com.max.nodamageflash", "No Damage Flash", "1.0.0")] public class NoDamageFlashPlugin : BaseUnityPlugin { internal static ConfigEntry<bool> DisableDamageFlash; private Harmony _harmony; private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown DisableDamageFlash = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableDamageFlash", true, "Removes recent-hit screen tint while preserving low-health tint."); _harmony = new Harmony("com.max.nodamageflash"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"No Damage Flash loaded."); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } [HarmonyPatch(typeof(ScreenDamageCalculatorDefault), "CalculateScreenDamage")] internal static class DefaultScreenDamageCalculatorPatch { private static void Postfix(ScreenDamageCalculatorDefault __instance, ScreenDamage screenDamage, HealthComponent targetHealthComponent) { if (NoDamageFlashPlugin.DisableDamageFlash == null || !NoDamageFlashPlugin.DisableDamageFlash.Value || __instance == null || (Object)(object)screenDamage == (Object)null) { return; } ScreenDamageData screenDamageData = ((ScreenDamageCalculator)__instance).screenDamageData; if (screenDamageData == null) { return; } float num = 0f; float num2 = 0.5f; if ((Object)(object)targetHealthComponent != (Object)null) { if (targetHealthComponent.fullHealth > 0f) { num = Mathf.Clamp(targetHealthComponent.health / targetHealthComponent.fullHealth, 0f, 1f); } if (targetHealthComponent.health <= 0f) { num2 = 0f; } } if (screenDamage.debugHealthPercentage != 0f) { num = screenDamage.debugHealthPercentage; } screenDamageData.tintStrength = num2 * screenDamage.TintScale * Mathf.Pow(1f - num, screenDamage.TintPower); } } }