From e63ec68eebdc565a6105c5d39a599e058b65a0c4 Mon Sep 17 00:00:00 2001 From: Steffan Donal Date: Tue, 4 Sep 2018 21:36:26 +0200 Subject: [PATCH] Add trail toggle! --- Plugin.cs | 2 +- Preferences.cs | 3 +++ Properties/AssemblyInfo.cs | 4 ++-- Tweaks/SaberTrail.cs | 11 +++++++++-- readme.md | 11 ++++++++++- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Plugin.cs b/Plugin.cs index b00a9f1..240fe47 100644 --- a/Plugin.cs +++ b/Plugin.cs @@ -12,7 +12,7 @@ namespace SaberTailor public class Plugin : IPlugin { public const string Name = "SaberTailor"; - public const string Version = "1.0.0"; + public const string Version = "1.1.0"; string IPlugin.Name => Name; string IPlugin.Version => Version; diff --git a/Preferences.cs b/Preferences.cs index 55518ba..dde18a2 100644 --- a/Preferences.cs +++ b/Preferences.cs @@ -9,6 +9,7 @@ public static class Preferences { public static float Length { get; private set; } + public static bool IsTrailEnabled { get; private set; } public static int TrailLength { get; private set; } public static Vector3 GripLeftPosition { get; private set; } @@ -27,6 +28,8 @@ public static void Load() Length = ModPrefs.GetFloat(Plugin.Name, nameof(Length), 1f, true); Length = Math.Max(0.01f, Math.Min(2f, Length)); + IsTrailEnabled = ModPrefs.GetBool(Plugin.Name, nameof(IsTrailEnabled), true, true); + TrailLength = ModPrefs.GetInt(Plugin.Name, nameof(TrailLength), 20, true); TrailLength = Math.Max(5, Math.Min(100, TrailLength)); diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 7619d21..766ff45 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -13,5 +13,5 @@ [assembly: ComVisible(false)] [assembly: Guid("a2d66447-9928-4292-9a82-87abbaa401ff")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyVersion("1.1.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] diff --git a/Tweaks/SaberTrail.cs b/Tweaks/SaberTrail.cs index d01cc25..7e0e560 100644 --- a/Tweaks/SaberTrail.cs +++ b/Tweaks/SaberTrail.cs @@ -59,8 +59,15 @@ void ModifyTrail(XWeaponTrail trail) { var length = Preferences.TrailLength; - ReflectionUtil.SetPrivateField(trail, "_maxFrame", length); - ReflectionUtil.SetPrivateField(trail, "_granularity", length * 3); + if (Preferences.IsTrailEnabled) + { + ReflectionUtil.SetPrivateField(trail, "_maxFrame", length); + ReflectionUtil.SetPrivateField(trail, "_granularity", length * 3); + } + else + { + trail.enabled = false; + } } } } diff --git a/readme.md b/readme.md index 5ea9b7a..0bdf4b2 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Beat Saber - Saber Tailor v1.0.0 +# Beat Saber - Saber Tailor v1.1.0 Tweak almost everything about your sabers, including length, grip, and trail length! @@ -9,6 +9,7 @@ The default values are below: ```ini [SaberTailor] Length=1 +IsTrailEnabled=1 TrailLength=20 GripLeftPosition=0,0,0 GripLeftRotation=0,0,0 @@ -34,6 +35,14 @@ All config is reloaded every time a song starts - so you can easily adjust thing This setting is known to break many custom sabers, so use this at your own risk. A fix for this may be coming in the future! +### Trail Toggle + +- **Setting**: `IsTrailEnabled` +- **Values**: `1` | `0` +- **Default**: `1` + +Allows you to disable the saber trail entirely, when set to `0`. This option *does not* disable score submission. + ### Trail Length - **Setting**: `TrailLength`