[RelativeSync] Fixed buncha stuff, cleanup

This commit is contained in:
NotAKidoS 2024-05-29 13:41:11 -05:00
parent b97265ef37
commit b786ecd51c
11 changed files with 429 additions and 231 deletions

View file

@ -0,0 +1,48 @@
using MelonLoader;
using NAK.RelativeSync.Networking;
namespace NAK.RelativeSync;
internal static class ModSettings
{
internal const string ModName = nameof(RelativeSync);
#region Melon Preferences
private static readonly MelonPreferences_Category Category =
MelonPreferences.CreateCategory(ModName);
private static readonly MelonPreferences_Entry<bool> DebugLogInbound =
Category.CreateEntry("DebugLogInbound", false,
"Debug Log Inbound", description: "Log inbound network messages.");
private static readonly MelonPreferences_Entry<bool> DebugLogOutbound =
Category.CreateEntry("DebugLogOutbound", false,
"Debug Log Outbound", description: "Log outbound network messages.");
private static readonly MelonPreferences_Entry<bool> ExpSyncedObjectHack =
Category.CreateEntry("ExpSyncedObjectHack", false,
"Exp Spawnable Sync Fix", description: "Forces CVRSpawnable to update position in FixedUpdate. May help reduce local jitter on synced movement parents.");
private static readonly MelonPreferences_Entry<bool> ExpNoInterpolationOnBBCC =
Category.CreateEntry("ExpNoInterpolationOnBBCC", false,
"Exp Disable Interpolation on BBCC", description: "Disable interpolation on Better Better Character Controller. May help reduce local jitter on synced movement parents.");
#endregion Melon Preferences
internal static void Initialize()
{
foreach (MelonPreferences_Entry setting in Category.Entries)
setting.OnEntryValueChangedUntyped.Subscribe(OnSettingsChanged);
OnSettingsChanged();
}
private static void OnSettingsChanged(object oldValue = null, object newValue = null)
{
ModNetwork.Debug_NetworkInbound = DebugLogInbound.Value;
ModNetwork.Debug_NetworkOutbound = DebugLogOutbound.Value;
Patches.CVRSpawnablePatches.UseHack = ExpSyncedObjectHack.Value;
Patches.BetterBetterCharacterControllerPatches.NoInterpolation = ExpNoInterpolationOnBBCC.Value;
}
}