Skip to content

Commit

Permalink
Fixed unpause unintentionally enabling saber trails again
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadnix-was-taken committed Oct 25, 2020
1 parent 8296bf8 commit ab3c06a
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 59 deletions.
10 changes: 5 additions & 5 deletions HarmonyPatches/Patches/SaberTrailInit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ internal class SaberTrailInit
{
private static void Prefix(SaberTrail __instance, ref float ____trailDuration, ref int ____granularity, ref float ____whiteSectionMaxDuration)
{
if (!Configuration.Trail.TweakEnabled)
if (Configuration.Trail.TweakEnabled && Configuration.Trail.TrailEnabled)
{
return;
____trailDuration = Configuration.Trail.Duration / 1000f;
____granularity = Configuration.Trail.Granularity;
____whiteSectionMaxDuration = Configuration.Trail.WhiteSectionDuration / 1000f;
Logger.log.Info("Successfully modified trails!");
}
____trailDuration = Configuration.Trail.Duration / 1000f;
____granularity = Configuration.Trail.Granularity;
____whiteSectionMaxDuration = Configuration.Trail.WhiteSectionDuration / 1000f;
}
}
}
19 changes: 19 additions & 0 deletions HarmonyPatches/Patches/SaberTrailRendererOnEnable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using HarmonyLib;
using SaberTailor.Settings;

namespace SaberTailor.HarmonyPatches.Patches
{
[HarmonyPatch(typeof(SaberTrailRenderer))]
[HarmonyPatch("OnEnable")]
internal class SaberTrailRendererOnEnable
{
private static void Postfix(SaberTrailRenderer __instance)
{
if (Configuration.Trail.TweakEnabled && !Configuration.Trail.TrailEnabled)
{
__instance.enabled = false;
Logger.log.Info("Successfully disabled trails!");
}
}
}
}
5 changes: 0 additions & 5 deletions Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ public void OnActiveSceneChanged(Scene prevScene, Scene nextScene)
{
if (nextScene.name == "GameCore")
{
if (Configuration.Trail.TweakEnabled)
{
new GameObject(PluginName).AddComponent<SaberTrailTweak>();
}

if (Configuration.Scale.TweakEnabled)
{
new GameObject(PluginName).AddComponent<SaberLength>();
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
[assembly: ComVisible(false)]
[assembly: Guid("a2d66447-9928-4292-9a82-87abbaa401ff")]

[assembly: AssemblyVersion("3.0.2")]
[assembly: AssemblyFileVersion("3.0.2")]
[assembly: AssemblyVersion("3.0.3")]
[assembly: AssemblyFileVersion("3.0.3")]
2 changes: 1 addition & 1 deletion SaberTailor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="HarmonyPatches\Patches\SaberTrailInit.cs" />
<Compile Include="HarmonyPatches\Patches\SaberTrailRendererOnEnable.cs" />
<Compile Include="HarmonyPatches\SaberTailorPatches.cs" />
<Compile Include="HarmonyPatches\Patches\AdjustPlatformSpecificControllerTransformPatch.cs" />
<Compile Include="Logger.cs" />
Expand All @@ -55,7 +56,6 @@
<Compile Include="Settings\Utilities\PluginConfig.cs" />
<Compile Include="Settings\Utilities\ProfileManager.cs" />
<Compile Include="Tweaks\SaberLength.cs" />
<Compile Include="Tweaks\SaberTrailTweak.cs" />
<Compile Include="Utilities\Utils.cs" />
<Compile Include="Utilities\Vector3Extensions.cs" />
</ItemGroup>
Expand Down
45 changes: 0 additions & 45 deletions Tweaks/SaberTrailTweak.cs

This file was deleted.

2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"icon": "SaberTailor.Resources.icon.png",
"id": "SaberTailor",
"name": "SaberTailor",
"version": "3.0.2",
"version": "3.0.3",
"dependsOn": {
"BSIPA": "^4.0.0",
"BeatSaberMarkupLanguage": "^1.4.0",
Expand Down

0 comments on commit ab3c06a

Please sign in to comment.