Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Commit

Permalink
Add trail toggle!
Browse files Browse the repository at this point in the history
  • Loading branch information
SteffanDonal committed Sep 4, 2018
1 parent 2b0b241 commit e63ec68
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions Preferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -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));

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("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]
11 changes: 9 additions & 2 deletions Tweaks/SaberTrail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
11 changes: 10 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -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!

Expand All @@ -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
Expand All @@ -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`
Expand Down

0 comments on commit e63ec68

Please sign in to comment.