Skip to content

Commit

Permalink
fix up painkillerdesat mod
Browse files Browse the repository at this point in the history
  • Loading branch information
CWXDEV committed Jun 17, 2024
1 parent a083418 commit 109ca52
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 20 deletions.
Binary file modified src/Build/BepInEx/plugins/CWX/CWX_MegaMod.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion src/CWX-MegaMod/MegaMod.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CWX_MegaMod.BackpackReload;
using CWX_MegaMod.Config;
using CWX_MegaMod.InventoryViewer;
using CWX_MegaMod.PainkillerDesat;
Expand Down Expand Up @@ -41,6 +40,7 @@ public void Awake()
new PainkillerDesatScript1().Enable();
new PainkillerDesatScript2().Enable();
new PainkillerDesatScript3().Enable();
new PainkillerDesatScript4().Enable();
new WeatherPatcherScopePatch().Enable();
}

Expand Down
16 changes: 7 additions & 9 deletions src/CWX-MegaMod/PainkillerDesat/PainkillerDesatPatch1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@ protected override MethodBase GetTargetMethod()
}

[PatchPrefix] // removes the sharpen/desat effect from some painkillers
public static bool PatchPrefix(bool desaturateProvider, CC_Sharpen ___cc_Sharpen_0)
public static bool PatchPrefix(ref CC_Sharpen ___cc_Sharpen_0)
{
if (!MegaMod.PainkillerDesat.Value)
{
return true;
}

if (desaturateProvider)
{
___cc_Sharpen_0.DesaturateEffectSettingsProvider.Radius = 0f;
}
else
{
___cc_Sharpen_0.Radius = 0f;
}
___cc_Sharpen_0.DesaturateEffectSettingsProvider.MaskDesaturate = 0f;
___cc_Sharpen_0.MaskDesaturate = 0f;
___cc_Sharpen_0.DesaturateEffectSettingsProvider.Radius = 1f;
___cc_Sharpen_0.Radius = 1f;
___cc_Sharpen_0.DesaturateEffectSettingsProvider.RadiusFalloff = 0.425f;
___cc_Sharpen_0.RadiusFalloff = 0.425f;

return false; // dont do method
}
Expand Down
16 changes: 7 additions & 9 deletions src/CWX-MegaMod/PainkillerDesat/PainkillerDesatPatch2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,19 @@ protected override MethodBase GetTargetMethod()
}

[PatchPrefix] // removes the sharpen/desat effect from some painkillers
public static bool PatchPrefix(bool desaturateProvider, CC_Sharpen ___cc_Sharpen_0)
public static bool PatchPrefix(ref CC_Sharpen ___cc_Sharpen_0)
{
if (!MegaMod.PainkillerDesat.Value)
{
return true;
}

if (desaturateProvider)
{
___cc_Sharpen_0.DesaturateEffectSettingsProvider.MaskDesaturate = 0f;
}
else
{
___cc_Sharpen_0.MaskDesaturate = 0f;
}
___cc_Sharpen_0.DesaturateEffectSettingsProvider.MaskDesaturate = 0f;
___cc_Sharpen_0.MaskDesaturate = 0f;
___cc_Sharpen_0.DesaturateEffectSettingsProvider.Radius = 1f;
___cc_Sharpen_0.Radius = 1f;
___cc_Sharpen_0.DesaturateEffectSettingsProvider.RadiusFalloff = 0.425f;
___cc_Sharpen_0.RadiusFalloff = 0.425f;

return false; // dont do method
}
Expand Down
2 changes: 1 addition & 1 deletion src/CWX-MegaMod/PainkillerDesat/PainkillerDesatPatch3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ protected override MethodBase GetTargetMethod()
}

[PatchPrefix] // removes the wiggle effect from some painkillers
public static bool PatchPrefix(CC_Wiggle ___cc_Wiggle_0)
public static bool PatchPrefix(ref CC_Wiggle ___cc_Wiggle_0)
{
if (!MegaMod.PainkillerDesat.Value)
{
Expand Down
27 changes: 27 additions & 0 deletions src/CWX-MegaMod/PainkillerDesat/PainkillerDesatPatch4.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Reflection;
using Aki.Reflection.Patching;
using HarmonyLib;

namespace CWX_MegaMod.PainkillerDesat
{
public class PainkillerDesatScript4 : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(EffectsController.Class568), nameof(EffectsController.Class568.Toggle));
}

[PatchPrefix] // removes the double vision effect from some painkillers
public static bool PatchPrefix(ref CC_DoubleVision ___cc_DoubleVision_0)
{
if (!MegaMod.PainkillerDesat.Value)
{
return true;
}

___cc_DoubleVision_0.enabled = false;

return false; // dont do method
}
}
}

0 comments on commit 109ca52

Please sign in to comment.