nomai-vr/NomaiVR/ModConfig/OWMLSettingsProvider.cs
Ezra Hill aefee463b0
Added Snap Turning (#556)
* Added Snap Turning

- Disabled by default, can be enabled in settings
- Amount per input can be defined in settings (current range is 15 - 90 degrees)
- Default input action is the right thumb stick (same as smooth turn)

* Moved snap turn from slider to selector for settings

* Fixed snap turning with smooth HUD/Helmet

- Previously, the smooth HUD/Helmet would uncomfortably move a long distance after you snap turn
- Now, if smooth HUD and snap turning are both enabled, the helmet snap turns for a frame, then resumes it's previous behavior

* Disable snap turning while in zero-g

---------

Co-authored-by: Raicuparta <Raicuparta@users.noreply.github.com>
2025-03-02 22:55:41 +01:00

67 lines
3.2 KiB
C#

using OWML.Common;
using System;
namespace NomaiVR.ModConfig
{
public class OwmlSettingsProvider : IModSettingProvider
{
public event Action OnConfigChange;
public bool LeftHandDominant { get; private set; }
public bool DebugMode { get; private set; } = true;
public bool PreventCursorLock { get; private set; }
public bool ShowHelmet { get; private set; }
public float VibrationStrength { get; private set; }
public bool EnableGesturePrompts { get; private set; }
public bool EnableHandLaser { get; private set; }
public bool EnableFeetMarker { get; private set; }
public bool PreventClipping { get; private set; }
public bool FlashlightGesture { get; private set; }
public bool ControllerOrientedMovement { get; private set; }
public bool SnapTurning { get; private set; }
public string SnapTurnIncrement { get; private set; }
public bool AutoHideToolbelt { get; private set; }
public float ToolbeltHeight { get; private set; }
public float HudScale { get; private set; }
public float HudOpacity { get; private set; }
public float MarkersOpacity { get; private set; }
public float LookArrowOpacity { get; private set; }
public bool HudSmoothFollow { get; private set; } = true;
private readonly IModConfig config;
public OwmlSettingsProvider(IModConfig config)
{
this.config = config;
}
public void Configure()
{
LeftHandDominant = config.GetSettingsValue<bool>("leftHandDominant");
VibrationStrength = config.GetSettingsValue<float>("vibrationIntensity");
ShowHelmet = config.GetSettingsValue<bool>("helmetVisibility");
ControllerOrientedMovement = config.GetSettingsValue<bool>("movementControllerOriented");
SnapTurning = config.GetSettingsValue<bool>("snapTurning");
SnapTurnIncrement = config.GetSettingsValue<string>("snapTurnIncrement");
EnableGesturePrompts = config.GetSettingsValue<bool>("showGesturePrompts");
EnableHandLaser = config.GetSettingsValue<bool>("showHandLaser");
EnableFeetMarker = config.GetSettingsValue<bool>("showFeetMarker");
FlashlightGesture = config.GetSettingsValue<bool>("flashlightGesture");
PreventClipping = config.GetSettingsValue<bool>("preventClipping");
DebugMode = config.GetSettingsValue<bool>("debug");
AutoHideToolbelt = config.GetSettingsValue<bool>("autoHideToolbelt");
HudScale = config.GetSettingsValue<float>("hudScale");
HudSmoothFollow = config.GetSettingsValue<bool>("hudSmoothFollow");
PreventCursorLock = config.GetSettingsValue<bool>("disableCursorLock");
HudOpacity = config.GetSettingsValue<float>("hudOpacity");
MarkersOpacity = config.GetSettingsValue<float>("markersOpacity");
LookArrowOpacity = config.GetSettingsValue<float>("lookArrowOpacity");
// OWML doesn't support negative slider values so I subtract it here.
ToolbeltHeight = config.GetSettingsValue<float>("toolbeltHeight") - 1f;
OnConfigChange?.Invoke();
}
}
}