Skip to content

Commit

Permalink
Fixed bug when enabling disable all
Browse files Browse the repository at this point in the history
  • Loading branch information
Asgragrt committed Feb 24, 2024
1 parent 0a42e24 commit 92686d1
Showing 1 changed file with 8 additions and 15 deletions.
23 changes: 8 additions & 15 deletions Patches/MainEffectsPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,18 @@ namespace SelectiveEffects.Patches
[HarmonyPatch(typeof(Effect), nameof(Effect.CreateInstance))]
internal class MainEffectsPatch
{
internal static GameObject EmptyObject = new("EmptyObject");

[HarmonyPrefix]
[HarmonyPriority(Priority.VeryHigh)]
public static bool Prefix(ref GameObject __result)
{
if (!SettingsManager.Enabled) return true;

if (!SettingsManager.DisableAllEffects) return true;

__result = EmptyObject;
return false;
}

[HarmonyPostfix]
public static void Postfix(Effect __instance, ref GameObject __result)
{
if (!SettingsManager.Enabled) return;


if (SettingsManager.DisableAllEffects)
{
__result.SetActive(false);
return;
}


if (SettingsManager.DisableAllEffects || !EffectsDisablerManager.AnyEffect) return;

string fxName = __instance.uid;
Expand Down

0 comments on commit 92686d1

Please sign in to comment.