Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Camera Overhaul v1.4.1
BepInEx/plugins/CameraOverhaul/CameraOverhaul.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("CameraOverhaul")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("More satisfying movement through dynamic camera rotations.")] [assembly: AssemblyFileVersion("1.4.1.0")] [assembly: AssemblyInformationalVersion("1.4.1+c42dae53e6025ccdea666e789de671ae59810b19")] [assembly: AssemblyProduct("CameraOverhaul")] [assembly: AssemblyTitle("CameraOverhaul")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.4.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CameraOverhaul { public static class CameraOverhaulApi { private static float _externalSuppression; public static float ExternalSuppression { get { return _externalSuppression; } set { _externalSuppression = Mathf.Clamp01(value); } } internal static float EffectScale => 1f - _externalSuppression; public static void AddTrauma(float amount) { ScreenShakes.AddTrauma(amount); } public static void BumpTrauma(float level) { ScreenShakes.BumpTrauma(level); } public static void BumpTrauma(float level, float hold) { ScreenShakes.BumpTrauma(level, hold); } public static void AddKick(Vector3 strength) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) PlayerControllerBPatch.Rig.AddDamageKick(strength); } public static void SkipVanillaShake() { HUDManagerPatch.SkipThisFrame(); } } internal struct CameraContext { public bool isSprinting; public bool inVehicle; public bool isClimbing; public bool isExhausted; public bool isInspectingItem; public bool criticallyInjured; public bool isUsingJetpack; public bool isBeingShocked; public float sprintMeter; public float drunkness; public float insanity; public float poison; public float sinkingValue; public float shipTakeoffPhase; public float shipLandingPhase; public bool inWater; public bool submerged; public float leviathanProximity01; public LeviathanCue leviathanCue; public bool inSnow; public bool shipWithDoorsOpen; public bool hasActiveLight; public bool grabbedByEnemy; public bool grabbedByBracken; public bool isFalling; public bool gameBobEnabled; public bool hasStaticCharge; public float staticCharge; public float carryWeight; public Vector3 velocity; public Vector3 forwardRelVelocity; public double pitch; public double yaw; public double dtScale; public bool resetSmoothing; } internal sealed class CameraRig { private const NoiseKind SwayNoise = NoiseKind.Fractal; private const NoiseKind ExhaustionNoise = NoiseKind.Fractal; private const NoiseKind InsanityNoise = NoiseKind.Fractal; private const NoiseKind DrunknessNoise = NoiseKind.OpenSimplex2; private const NoiseKind TinnitusNoise = NoiseKind.Simplex; private const NoiseKind CriticalNoise = NoiseKind.Fractal; private const NoiseKind PoisonNoise = NoiseKind.Simplex; private const NoiseKind JetpackNoise = NoiseKind.Fractal; private const NoiseKind ShockNoise = NoiseKind.FrequencyMod; private const NoiseKind ShipNoise = NoiseKind.Fractal; private const NoiseKind WaterWadeNoise = NoiseKind.Fractal; private const NoiseKind WaterDriftNoise = NoiseKind.OpenSimplex2; private const NoiseKind LeviathanNoise = NoiseKind.Fractal; private const NoiseKind FreezeNoise = NoiseKind.FrequencyMod; private const NoiseKind FearNoise = NoiseKind.Fractal; private const NoiseKind StaticNoise = NoiseKind.FrequencyMod; private Vector3 _offsetEuler; private Vector3 _impairOffset; private Vector3 _smoothing; private float _master = 1f; private float _masterBase = 1f; private ConfigData.Contextual? _ctxCfg; private double _prevPitch; private double _prevYaw; private double _lastActionTime; private double _prevVerticalPitch; private double _prevForwardPitch; private double _turningRollTarget; private double _prevStrafingRoll; private double _swayFactor; private double _swayFactorTarget; private double _swayTime; private double _exhaustionTime; private double _insanityTime; private double _drunkTime; private double _criticalTime; private double _criticalPulse; private double _tinnitusTime; private double _poisonTime; private double _jetpackTime; private double _shockTime; private double _shipTime; private double _shipAmp; private double _shipPitch; private double _waterTime; private double _exhaustionSeverity; private double _criticalSeverity; private double _jetpackSeverity; private double _shockSeverity; private double _drunkSeverity; private double _drunkRoll; private double _drunkPitch; private double _drunkYaw; private double _waterWadeSeverity; private double _waterSubmergeSeverity; private double _leviathanTime; private double _leviathanIntensity; private double _neckSnap; private double _freezeTime; private double _freezeDuration; private double _stepPhase = 1.0; private double _stepInterval = 0.5; private double _stepAge = 10.0; private double _stepSign = 1.0; private double _bobSpeed; private double _bobGate; private double _hunch; private Vector3 _bob; private double _scare; private double _fearTime; private double _fearSide = 1.0; private double _staticSeverity; private double _staticTime; private double _landingSide = 1.0; private Vector3 _punch; private Vector3 _punchVel; private bool _msInit; private double _prevYawNorm; private double _prevPitchNorm; private double _contYaw; private double _contPitch; private double _smYaw; private double _smPitch; private const double PunchImpulseScale = 10.0938; private const double LANDING_SIDE_SPEED = 1.0; private const double LANDING_YAW_SHARE = 0.5; private const double FLINCH_ROLL = 3.0; private const double FLINCH_PITCH = 1.5; private const double FLINCH_YAW = 0.9; private const double RecoilImpulseScale = 23.5522; private const double NECK_SNAP_IN_DURATION = 0.28; private const double NECK_SNAP_OUT_DURATION = 0.3; private const double BOB_WALK_SPEED = 0.23; private const double BOB_SPRINT_SPEED = 0.5; private const double BOB_SPEED_SMOOTHING = 0.008; private const double BOB_SMOOTH_TIME = 0.025; private const double MIN_STEP_GAP = 0.12; private const double MAX_STEP_GAP = 1.1; private const double STEP_PHASE_LEAD = 0.85; private const double HEAVY_LOAD = 2.0; private const double HUNCH_SMOOTHING = 0.25; private const double MAX_CONTEXT_SMOOTHING = 0.995; private const double ACTION_VELOCITY_EPS_SQ = 0.0004; private const double ACTION_LOOK_EPS = 0.05; private const float PunchStiffness = 220f; private const float PunchDamping = 22f; private const float MaxPunch = 60f; private static readonly double PunchOmega = Math.Sqrt(220.0); private static readonly double PunchZeta = 22.0 / (2.0 * Math.Sqrt(220.0)); private static readonly double PunchOmegaDamped = PunchOmega * Math.Sqrt(1.0 - PunchZeta * PunchZeta); private const double BASE_VERTICAL_PITCH_SMOOTHING = 4E-05; private const double VERTICAL_PITCH_THRESHOLD = 0.4; private const double BASE_FORWARD_PITCH_SMOOTHING = 0.008; private const double BASE_TURNING_ROLL_ACCUMULATION = 0.0048; private const double BASE_TURNING_ROLL_INTENSITY = 1.25; private const double BASE_TURNING_ROLL_SMOOTHING = 0.0825; private const double BASE_STRAFING_ROLL_SMOOTHING = 0.008; private const double BASE_SWAY_SPEED = 0.5; private const double TINNITUS_SPEED = 1.25; private const double DRUNK_SEVERITY_SMOOTHING = 0.06; private const double DRUNK_OFFSET_SMOOTHING = 0.025; private const double DRUNK_BASE_ROLL = 6.5; private const double DRUNK_BASE_PITCH = 3.0; private const double DRUNK_BASE_YAW = 2.2; private const double DRUNK_INTENSITY_NORMALIZER = 6.0; private const double DRUNK_NOISE_SPEED_MIN = 0.18; private const double DRUNK_NOISE_SPEED_MAX = 0.42; private const double WATER_WADE_SMOOTHING = 0.06; private const double WATER_SUBMERGE_SMOOTHING = 0.05; private const double WATER_WADE_SPEED = 0.9; private const double WATER_DRIFT_SPEED = 0.4; private const double LEVIATHAN_RUMBLE_SPEED = 9.0; private const double LEVIATHAN_INTENSITY_SMOOTHING = 0.1; private const double FREEZING_SPEED = 9.0; private const double SCARE_FADE = 1.6; private const double FEAR_TREMOR_SPEED = 8.0; private const double STATIC_FLOOR = 0.35; private const double STATIC_SPEED = 14.0; private const double STATIC_SMOOTHING = 0.02; private const double SHIP_SHAKE_ANGLE = 0.85; private const double SHIP_RUMBLE_SPEED = 9.0; private const double SHIP_FORWARD_LURCH = 1.2; private const double SHIP_RISE_PITCH = 0.8; private const double SHIP_FADE_SMOOTHING = 0.02; private const double BASE_MOUSE_SMOOTHING = 16.0; private const double MAX_SMOOTHING_LAG = 90.0; private const double MOUSE_SMOOTHING_THRESHOLD = 0.001; private static double Now => Time.timeAsDouble; public Vector3 OffsetEuler => _offsetEuler * _master + _impairOffset * _masterBase + _smoothing + ScreenShakes.EulerOffset; public double NeckSnapYaw { get; private set; } public void Reset() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) _offsetEuler = Vector3.zero; _impairOffset = Vector3.zero; _smoothing = Vector3.zero; _ctxCfg = null; _prevPitch = 0.0; _prevYaw = 0.0; _lastActionTime = 0.0; _prevVerticalPitch = 0.0; _prevForwardPitch = 0.0; _turningRollTarget = 0.0; _prevStrafingRoll = 0.0; _swayFactor = 0.0; _swayFactorTarget = 0.0; _swayTime = 0.0; _exhaustionTime = 0.0; _insanityTime = 0.0; _drunkTime = 0.0; _criticalTime = 0.0; _criticalPulse = 0.0; _tinnitusTime = 0.0; _poisonTime = 0.0; _jetpackTime = 0.0; _shockTime = 0.0; _shipTime = 0.0; _shipAmp = 0.0; _shipPitch = 0.0; _waterTime = 0.0; _exhaustionSeverity = 0.0; _criticalSeverity = 0.0; _jetpackSeverity = 0.0; _shockSeverity = 0.0; _drunkSeverity = 0.0; _drunkRoll = 0.0; _drunkPitch = 0.0; _drunkYaw = 0.0; _waterWadeSeverity = 0.0; _waterSubmergeSeverity = 0.0; _leviathanTime = 0.0; _leviathanIntensity = 0.0; _neckSnap = 0.0; NeckSnapYaw = 0.0; _freezeTime = 0.0; _freezeDuration = 0.0; _stepPhase = 1.0; _stepInterval = 0.5; _stepAge = 10.0; _stepSign = 1.0; _bobSpeed = 0.0; _bobGate = 0.0; _hunch = 0.0; _bob = Vector3.zero; _scare = 0.0; _fearTime = 0.0; _fearSide = 1.0; _staticSeverity = 0.0; _staticTime = 0.0; _landingSide = 1.0; _punch = Vector3.zero; _punchVel = Vector3.zero; _msInit = false; ScreenShakes.Reset(); } public void AddLandingImpulse(double severity) { _punchVel.x += (float)(ConfigManager.Data.general.landingDipStrength * severity * 10.0938); } public void AddScare(double severity) { ConfigData.General general = ConfigManager.Data.general; if (!general.enableFearResponse) { return; } double num = MathUtils.Clamp01(severity); if (!(num <= _scare)) { _scare = num; double num2 = general.fearFlinch * num * 10.0938; if (!(num2 <= 0.0)) { _fearSide = 0.0 - _fearSide; _punchVel.x += (float)(num2 * 1.5); _punchVel.y += (float)(_fearSide * num2 * 0.9); _punchVel.z -= (float)(_fearSide * num2 * 3.0); } } } public void AddLandingTilt(double severity, double sideSpeed) { double num = ConfigManager.Data.general.landingTiltStrength * severity * 10.0938; if (!(num <= 0.0)) { _landingSide = ((Math.Abs(sideSpeed) >= 1.0) ? ((double)Math.Sign(sideSpeed)) : (0.0 - _landingSide)); _punchVel.z -= (float)(_landingSide * num); _punchVel.y += (float)(_landingSide * num * 0.5); } } public void AddWaterSplash(double dipAngle) { _punchVel.x += (float)(dipAngle * 10.0938); } public void AddRecoil(double kickAngle) { float num = 0f - (float)(kickAngle * 23.5522); if (num < _punchVel.x) { _punchVel.x = num; } } public void AddDamageKick(Vector3 strength) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (!float.IsNaN(((Vector3)(ref strength)).sqrMagnitude) && !float.IsInfinity(((Vector3)(ref strength)).sqrMagnitude)) { _punchVel += Vector3.ClampMagnitude(strength, 60f) * 10.0938f; } } public void OnCameraUpdate(in CameraContext context, double dt, PlayerControllerB player) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) ConfigData data = ConfigManager.Data; ConfigData.General general = data.general; float num = 1f; if (general.enableHealthCondition && (double)player.health < general.healthConditionTriggerLimit) { num = Mathf.Clamp01((float)player.health / (float)general.healthConditionTriggerLimit); } _masterBase = (float)general.masterStrength; _master = _masterBase * num; UpdateContext(in context, dt, data); _offsetEuler = Vector3.zero; _impairOffset = Vector3.zero; _smoothing = Vector3.zero; ScreenShakes.OnCameraUpdate(dt, _masterBase); UpdateActionTime(in context); CameraSmoothingOffset(in context, dt); if (general.enableSway) { IdleSwayOffset(dt, data); } ApplyStatusEffects(in context, dt, data); ApplyMotionEffects(in context, dt, data); UpdateNeckSnap(in context, dt, data); _prevPitch = context.pitch; _prevYaw = context.yaw; } private void UpdateNeckSnap(in CameraContext context, double dt, ConfigData cfg) { double num = ((cfg.general.enableBrackenSnap && context.grabbedByBracken) ? 1.0 : 0.0); double num2 = ((num > _neckSnap) ? 0.28 : 0.3); double step = ((num2 > 0.0) ? (dt / num2) : 1.0); _neckSnap = MathUtils.StepTowards(_neckSnap, num, step); NeckSnapYaw = MathUtils.Clamp(cfg.general.brackenSnapAngle * NeckSnapCurve(_neckSnap) * (double)_masterBase, -180.0, 180.0); } private static double NeckSnapCurve(double t) { if (t <= 0.12) { double num = t / 0.12; return -0.09 * (num * num * (3.0 - 2.0 * num)); } if (t <= 0.5) { double num2 = (t - 0.12) / 0.38; return -0.09 + 1.23 * (num2 * num2); } double num3 = (t - 0.5) / 0.5; double num4 = 1.0 - (1.0 - num3) * (1.0 - num3); return 1.14 + -0.1399999999999999 * num4; } private void UpdateActionTime(in CameraContext context) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) double num = Math.Abs(MathUtils.UnwrapStep(context.yaw - _prevYaw)); double num2 = Math.Abs(context.pitch - _prevPitch); Vector3 velocity = context.velocity; if ((double)((Vector3)(ref velocity)).sqrMagnitude > 0.0004 || num > 0.05 || num2 > 0.05 || context.isInspectingItem) { _lastActionTime = Now; } } private void ApplyStatusEffects(in CameraContext context, double dt, ConfigData cfg) { ConfigData.General general = cfg.general; if (general.enableExhaustionEffect) { ExhaustionOffset(in context, dt, cfg); } if (general.enableInsanityEffect) { InsanityOffset(in context, dt, cfg); } if (general.enableTinnitusEffect) { TinnitusOffset(dt, cfg); } if (general.enableDrunknessEffect) { DrunknessOffset(in context, dt, cfg); } if (general.enableCriticalInjuryEffect) { CriticalInjuryOffset(in context, dt, cfg); } if (general.enablePoisonEffect) { PoisonOffset(in context, dt, cfg); } if (general.enableJetpackTurbulence) { JetpackTurbulenceOffset(in context, dt, cfg); } if (general.enableShockEffect) { ShockOffset(in context, dt, cfg); } if (general.enableSinkingTilt) { SinkingTiltOffset(in context, cfg); } if (general.enableWaterEffect) { WaterOffset(in context, dt, cfg); } if (general.enableLeviathanEffects) { LeviathanOffset(in context, dt, cfg); } if (general.enableFreezeEffect) { FreezeOffset(in context, dt, cfg); } FearOffset(dt, cfg); StaticChargeOffset(in context, dt, cfg); } private void ApplyMotionEffects(in CameraContext context, double dt, ConfigData cfg) { ConfigData.General general = cfg.general; ShipMotionOffset(in context, dt, cfg); if (general.enablePitch) { VerticalVelocityPitchOffset(in context, dt, general.maxVelocityPitch); ForwardVelocityPitchOffset(in context, dt, general.maxVelocityPitch); } else { _prevVerticalPitch = 0.0; _prevForwardPitch = 0.0; } PunchOffset(dt); if (general.enableRoll) { TurningRollOffset(in context, dt, cfg); StrafingRollOffset(in context, dt, general.maxVelocityRoll); } else { _turningRollTarget = 0.0; _prevStrafingRoll = 0.0; } WalkBobOffset(in context, dt, cfg); } public void OnFootstep() { if (!(_stepAge < 0.12)) { if (_stepAge <= 1.1) { _stepInterval += (_stepAge - _stepInterval) * 0.35; } _stepAge = 0.0; _stepPhase = 0.0; _stepSign = 0.0 - _stepSign; } } private void WalkBobOffset(in CameraContext context, double dt, ConfigData cfg) { ConfigData.General general = cfg.general; _stepAge += dt; bool flag = general.enableWalkBob && context.gameBobEnabled; _stepPhase = (flag ? Math.Min(_stepPhase + dt / (_stepInterval * 0.85), 1.0) : 1.0); double destination = (flag ? Math.Sqrt(context.velocity.x * context.velocity.x + context.velocity.z * context.velocity.z) : 0.0); _bobSpeed = MathUtils.Damp(_bobSpeed, destination, 0.008, dt); double destination2 = ((!flag || context.inVehicle || context.isClimbing || context.grabbedByEnemy || context.criticallyInjured || context.isFalling) ? 0.0 : 1.0); _bobGate = MathUtils.Damp(_bobGate, destination2, 0.008, dt); double num = Math.Max(1.0, context.carryWeight); double num2 = _bobSpeed * num; double num3 = MathUtils.Clamp01(num2 / 0.23); double num4 = MathUtils.Clamp01((num2 - 0.23) / 0.27); double num5 = _bobGate * num3 * (1.0 + num4 * (general.walkBobSprintMultiplier - 1.0)); double num6 = MathUtils.Clamp01((num - 1.0) / 1.0); _hunch = MathUtils.Damp(_hunch, general.carryHunch * num6 * _bobGate * num3, 0.25, dt); _offsetEuler.x += (float)_hunch; double num7 = Math.Sin(Math.PI * 2.0 * _stepPhase) * general.walkBobPitch * num5; double num8 = Math.Sin(Math.PI * _stepPhase) * _stepSign * general.walkBobRoll * num5; double num9 = 1.0 - Math.Exp((0.0 - dt) / 0.025); _bob.x += (float)((num7 - (double)_bob.x) * num9); _bob.z += (float)((num8 - (double)_bob.z) * num9); _offsetEuler.x += _bob.x; _offsetEuler.z += _bob.z; } private void UpdateContext(in CameraContext context, double dt, ConfigData cfg) { if (_ctxCfg == null) { _ctxCfg = cfg.walking.Clone(); } ConfigData.Contextual b = (context.inVehicle ? cfg.cruiser : (context.isSprinting ? cfg.sprinting : cfg.walking)); double num = MathUtils.Clamp(cfg.general.contextTransitionSmoothing, 0.0, 0.995); double step = ((num > 0.0) ? MathUtils.DampStep(num, dt) : 1.0); _ctxCfg.Lerp(_ctxCfg, b, step); } private void PunchOffset(double dt) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) double decay = Math.Exp((0.0 - PunchZeta) * PunchOmega * dt); double cos = Math.Cos(PunchOmegaDamped * dt); double sin = Math.Sin(PunchOmegaDamped * dt); _punch.x = StepPunchAxis(_punch.x, ref _punchVel.x, decay, cos, sin); _punch.y = StepPunchAxis(_punch.y, ref _punchVel.y, decay, cos, sin); _punch.z = StepPunchAxis(_punch.z, ref _punchVel.z, decay, cos, sin); _punch = Vector3.ClampMagnitude(_punch, 60f); _offsetEuler += _punch; } private static float StepPunchAxis(float position, ref float velocity, double decay, double cos, double sin) { double num = PunchZeta * PunchOmega; double num2 = decay * ((double)position * cos + ((double)velocity + num * (double)position) / PunchOmegaDamped * sin); double num3 = decay * ((double)velocity * cos - (PunchOmega * PunchOmega * (double)position + num * (double)velocity) / PunchOmegaDamped * sin); velocity = (float)num3; return (float)num2; } private void VerticalVelocityPitchOffset(in CameraContext context, double dt, double maxVelocityPitch) { double verticalVelocityPitchFactor = _ctxCfg.verticalVelocityPitchFactor; double smoothing = 4E-05 * _ctxCfg.verticalVelocitySmoothingFactor; double value = (context.isClimbing ? 0.0 : ((double)context.velocity.y * verticalVelocityPitchFactor)); if (Math.Abs(value) < 0.4) { value = 0.0; } value = MathUtils.Clamp(value, 0.0 - maxVelocityPitch, maxVelocityPitch); double num = MathUtils.Damp(_prevVerticalPitch, value, smoothing, dt); _offsetEuler.x += (float)num; _prevVerticalPitch = num; } private void ForwardVelocityPitchOffset(in CameraContext context, double dt, double maxVelocityPitch) { double forwardVelocityPitchFactor = _ctxCfg.forwardVelocityPitchFactor; double smoothing = 0.008 * _ctxCfg.horizontalVelocitySmoothingFactor; double value = (context.isClimbing ? 0.0 : ((double)context.forwardRelVelocity.z * forwardVelocityPitchFactor)); value = MathUtils.Clamp(value, 0.0 - maxVelocityPitch, maxVelocityPitch); double num = MathUtils.Damp(_prevForwardPitch, value, smoothing, dt); _offsetEuler.x += (float)num; _prevForwardPitch = num; } private void TurningRollOffset(in CameraContext context, double dt, ConfigData cfg) { double smoothing = 0.0825 * cfg.general.turningRollSmoothing; double num = 1.25 * cfg.general.turningRollIntensity; double num2 = 0.0048 * cfg.general.turningRollAccumulation; double num3 = MathUtils.UnwrapStep(_prevYaw - context.yaw) * context.dtScale; if (context.resetSmoothing) { num3 = 0.0; } _turningRollTarget = MathUtils.Damp(_turningRollTarget, 0.0, smoothing, dt); _turningRollTarget = MathUtils.Clamp(_turningRollTarget + num3 * num2, -1.0, 1.0); double num4 = MathUtils.Clamp01(TurningEasing(Math.Abs(_turningRollTarget))) * num * (double)Math.Sign(_turningRollTarget); _offsetEuler.z += (float)num4; } private static double TurningEasing(double x) { if (x < 0.5) { return 4.0 * x * x * x; } double num = -2.0 * x + 2.0; return 1.0 - num * num * num / 2.0; } private void StrafingRollOffset(in CameraContext context, double dt, double maxVelocityRoll) { double strafingRollFactor = _ctxCfg.strafingRollFactor; double smoothing = 0.008 * _ctxCfg.horizontalVelocitySmoothingFactor; double value = (double)(0f - context.forwardRelVelocity.x) * strafingRollFactor; value = MathUtils.Clamp(value, 0.0 - maxVelocityRoll, maxVelocityRoll); double num = MathUtils.Damp(_prevStrafingRoll, value, smoothing, dt); _offsetEuler.z += (float)num; _prevStrafingRoll = num; } private void IdleSwayOffset(double dt, ConfigData cfg) { double now = Now; double cameraSwayIntensity = cfg.general.cameraSwayIntensity; double cameraSwayFrequency = cfg.general.cameraSwayFrequency; if (now - _lastActionTime < cfg.general.cameraSwayFadeInDelay) { _swayFactorTarget = 0.0; } else if (_swayFactor == _swayFactorTarget) { _swayFactorTarget = 1.0; } double num = ((_swayFactorTarget > 0.0) ? cfg.general.cameraSwayFadeInLength : cfg.general.cameraSwayFadeOutLength); double step = ((num > 0.0) ? (dt / num) : 1.0); _swayFactor = MathUtils.StepTowards(_swayFactor, _swayFactorTarget, step); double num2 = _swayFactor * _swayFactor * _swayFactor; if (!(num2 <= 0.0)) { _swayTime += dt * cameraSwayFrequency * 0.5; double num3 = cameraSwayIntensity * num2; _offsetEuler.x += (float)(Noise.Sample(NoiseKind.Fractal, _swayTime, 420.0) * num3); _offsetEuler.y += (float)(Noise.Sample(NoiseKind.Fractal, _swayTime, 1337.0) * num3); } } private void ExhaustionOffset(in CameraContext context, double dt, ConfigData cfg) { double destination = 0.0; if (context.isExhausted) { destination = 1.0; } else if (cfg.general.exhaustionTriggerStamina > 0.0 && (double)context.sprintMeter < cfg.general.exhaustionTriggerStamina) { destination = 1.0 - Math.Max(context.sprintMeter, 0.0) / cfg.general.exhaustionTriggerStamina; } _exhaustionSeverity = MathUtils.Damp(_exhaustionSeverity, destination, 0.02, dt); if (!(_exhaustionSeverity <= 0.01)) { _exhaustionTime += dt * 0.5; double num = cfg.general.exhaustionSwayMultiplier * _exhaustionSeverity * 0.5; _impairOffset.x += (float)(Noise.Sample(NoiseKind.Fractal, _exhaustionTime, 5500.0) * num); _impairOffset.y += (float)(Noise.Sample(NoiseKind.Fractal, _exhaustionTime * 1.1, 6600.0) * num * 0.7); } } private void InsanityOffset(in CameraContext context, double dt, ConfigData cfg) { double insanityTriggerThreshold = cfg.general.insanityTriggerThreshold; if (!(insanityTriggerThreshold >= 1.0) && !((double)context.insanity < insanityTriggerThreshold)) { float num = (float)MathUtils.Clamp01(((double)context.insanity - insanityTriggerThreshold) / (1.0 - insanityTriggerThreshold)); if (!(num <= 0f)) { _insanityTime += dt * (1.0 + (double)num * 1.25); double num2 = cfg.general.insanitySwayMultiplier * (double)num * 0.4; _impairOffset.x += (float)(Noise.Sample(NoiseKind.Fractal, _insanityTime, 7700.0) * num2); _impairOffset.y += (float)(Noise.Sample(NoiseKind.Fractal, _insanityTime * 1.2, 8800.0) * num2 * 0.6); } } } private void TinnitusOffset(double dt, ConfigData cfg) { if (!((Object)(object)SoundManager.Instance == (Object)null) && !(SoundManager.Instance.earsRingingTimer <= 0f)) { double num = MathUtils.Clamp01((double)SoundManager.Instance.earsRingingTimer / 5.0); _tinnitusTime += dt * 1.25; double num2 = cfg.general.tinnitusSwayMultiplier * num; _impairOffset.x += (float)(Noise.Sample(NoiseKind.Simplex, _tinnitusTime, 800.0) * num2); _impairOffset.y += (float)(Noise.Sample(NoiseKind.Simplex, _tinnitusTime * 0.8, 900.0) * num2); _impairOffset.z += (float)(Noise.Sample(NoiseKind.Simplex, _tinnitusTime * 1.1, 1000.0) * num2 * 0.5); } } private void DrunknessOffset(in CameraContext context, double dt, ConfigData cfg) { double destination = MathUtils.Clamp01(context.drunkness); _drunkSeverity = MathUtils.Damp(_drunkSeverity, destination, 0.06, dt); if (_drunkSeverity <= 0.001) { _drunkPitch = MathUtils.Damp(_drunkPitch, 0.0, 0.025, dt); _drunkYaw = MathUtils.Damp(_drunkYaw, 0.0, 0.025, dt); _drunkRoll = MathUtils.Damp(_drunkRoll, 0.0, 0.025, dt); return; } double num = _drunkSeverity * _drunkSeverity * (3.0 - 2.0 * _drunkSeverity); double num2 = MathUtils.Clamp(cfg.general.drunknessSwayMultiplier / 6.0, 0.25, 2.0); double num3 = MathUtils.Lerp(0.18, 0.42, num); _drunkTime += dt * num3; double num4 = 6.5 * num2; double num5 = 3.0 * num2; double num6 = 2.2 * num2; double destination2 = Noise.Sample(NoiseKind.OpenSimplex2, _drunkTime * 0.84, 3000.0) * num4 * num; double destination3 = Noise.Sample(NoiseKind.OpenSimplex2, _drunkTime * 0.58, 4000.0) * num5 * num; double destination4 = Noise.Sample(NoiseKind.OpenSimplex2, _drunkTime * 0.63, 5000.0) * num6 * num; _drunkRoll = MathUtils.Clamp(MathUtils.Damp(_drunkRoll, destination2, 0.025, dt), 0.0 - num4, num4); _drunkPitch = MathUtils.Clamp(MathUtils.Damp(_drunkPitch, destination3, 0.025, dt), 0.0 - num5, num5); _drunkYaw = MathUtils.Clamp(MathUtils.Damp(_drunkYaw, destination4, 0.025, dt), 0.0 - num6, num6); _impairOffset.z += (float)_drunkRoll; _impairOffset.x += (float)_drunkPitch; _impairOffset.y += (float)_drunkYaw; } private void CriticalInjuryOffset(in CameraContext context, double dt, ConfigData cfg) { double destination = (context.criticallyInjured ? 1.0 : 0.0); _criticalSeverity = MathUtils.Damp(_criticalSeverity, destination, 0.05, dt); if (!(_criticalSeverity <= 0.01)) { _criticalTime += dt * 0.35; _criticalPulse += dt * 2.4; double num = 0.75 + 0.25 * Math.Sin(_criticalPulse); double num2 = cfg.general.criticalInjurySwayMultiplier * _criticalSeverity * num; _impairOffset.x += (float)(Noise.Sample(NoiseKind.Fractal, _criticalTime, 9100.0) * num2); _impairOffset.y += (float)(Noise.Sample(NoiseKind.Fractal, _criticalTime * 1.1, 9200.0) * num2 * 0.8); _impairOffset.z += (float)(Noise.Sample(NoiseKind.Fractal, _criticalTime * 0.6, 9300.0) * num2 * 0.4); } } private void PoisonOffset(in CameraContext context, double dt, ConfigData cfg) { if (!(context.poison <= 0f)) { _poisonTime += dt * 1.5; double num = MathUtils.Clamp01(context.poison) * cfg.general.poisonSwayMultiplier; _impairOffset.x += (float)(Noise.Sample(NoiseKind.Simplex, _poisonTime, 10100.0) * num); _impairOffset.y += (float)(Noise.Sample(NoiseKind.Simplex, _poisonTime * 1.3, 10200.0) * num * 0.8); _impairOffset.z += (float)(Noise.Sample(NoiseKind.Simplex, _poisonTime * 0.9, 10300.0) * num * 0.5); } } private void JetpackTurbulenceOffset(in CameraContext context, double dt, ConfigData cfg) { double destination = (context.isUsingJetpack ? 1.0 : 0.0); _jetpackSeverity = MathUtils.Damp(_jetpackSeverity, destination, 0.03, dt); if (!(_jetpackSeverity <= 0.01)) { _jetpackTime += dt * 2.0; double num = cfg.general.jetpackTurbulenceIntensity * _jetpackSeverity; _impairOffset.x += (float)(Noise.Sample(NoiseKind.Fractal, _jetpackTime, 11100.0) * num); _impairOffset.y += (float)(Noise.Sample(NoiseKind.Fractal, _jetpackTime * 1.2, 11200.0) * num); _impairOffset.z += (float)(Noise.Sample(NoiseKind.Fractal, _jetpackTime * 0.8, 11300.0) * num * 0.6); } } private void ShockOffset(in CameraContext context, double dt, ConfigData cfg) { double destination = (context.isBeingShocked ? 1.0 : 0.0); _shockSeverity = MathUtils.Damp(_shockSeverity, destination, 0.02, dt); if (!(_shockSeverity <= 0.01)) { _shockTime += dt * 25.0; double num = cfg.general.shockShakeMultiplier * _shockSeverity; _impairOffset.x += (float)(Noise.Sample(NoiseKind.FrequencyMod, _shockTime, 12100.0) * num); _impairOffset.y += (float)(Noise.Sample(NoiseKind.FrequencyMod, _shockTime * 1.1, 12200.0) * num); _impairOffset.z += (float)(Noise.Sample(NoiseKind.FrequencyMod, _shockTime * 0.9, 12300.0) * num * 0.7); } } private void SinkingTiltOffset(in CameraContext context, ConfigData cfg) { if (!(context.sinkingValue <= 0f)) { double num = MathUtils.Clamp01(context.sinkingValue) * cfg.general.sinkingTiltStrength; _impairOffset.x += (float)num; } } private void WaterOffset(in CameraContext context, double dt, ConfigData cfg) { double destination = ((context.inWater && !context.submerged) ? 1.0 : 0.0); double destination2 = (context.submerged ? 1.0 : 0.0); _waterWadeSeverity = MathUtils.Damp(_waterWadeSeverity, destination, 0.06, dt); _waterSubmergeSeverity = MathUtils.Damp(_waterSubmergeSeverity, destination2, 0.05, dt); if (!(_waterWadeSeverity <= 0.01) || !(_waterSubmergeSeverity <= 0.01)) { _waterTime += dt; if (_waterWadeSeverity > 0.01) { double num = cfg.general.waterWadeStrength * _waterWadeSeverity; double num2 = _waterTime * 0.9; _impairOffset.x += (float)(Noise.Sample(NoiseKind.Fractal, num2, 14100.0) * num * 0.6); _impairOffset.z += (float)(Noise.Sample(NoiseKind.Fractal, num2 * 0.8, 14200.0) * num); } if (_waterSubmergeSeverity > 0.01) { double num3 = cfg.general.waterSubmergedDriftStrength * _waterSubmergeSeverity; double num4 = _waterTime * 0.4; _impairOffset.z += (float)(Noise.Sample(NoiseKind.OpenSimplex2, num4, 14300.0) * num3); _impairOffset.x += (float)(Noise.Sample(NoiseKind.OpenSimplex2, num4 * 0.82, 14400.0) * num3 * 0.8); _impairOffset.y += (float)(Noise.Sample(NoiseKind.OpenSimplex2, num4 * 0.9, 14500.0) * num3 * 0.7); } } } private void LeviathanOffset(in CameraContext context, double dt, ConfigData cfg) { double num = context.leviathanCue switch { LeviathanCue.Emerging => cfg.general.leviathanWarningTremorMultiplier, LeviathanCue.Growl => cfg.general.leviathanGrowlShakeMultiplier, LeviathanCue.Rumble => cfg.general.leviathanRumbleShakeMultiplier, _ => 1.0, }; double destination = cfg.general.leviathanProximityStrength * (double)context.leviathanProximity01 * num; _leviathanIntensity = MathUtils.Damp(_leviathanIntensity, destination, 0.1, dt); if (!(_leviathanIntensity <= 0.0001)) { _leviathanTime += dt * 9.0; _impairOffset.x += (float)(Noise.Sample(NoiseKind.Fractal, _leviathanTime, 15100.0) * _leviathanIntensity); _impairOffset.y += (float)(Noise.Sample(NoiseKind.Fractal, _leviathanTime * 1.1, 15300.0) * _leviathanIntensity * 0.7); _impairOffset.z += (float)(Noise.Sample(NoiseKind.Fractal, _leviathanTime * 0.9, 15200.0) * _leviathanIntensity * 0.8); } } private void FreezeOffset(in CameraContext context, double dt, ConfigData cfg) { double num = (context.inSnow ? 1.0 : (context.shipWithDoorsOpen ? cfg.general.freezeShipOpenDoorTarget : 0.0)); if (context.hasActiveLight) { num *= 1.0 - cfg.general.freezeLightReduce; } double num2 = ((num > _freezeDuration) ? cfg.general.freezeBuildTime : cfg.general.freezeRecoverTime); double step = ((num2 > 0.0) ? (dt / num2) : 1.0); _freezeDuration = MathUtils.StepTowards(_freezeDuration, num, step); if (!(_freezeDuration <= 0.01)) { double num3 = _freezeDuration * _freezeDuration * (3.0 - 2.0 * _freezeDuration); _freezeTime += dt * 9.0; double num4 = cfg.general.freezeStrength * num3; _impairOffset.x += (float)(Noise.Sample(NoiseKind.FrequencyMod, _freezeTime, 16100.0) * num4); _impairOffset.y += (float)(Noise.Sample(NoiseKind.FrequencyMod, _freezeTime * 1.1, 16200.0) * num4 * 0.6); _impairOffset.z += (float)(Noise.Sample(NoiseKind.FrequencyMod, _freezeTime * 0.9, 16300.0) * num4 * 0.8); } } private void FearOffset(double dt, ConfigData cfg) { ConfigData.General general = cfg.general; if (!general.enableFearResponse) { _scare = 0.0; return; } _scare *= Math.Exp((0.0 - dt) / 1.6); double num = _scare * general.fearTremor; if (!(num <= 0.0001)) { _fearTime += dt * 8.0; _impairOffset.x += (float)(Noise.Sample(NoiseKind.Fractal, _fearTime, 17100.0) * num); _impairOffset.y += (float)(Noise.Sample(NoiseKind.Fractal, _fearTime * 1.1, 17200.0) * num * 0.7); _impairOffset.z += (float)(Noise.Sample(NoiseKind.Fractal, _fearTime * 0.9, 17300.0) * num * 0.5); } } private void StaticChargeOffset(in CameraContext context, double dt, ConfigData cfg) { double num = (cfg.general.enableLightningEffect ? cfg.general.lightningTremor : 0.0); double destination = 0.0; if (num > 0.0 && context.hasStaticCharge) { double num2 = context.staticCharge; destination = 0.35 + 0.65 * num2 * num2; } _staticSeverity = MathUtils.Damp(_staticSeverity, destination, 0.02, dt); if (!(num <= 0.0) && !(_staticSeverity <= 0.001)) { _staticTime += dt * 14.0; double num3 = num * _staticSeverity; _impairOffset.x += (float)(Noise.Sample(NoiseKind.FrequencyMod, _staticTime, 18100.0) * num3); _impairOffset.y += (float)(Noise.Sample(NoiseKind.FrequencyMod, _staticTime * 1.1, 18200.0) * num3); _impairOffset.z += (float)(Noise.Sample(NoiseKind.FrequencyMod, _staticTime * 0.9, 18300.0) * num3 * 0.6); } } private void ShipMotionOffset(in CameraContext context, double dt, ConfigData cfg) { bool flag = context.shipTakeoffPhase >= 0f && cfg.general.shipTakeoffShakeStrength > 0.0; bool flag2 = context.shipLandingPhase >= 0f && cfg.general.shipLandingShakeStrength > 0.0; double destination = 0.0; double destination2 = 0.0; if (flag || flag2) { double num2; double num3; if (flag) { double num = MathUtils.Clamp01(context.shipTakeoffPhase); num2 = cfg.general.shipTakeoffShakeStrength; num3 = num * num; double num4 = Math.Max(0.0, 1.0 - num * 3.0); destination2 = (num4 * 1.2 + num3 * 0.8) * num2; } else { double num = MathUtils.Clamp01(context.shipLandingPhase); num2 = cfg.general.shipLandingShakeStrength; num3 = Math.Sin(num * Math.PI); destination2 = num3 * 1.2 * num2; } destination = num2 * num3 * 0.85; } _shipAmp = MathUtils.Damp(_shipAmp, destination, 0.02, dt); _shipPitch = MathUtils.Damp(_shipPitch, destination2, 0.02, dt); if (!(_shipAmp <= 0.0001) || !(Math.Abs(_shipPitch) <= 0.0001)) { _shipTime += dt * 9.0; _offsetEuler.x += (float)(Noise.Sample(NoiseKind.Fractal, _shipTime, 13100.0) * _shipAmp + _shipPitch); _offsetEuler.y += (float)(Noise.Sample(NoiseKind.Fractal, _shipTime * 1.1, 13200.0) * _shipAmp * 0.7); _offsetEuler.z += (float)(Noise.Sample(NoiseKind.Fractal, _shipTime * 0.9, 13300.0) * _shipAmp * 0.8); } } private void CameraSmoothingOffset(in CameraContext context, double dt) { double num = Math.Max(0.0, _ctxCfg.cameraSmoothing); double yaw = context.yaw; double pitch = context.pitch; if (!_msInit || context.resetSmoothing) { _prevYawNorm = yaw; _prevPitchNorm = pitch; _contYaw = yaw; _contPitch = pitch; _smYaw = yaw; _smPitch = pitch; _msInit = true; return; } double num2 = MathUtils.UnwrapStep(yaw - _prevYawNorm); double num3 = MathUtils.UnwrapStep(pitch - _prevPitchNorm); _prevYawNorm = yaw; _prevPitchNorm = pitch; _contYaw += num2; _contPitch += num3; if (num <= 0.001) { _smYaw = _contYaw; _smPitch = _contPitch; return; } double num4 = 16.0 / num; double num5 = 1.0 - Math.Exp((0.0 - num4) * Math.Max(0.0, dt)); _smYaw += (_contYaw - _smYaw) * num5; _smPitch += (_contPitch - _smPitch) * num5; _smYaw = _contYaw + MathUtils.Clamp(_smYaw - _contYaw, -90.0, 90.0); _smPitch = _contPitch + MathUtils.Clamp(_smPitch - _contPitch, -90.0, 90.0); _smoothing.y += (float)MathUtils.UnwrapStep(_smYaw - yaw); _smoothing.x += (float)MathUtils.UnwrapStep(_smPitch - pitch); } } internal static class ScreenShakes { private const float TraumaCeiling = 3f; private const float MaxShakeAngle = 12f; private const NoiseKind ShakeNoise = NoiseKind.FrequencyMod; private static float _trauma; private static float _sustain; private static float _sustainLevel; private static double _shakeTime; private static Vector3 _euler; private const float ProfileRise = 1f / 3f; private static ShakeProfile _profile; private static float _profileScale; private static float _profileTime = -1f; public static Vector3 EulerOffset => _euler; public static void AddTrauma(float amount) { if (amount > 0f) { _trauma = Mathf.Min(_trauma + amount, 3f); } } public static void BumpTrauma(float level) { BumpTrauma(level, 0f); } public static void BumpTrauma(float level, float hold) { if (level <= 0f) { return; } float num = Mathf.Min(level, 3f); if (num > _trauma) { _trauma = num; } if (!(hold <= 0f)) { if (num > _sustainLevel) { _sustainLevel = num; _sustain = hold; } else if (num == _sustainLevel && hold > _sustain) { _sustain = hold; } } } public static void Play(in ShakeProfile profile, float scale) { if (!(scale <= 0f) && !(profile.Amount <= 0f) && !(profile.Length <= 0f)) { _profile = profile; _profileScale = scale; _profileTime = 0f; } } public static void Reset() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) _profileTime = -1f; _trauma = 0f; _sustain = 0f; _sustainLevel = 0f; _shakeTime = 0.0; _euler = Vector3.zero; } public static void OnCameraUpdate(double dt, float master) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) ConfigData.General general = ConfigManager.Data.general; if (_sustain > 0f) { _sustain = Mathf.Max(0f, _sustain - (float)dt); if (_sustain <= 0f) { _sustainLevel = 0f; } } _trauma = Mathf.Max(0f, _trauma - (float)(general.screenShakeDecay * dt)); if (_trauma < _sustainLevel) { _trauma = _sustainLevel; } Vector3 val = (general.enableScreenShake ? ProfileOffset(dt, master) : Vector3.zero); if (!general.enableScreenShake || _trauma <= 0f) { _euler = val; return; } float num = _trauma * _trauma; _shakeTime += dt * general.screenShakesMaxFrequency; float num2 = num * (float)general.screenShakesMaxIntensity * master; _euler = new Vector3(SoftLimit((float)Noise.Sample(NoiseKind.FrequencyMod, _shakeTime, -69.0) * num2), SoftLimit((float)Noise.Sample(NoiseKind.FrequencyMod, _shakeTime, -420.0) * num2), SoftLimit((float)Noise.Sample(NoiseKind.FrequencyMod, _shakeTime, -1337.0) * num2)) + val; } private static Vector3 ProfileOffset(double dt, float master) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) if (_profileTime < 0f) { return Vector3.zero; } _profileTime += (float)dt; if (_profileTime >= _profile.Length) { _profileTime = -1f; return Vector3.zero; } float num = _profile.PeakAt * _profile.Length; float num2 = ((!(_profileTime < num)) ? ((_profile.Length - _profileTime) / (_profile.Length - num)) : ((num > 0f) ? (_profileTime / num) : 1f)); float num3 = _profile.Floor + (1f - _profile.Floor) * Mathf.Clamp01(num2); float num4 = _profileTime * _profile.Rate; int num5 = (int)num4; float num6 = num4 - (float)num5; float num7 = ((num6 < 1f / 3f) ? Smooth(num6 / (1f / 3f)) : Smooth(1f - (num6 - 1f / 3f) / 0.6666666f)); float num8 = (float)Noise.Sample(NoiseKind.FrequencyMod, (double)num5 * 0.61, 271.0); float num9 = _profile.Amount * num3 * num7 * master * _profileScale * (1f - _profile.Vary * 0.5f * (1f - num8)); if (_profile.Flip && (num5 & 1) != 0) { num9 = 0f - num9; } float num10 = (float)Noise.Sample(NoiseKind.FrequencyMod, (double)num5 * 0.37, -913.0); float num11 = (_profile.Angle + _profile.Spread * num10) * (MathF.PI / 180f); return new Vector3(num9 * Mathf.Sin(num11), (0f - num9) * Mathf.Cos(num11), 0f); } private static float Smooth(float t) { t = Mathf.Clamp01(t); return t * t * (3f - 2f * t); } private static float SoftLimit(float angle) { return 12f * (float)Math.Tanh(angle / 12f); } } internal readonly struct ShakeProfile { public readonly float Amount; public readonly float Length; public readonly float PeakAt; public readonly float Floor; public readonly float Angle; public readonly float Spread; public readonly float Rate; public readonly float Vary; public readonly bool Flip; public ShakeProfile(float amount, float length, float peakAt, float floor, float angle, float spread, float rate, float vary, bool flip) { Amount = amount; Length = length; PeakAt = peakAt; Floor = floor; Angle = angle; Spread = spread; Rate = rate; Vary = vary; Flip = flip; } } internal static class LethalConfigCompat { private const string Guid = "ainavt.lc.lethalconfig"; private static bool? _present; public static bool Present { get { bool valueOrDefault = _present == true; if (!_present.HasValue) { valueOrDefault = Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); _present = valueOrDefault; return valueOrDefault; } return valueOrDefault; } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void Register(IReadOnlyList<ConfigEntryBase> entries) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown foreach (ConfigEntryBase entry in entries) { if (!(entry is ConfigEntry<float> val)) { if (!(entry is ConfigEntry<int> val2)) { if (entry is ConfigEntry<bool> val3) { LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(val3, false)); } else { Plugin.Log.LogDebug((object)("Skipping unsupported LethalConfig entry type: " + entry.SettingType.Name)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(val2, false)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(val, false)); } } } } internal static class VisorCompat { public static void StickVisor(Transform? localVisor, Transform? targetPoint, float strength) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)localVisor == (Object)null) && !((Object)(object)targetPoint == (Object)null)) { localVisor.rotation = ((strength >= 0.999f) ? targetPoint.rotation : Quaternion.Slerp(localVisor.rotation, targetPoint.rotation, strength)); } } } internal sealed class ConfigData { public sealed class General { public double masterStrength = 1.0; public double contextTransitionSmoothing = 0.6; public bool enableRoll = true; public bool enablePitch = true; public bool enableSway = true; public bool enableWalkBob = true; public bool enableScreenShake = true; public bool enableLandingDip = true; public bool enableJumpKick = true; public bool enableWeaponShake = true; public bool enableMeleeWeaponShake = true; public bool enableTinnitusEffect = true; public bool enableExhaustionEffect = true; public bool enableInsanityEffect; public bool enableDrunknessEffect = true; public bool enableCriticalInjuryEffect = true; public bool enablePoisonEffect = true; public bool enableJetpackTurbulence = true; public bool enableShockEffect = true; public bool enableSinkingTilt = true; public bool enableWaterEffect = true; public bool enableLeviathanEffects = true; public bool enableJesterShake = true; public bool enableForestGiantEffect = true; public bool enableBrackenSnap = true; public bool enableFreezeEffect = true; public bool enableHealthCondition = true; public bool enableVanillaShakeEvents = true; public bool enableFearResponse = true; public bool enableKnockbackKick = true; public bool followGameBobSetting = true; public bool enableLightningEffect = true; public double turningRollAccumulation = 2.5; public double turningRollIntensity = 3.0; public double turningRollSmoothing = 1.0; public double cameraSwayIntensity = 2.0; public double cameraSwayFrequency = 0.16; public double cameraSwayFadeInDelay = 2.0; public double cameraSwayFadeInLength = 5.0; public double cameraSwayFadeOutLength = 0.75; public double walkBobPitch = 0.35; public double walkBobRoll = 0.3; public double walkBobSprintMultiplier = 1.5; public double carryHunch = 1.5; public double tinnitusSwayMultiplier = 10.0; public double exhaustionSwayMultiplier = 4.0; public double exhaustionTriggerStamina = 0.4; public double insanitySwayMultiplier = 1.0; public double insanityTriggerThreshold = 0.9; public double drunknessSwayMultiplier = 6.0; public double criticalInjurySwayMultiplier = 4.0; public double poisonSwayMultiplier = 6.0; public double jetpackTurbulenceIntensity = 1.5; public double shockShakeMultiplier = 3.0; public double sinkingTiltStrength = 12.0; public double waterWadeStrength = 2.0; public double waterSubmergedDriftStrength = 5.0; public double waterSplashStrength = 5.0; public double leviathanEmergeTrauma = 2.0; public double leviathanEmergeKick = 3.0; public double leviathanProximityStrength = 1.5; public double leviathanProximityRadius = 45.0; public double leviathanWarningTremorMultiplier = 2.5; public double leviathanRumbleShakeMultiplier = 1.5; public double leviathanGrowlShakeMultiplier = 2.5; public double jesterStompTrauma = 1.6; public double jesterStompRadius = 35.0; public double jesterStompFalloff = 2.0; public double forestGiantStompTrauma = 1.0; public double forestGiantStompFalloff = 1.0; public double brackenSnapAngle = 90.0; public double freezeStrength = 0.4; public double freezeBuildTime = 200.0; public double freezeRecoverTime = 30.0; public double freezeLightReduce = 0.35; public double freezeLightRadius = 3.0; public double freezeShipOpenDoorTarget = 0.3; public double screenShakesMaxIntensity = 2.5; public double screenShakesMaxFrequency = 6.0; public double screenShakeDecay = 1.5; public double explosionTrauma = 1.7; public double landingTrauma = 1.0; public double damageTrauma = 3.0; public double damageKick = 4.0; public double vehicleImpactTrauma = 2.0; public double flashbangTrauma = 2.5; public double shipTakeoffShakeStrength = 0.5; public double shipLandingShakeStrength = 0.7; public double weaponShakeTrauma = 1.3; public double weaponRecoilKick = 30.0; public double meleeWeaponShakeTrauma = 1.0; public double meleeWeaponRecoilKick = 5.0; public double meleeWeaponMissMultiplier = 0.5; public double landingDipStrength = 6.0; public double landingTiltStrength = 3.0; public double jumpKickStrength = 5.0; public double landingWeightInfluence = 0.3; public double maxVelocityRoll = 12.0; public double maxVelocityPitch = 10.0; public double healthConditionTriggerLimit = 20.0; public double vanillaShakeStrength = 1.0; public double fearFlinch = 6.0; public double fearTremor = 0.5; public double knockbackKickStrength = 6.0; public double playerBumpKick = 3.0; public double vanillaBobScale = 1.0; public double lightningTremor = 0.2; } public sealed class Contextual { public double strafingRollFactor = 8.0; public double forwardVelocityPitchFactor = 2.0; public double verticalVelocityPitchFactor = 7.0; public double horizontalVelocitySmoothingFactor = 1.0; public double verticalVelocitySmoothingFactor = 1.0; public double cameraSmoothing; public void CopyFrom(Contextual o) { strafingRollFactor = o.strafingRollFactor; forwardVelocityPitchFactor = o.forwardVelocityPitchFactor; verticalVelocityPitchFactor = o.verticalVelocityPitchFactor; horizontalVelocitySmoothingFactor = o.horizontalVelocitySmoothingFactor; verticalVelocitySmoothingFactor = o.verticalVelocitySmoothingFactor; cameraSmoothing = o.cameraSmoothing; } public Contextual Clone() { Contextual contextual = new Contextual(); contextual.CopyFrom(this); return contextual; } public void Lerp(Contextual a, Contextual b, double step) { strafingRollFactor = MathUtils.Lerp(a.strafingRollFactor, b.strafingRollFactor, step); forwardVelocityPitchFactor = MathUtils.Lerp(a.forwardVelocityPitchFactor, b.forwardVelocityPitchFactor, step); verticalVelocityPitchFactor = MathUtils.Lerp(a.verticalVelocityPitchFactor, b.verticalVelocityPitchFactor, step); horizontalVelocitySmoothingFactor = MathUtils.Lerp(a.horizontalVelocitySmoothingFactor, b.horizontalVelocitySmoothingFactor, step); verticalVelocitySmoothingFactor = MathUtils.Lerp(a.verticalVelocitySmoothingFactor, b.verticalVelocitySmoothingFactor, step); cameraSmoothing = MathUtils.Lerp(a.cameraSmoothing, b.cameraSmoothing, step); } } public General general = new General(); public Contextual walking = new Contextual(); public Contextual sprinting = new Contextual(); public Contextual cruiser = new Contextual(); public ConfigData() { sprinting.strafingRollFactor = 10.0; sprinting.forwardVelocityPitchFactor = 9.5; sprinting.verticalVelocityPitchFactor = 8.0; sprinting.cameraSmoothing = 0.0; cruiser.strafingRollFactor = 5.0; cruiser.forwardVelocityPitchFactor = 3.5; cruiser.verticalVelocityPitchFactor = 5.0; cruiser.cameraSmoothing = 0.0; } } internal static class ConfigManager { private sealed class ContextEntries { public ConfigEntry<float> Strafe; public ConfigEntry<float> ForwardPitch; public ConfigEntry<float> VerticalPitch; public ConfigEntry<float> HSmooth; public ConfigEntry<float> VSmooth; public ConfigEntry<float> MouseSmoothing; } private static readonly ConfigData _data = new ConfigData(); private static readonly List<ConfigEntryBase> _entries = new List<ConfigEntryBase>(); private static int _migrated; private static ConfigEntry<float> _masterStrength = null; private static ConfigEntry<float> _contextTransitionSmoothing = null; private static ConfigEntry<float> _maxVelocityRoll = null; private static ConfigEntry<float> _maxVelocityPitch = null; private static ConfigEntry<bool> _enableRoll = null; private static ConfigEntry<bool> _enablePitch = null; private static ConfigEntry<bool> _enableSway = null; private static ConfigEntry<bool> _enableScreenShake = null; private static ConfigEntry<bool> _enableLandingDip = null; private static ConfigEntry<bool> _enableJumpKick = null; private static ConfigEntry<bool> _enableWalkBob = null; private static ConfigEntry<bool> _enableVanillaShakeEvents = null; private static ConfigEntry<bool> _enableFearResponse = null; private static ConfigEntry<bool> _enableKnockbackKick = null; private static ConfigEntry<bool> _followGameBobSetting = null; private static ConfigEntry<float> _vanillaBobScale = null; private static ConfigEntry<float> _vanillaShakeStrength = null; private static ConfigEntry<float> _fearFlinch = null; private static ConfigEntry<float> _fearTremor = null; private static ConfigEntry<float> _knockbackKickStrength = null; private static ConfigEntry<float> _playerBumpKick = null; private static ConfigEntry<bool> _enableLightningEffect = null; private static ConfigEntry<float> _lightningTremor = null; private static ConfigEntry<bool> _enableWeaponShake = null; private static ConfigEntry<bool> _enableMeleeWeaponShake = null; private static ConfigEntry<bool> _enableTinnitusEffect = null; private static ConfigEntry<bool> _enableExhaustionEffect = null; private static ConfigEntry<bool> _enableInsanityEffect = null; private static ConfigEntry<bool> _enableDrunknessEffect = null; private static ConfigEntry<bool> _enableCriticalInjuryEffect = null; private static ConfigEntry<bool> _enablePoisonEffect = null; private static ConfigEntry<bool> _enableJetpackTurbulence = null; private static ConfigEntry<bool> _enableShockEffect = null; private static ConfigEntry<bool> _enableSinkingTilt = null; private static ConfigEntry<bool> _enableWaterEffect = null; private static ConfigEntry<bool> _enableLeviathanEffects = null; private static ConfigEntry<bool> _enableJesterShake = null; private static ConfigEntry<bool> _enableForestGiantEffect = null; private static ConfigEntry<bool> _enableBrackenSnap = null; private static ConfigEntry<bool> _enableFreezeEffect = null; private static ConfigEntry<bool> _enableHealthCondition = null; private static ConfigEntry<float> _turningRollIntensity = null; private static ConfigEntry<float> _turningRollAccumulation = null; private static ConfigEntry<float> _turningRollSmoothing = null; private static ConfigEntry<float> _swayIntensity = null; private static ConfigEntry<float> _swayFrequency = null; private static ConfigEntry<float> _swayFadeInDelay = null; private static ConfigEntry<float> _swayFadeInLength = null; private static ConfigEntry<float> _swayFadeOutLength = null; private static ConfigEntry<float> _tinnitusSwayMultiplier = null; private static ConfigEntry<float> _exhaustionSwayMultiplier = null; private static ConfigEntry<float> _exhaustionTriggerStamina = null; private static ConfigEntry<float> _insanitySwayMultiplier = null; private static ConfigEntry<float> _insanityTriggerThreshold = null; private static ConfigEntry<float> _drunknessSwayMultiplier = null; private static ConfigEntry<float> _criticalInjurySwayMultiplier = null; private static ConfigEntry<float> _poisonSwayMultiplier = null; private static ConfigEntry<float> _jetpackTurbulenceIntensity = null; private static ConfigEntry<float> _shockShakeMultiplier = null; private static ConfigEntry<float> _sinkingTiltStrength = null; private static ConfigEntry<float> _waterWadeStrength = null; private static ConfigEntry<float> _waterSubmergedDriftStrength = null; private static ConfigEntry<float> _waterSplashStrength = null; private static ConfigEntry<float> _leviathanEmergeTrauma = null; private static ConfigEntry<float> _leviathanEmergeKick = null; private static ConfigEntry<float> _leviathanProximityStrength = null; private static ConfigEntry<float> _leviathanProximityRadius = null; private static ConfigEntry<float> _leviathanWarningTremorMultiplier = null; private static ConfigEntry<float> _leviathanRumbleShakeMultiplier = null; private static ConfigEntry<float> _leviathanGrowlShakeMultiplier = null; private static ConfigEntry<float> _jesterStompTrauma = null; private static ConfigEntry<float> _jesterStompRadius = null; private static ConfigEntry<float> _jesterStompFalloff = null; private static ConfigEntry<float> _forestGiantStompTrauma = null; private static ConfigEntry<float> _forestGiantStompFalloff = null; private static ConfigEntry<float> _brackenSnapAngle = null; private static ConfigEntry<float> _freezeStrength = null; private static ConfigEntry<float> _freezeBuildTime = null; private static ConfigEntry<float> _freezeRecoverTime = null; private static ConfigEntry<float> _freezeLightReduce = null; private static ConfigEntry<float> _freezeLightRadius = null; private static ConfigEntry<float> _freezeShipOpenDoorTarget = null; private static ConfigEntry<float> _shakeMaxIntensity = null; private static ConfigEntry<float> _shakeMaxFrequency = null; private static ConfigEntry<float> _shakeDecay = null; private static ConfigEntry<float> _explosionTrauma = null; private static ConfigEntry<float> _landingTrauma = null; private static ConfigEntry<float> _damageTrauma = null; private static ConfigEntry<float> _damageKick = null; private static ConfigEntry<float> _vehicleImpactTrauma = null; private static ConfigEntry<float> _flashbangTrauma = null; private static ConfigEntry<float> _shipTakeoffShakeStrength = null; private static ConfigEntry<float> _shipLandingShakeStrength = null; private static ConfigEntry<float> _weaponShakeTrauma = null; private static ConfigEntry<float> _weaponRecoilKick = null; private static ConfigEntry<float> _meleeWeaponShakeTrauma = null; private static ConfigEntry<float> _meleeWeaponRecoilKick = null; private static ConfigEntry<float> _meleeWeaponMissMultiplier = null; private static ConfigEntry<float> _landingDipStrength = null; private static ConfigEntry<float> _landingTiltStrength = null; private static ConfigEntry<float> _jumpKickStrength = null; private static ConfigEntry<float> _walkBobPitch = null; private static ConfigEntry<float> _walkBobRoll = null; private static ConfigEntry<float> _walkBobSprintMultiplier = null; private static ConfigEntry<float> _carryHunch = null; private static ConfigEntry<float> _landingWeightInfluence = null; private static ConfigEntry<float> _healthConditionTriggerLimit = null; private static readonly ContextEntries _walk = new ContextEntries(); private static readonly ContextEntries _sprint = new ContextEntries(); private static readonly ContextEntries _cruiser = new ContextEntries(); public static ConfigData Data => _data; internal static void Initialize(ConfigFile config) { _entries.Clear(); config.SaveOnConfigSet = false; ConfigData configData = new ConfigData(); Dictionary<ConfigDefinition, string> preBind = SnapshotConfigEntries(config); _masterStrength = BindFloat(config, "1. General", "MasterStrength", (float)configData.general.masterStrength, 0f, 3f, "Scales every effect."); _contextTransitionSmoothing = BindFloat(config, "1. General", "ContextTransitionSmoothing", (float)configData.general.contextTransitionSmoothing, 0f, 0.99f, "How smoothly tuning blends between the '6. Walking', '7. Sprinting' and '8. Cruiser' sections."); _maxVelocityRoll = BindFloat(config, "1. General", "MaxVelocityRoll", (float)configData.general.maxVelocityRoll, 0f, 90f, "Hard cap in degrees on speed driven roll, so fast strafe can never throw camera further than this."); _maxVelocityPitch = BindFloat(config, "1. General", "MaxVelocityPitch", (float)configData.general.maxVelocityPitch, 0f, 90f, "Same cap for speed driven pitch."); _enableHealthCondition = BindBool(config, "1. General", "EnableHealthCondition", configData.general.enableHealthCondition, "Fades the movement roll and pitch out the closer you are to dying. Status effects and screen shake keep their strength."); _healthConditionTriggerLimit = BindFloat(config, "1. General", "HealthConditionTriggerLimit", (float)configData.general.healthConditionTriggerLimit, 0f, 100f, "Health fade starts at."); _enableRoll = BindBool(config, "2. Effect Toggles", "EnableRoll", configData.general.enableRoll, "Strafing lean, tuned in sections 6 to 8, and turning roll, tuned in section 3."); _enablePitch = BindBool(config, "2. Effect Toggles", "EnablePitch", configData.general.enablePitch, "Forward/back and vertical velocity pitch. Same three sections tune it."); _enableSway = BindBool(config, "2. Effect Toggles", "EnableSway", configData.general.enableSway, "Idle camera sway while standing still. '4. Camera Sway' has the timings."); _enableScreenShake = BindBool(config, "2. Effect Toggles", "EnableScreenShake", configData.general.enableScreenShake, "Master switch for every trauma shake: explosions, landings, damage, vanilla shake events. Off also removes the game's own screen shake, so those events go completely still."); _enableLandingDip = BindBool(config, "2. Effect Toggles", "EnableLandingDip", configData.general.enableLandingDip, "Quick downward pitch punch and the sideways tilt when you land hard. Turning this off disables both."); _enableWeaponShake = BindBool(config, "2. Effect Toggles", "EnableWeaponShake", configData.general.enableWeaponShake, "Rattle and upward recoil kick when firing a gun. Someone else shot comes through 'I. Vanilla Shake Events' instead."); _enableMeleeWeaponShake = BindBool(config, "2. Effect Toggles", "EnableMeleeWeaponShake", configData.general.enableMeleeWeaponShake, "Rattle and upward punch when you swing melee weapon."); _turningRollIntensity = BindFloat(config, "3. Turning Roll", "Intensity", (float)configData.general.turningRollIntensity, 0f, 5f, "How far the camera leans when you whip the camera left/right. The default 3 lands around 3.75 degrees."); _turningRollAccumulation = BindFloat(config, "3. Turning Roll", "Accumulation", (float)configData.general.turningRollAccumulation, 0f, 5f, "How quickly fast turning builds the lean up. Higher = reaches full lean sooner."); _turningRollSmoothing = BindFloat(config, "3. Turning Roll", "Smoothing", (float)configData.general.turningRollSmoothing, 0f, 5f, "How quickly the lean settles back to level once you stop turning."); _swayIntensity = BindFloat(config, "4. Camera Sway", "Intensity", (float)configData.general.cameraSwayIntensity, 0f, 5f, "Strength of the idle sway while standing still."); _swayFrequency = BindFloat(config, "4. Camera Sway", "Frequency", (float)configData.general.cameraSwayFrequency, 0f, 2f, "Speed of the idle sway."); _swayFadeInDelay = BindFloat(config, "4. Camera Sway", "FadeInDelay", (float)configData.general.cameraSwayFadeInDelay, 0f, 5f, "Seconds of stillness before the sway starts fading in."); _swayFadeInLength = BindFloat(config, "4. Camera Sway", "FadeInLength", (float)configData.general.cameraSwayFadeInLength, 0f, 20f, "Seconds for the sway to reach full strength once it starts."); _swayFadeOutLength = BindFloat(config, "4. Camera Sway", "FadeOutLength", (float)configData.general.cameraSwayFadeOutLength, 0f, 5f, "Seconds to fade back out when you move."); _shakeMaxIntensity = BindFloat(config, "5. Screen Shake", "MaxIntensity", (float)configData.general.screenShakesMaxIntensity, 0f, 10f, "Degrees of shake at trauma 1. Bigger hits square that, up to a 12 degree ceiling. Vanilla shake events are sized separately in section I."); _shakeMaxFrequency = BindFloat(config, "5. Screen Shake", "MaxFrequency", (float)configData.general.screenShakesMaxFrequency, 0f, 20f, "Screen shake speed. Higher is harsher."); _shakeDecay = BindFloat(config, "5. Screen Shake", "Decay", (float)configData.general.screenShakeDecay, 0.1f, 5f, "Trauma drained per second."); _explosionTrauma = BindFloat(config, "5. Screen Shake", "ExplosionTrauma", (float)configData.general.explosionTrauma, 0f, 3f, "Shake of nearby explosion, scaled by distance."); _landingTrauma = BindFloat(config, "5. Screen Shake", "LandingTrauma", (float)configData.general.landingTrauma, 0f, 3f, "Shake of hard landing, scaled by fall force and carry weight. 'LandingWeightInfluence' sets how much the weight counts."); _damageTrauma = BindFloat(config, "5. Screen Shake", "DamageTrauma", (float)configData.general.damageTrauma, 0f, 3f, "Shake of taking a hit, scaled by how big the hit was."); _damageKick = BindFloat(config, "5. Screen Shake", "DamageKick", (float)configData.general.damageKick, 0f, 20f, "Directional punch away from a hit, scaled by hit size."); _vehicleImpactTrauma = BindFloat(config, "5. Screen Shake", "VehicleImpactTrauma", (float)configData.general.vehicleImpactTrauma, 0f, 3f, "Shake of a hard cruiser crash, scaled by how fast you stopped."); _flashbangTrauma = BindFloat(config, "5. Screen Shake", "FlashbangTrauma", (float)configData.general.flashbangTrauma, 0f, 3f, "Shake of Stun Grenade going off, scaled by distance."); _shipTakeoffShakeStrength = BindFloat(config, "5. Screen Shake", "ShipTakeoffShakeStrength", (float)configData.general.shipTakeoffShakeStrength, 0f, 5f, "Shake that builds as the ship takes off."); _shipLandingShakeStrength = BindFloat(config, "5. Screen Shake", "ShipLandingShakeStrength", (float)configData.general.shipLandingShakeStrength, 0f, 5f, "Shake as the ship lands."); _weaponShakeTrauma = BindFloat(config, "5. Screen Shake", "WeaponShakeTrauma", (float)configData.general.weaponShakeTrauma, 0f, 3f, "Shake of a gunshot."); _weaponRecoilKick = BindFloat(config, "5. Screen Shake", "WeaponRecoilKick", (float)configData.general.weaponRecoilKick, 0f, 60f, "Upward recoil punch per shot."); _meleeWeaponShakeTrauma = BindFloat(config, "5. Screen Shake", "MeleeWeaponShakeTrauma", (float)configData.general.meleeWeaponShakeTrauma, 0f, 3f, "Shake of a melee swing."); _meleeWeaponRecoilKick = BindFloat(config, "5. Screen Shake", "MeleeWeaponRecoilKick", (float)configData.general.meleeWeaponRecoilKick, 0f, 60f, "Upward punch per swing."); _meleeWeaponMissMultiplier = BindFloat(config, "5. Screen Shake", "MeleeWeaponMissMultiplier", (float)configData.general.meleeWeaponMissMultiplier, 0f, 1f, "Multiplier on the swing shake and kick when missing the hit."); _landingDipStrength = BindFloat(config, "5. Screen Shake", "LandingDipStrength", (float)configData.general.landingDipStrength, 0f, 20f, "How far the camera dips on a hard landing."); _landingTiltStrength = BindFloat(config, "5. Screen Shake", "LandingTiltStrength", (float)configData.general.landingTiltStrength, 0f, 20f, "How far the camera tilts toward the side you were moving when you land."); _landingWeightInfluence = BindFloat(config, "5. Screen Shake", "LandingWeightInfluence", (float)configData.general.landingWeightInfluence, 0f, 2f, "How much carry weight hardens a landing."); BindContext(config, "6. Walking", _walk, configData.walking); BindContext(config, "7. Sprinting", _sprint, configData.sprinting); BindContext(config, "8. Cruiser", _cruiser, configData.cruiser); _enableWaterEffect = BindBool(config, "9. Water", "Enabled", configData.general.enableWaterEffect, "Sloshy sway while wading and floaty drift while submerged in water."); _waterWadeStrength = BindFloat(config, "9. Water", "WadeStrength", (float)configData.general.waterWadeStrength, 0f, 10f, "Strength of the slosh while wading."); _waterSubmergedDriftStrength = BindFloat(config, "9. Water", "SubmergedDriftStrength", (float)configData.general.waterSubmergedDriftStrength, 0f, 15f, "Strength of the slow drift while fully under."); _waterSplashStrength = BindFloat(config, "9. Water", "SplashStrength", (float)configData.general.waterSplashStrength, 0f, 10f, "Half a dip when you enter water and a full one when your head goes under."); _enableLeviathanEffects = BindBool(config, "A. Leviathan", "Enabled", configData.general.enableLeviathanEffects, "Shake when an Earth Leviathan bursts out/dives back, plus tremor while it's close and still buried."); _leviathanEmergeTrauma = BindFloat(config, "A. Leviathan", "EmergeTrauma", (float)configData.general.leviathanEmergeTrauma, 0f, 3f, "Shake when it slams down after emerging nearby."); _leviathanEmergeKick = BindFloat(config, "A. Leviathan", "EmergeKick", (float)configData.general.leviathanEmergeKick, 0f, 6f, "Downward punch on that ground slam."); _leviathanProximityStrength = BindFloat(config, "A. Leviathan", "ProximityStrength", (float)configData.general.leviathanProximityStrength, 0f, 5f, "Degrees of tremor while one is buried nearby, before the multipliers below raise it."); _leviathanProximityRadius = BindFloat(config, "A. Leviathan", "ProximityRadius", (float)configData.general.leviathanProximityRadius, 0f, 60f, "Meters within which you feel the buried tremor."); _leviathanWarningTremorMultiplier = BindFloat(config, "A. Leviathan", "WarningTremorMultiplier", (float)configData.general.leviathanWarningTremorMultiplier, 1f, 6f, "How much stronger the tremor gets while it's mid emerge."); _leviathanRumbleShakeMultiplier = BindFloat(config, "A. Leviathan", "RumbleShakeMultiplier", (float)configData.general.leviathanRumbleShakeMultiplier, 0f, 6f, "Extra tremor while buried worm plays its rumble sound."); _leviathanGrowlShakeMultiplier = BindFloat(config, "A. Leviathan", "GrowlShakeMultiplier", (float)configData.general.leviathanGrowlShakeMultiplier, 0f, 6f, "Extra tremor for growl."); _enableFreezeEffect = BindBool(config, "B. Freeze", "Enabled", configData.general.enableFreezeEffect, "Freezing that builds while outside on a snowy moon."); _freezeStrength = BindFloat(config, "B. Freeze", "Strength", (float)configData.general.freezeStrength, 0f, 1f, "Most degrees of freeze at full cold."); _freezeBuildTime = BindFloat(config, "B. Freeze", "BuildSeconds", (float)configData.general.freezeBuildTime, 1f, 600f, "Seconds outside to reach full cold."); _freezeRecoverTime = BindFloat(config, "B. Freeze", "RecoverSeconds", (float)configData.general.freezeRecoverTime, 1f, 600f, "Seconds to warm back up once you're sheltered."); _freezeLightReduce = BindFloat(config, "B. Freeze", "LightReduce", (float)configData.general.freezeLightReduce, 0f, 1f, "How much a light source [ held/nearby ] cuts the freeze."); _freezeLightRadius = BindFloat(config, "B. Freeze", "LightRadius", (float)configData.general.freezeLightRadius, 0f, 30f, "Meters within which a nearby light [ light pole, dropped flashlight ] counts too."); _freezeShipOpenDoorTarget = BindFloat(config, "B. Freeze", "ShipOpenDoorTarget", (float)configData.general.freezeShipOpenDoorTarget, 0f, 1f, "How much freeze is left while in the ship with the hangar doors still open. It clears fully once they close."); _enableJesterShake = BindBool(config, "C. Jester", "Enabled", configData.general.enableJesterShake, "Shake on every stomp of a popped Jester, scaled by distance."); _jesterStompTrauma = BindFloat(config, "C. Jester", "StompTrauma", (float)configData.general.jesterStompTrauma, 0f, 3f, "Shake per stomp before distance falloff."); _jesterStompRadius = BindFloat(config, "C. Jester", "StompRadius", (float)configData.general.jesterStompRadius, 0f, 40f, "Meters within which its stomps reach you."); _jesterStompFalloff = BindFloat(config, "C. Jester", "StompFalloff", (float)configData.general.jesterStompFalloff, 1f, 4f, "How sharply the stomp shake fades with distance. Higher = drops off faster."); _enableForestGiantEffect = BindBool(config, "D. Forest Giant", "Enabled", configData.general.enableForestGiantEffect, "Shake on every step of a Forest Keeper, scaled by distance."); _forestGiantStompTrauma = BindFloat(config, "D. Forest Giant", "StompTrauma", (float)configData.general.forestGiantStompTrauma, 0f, 3f, "Shake strength per stomp of chasing Forest Keeper."); _forestGiantStompFalloff = BindFloat(config, "D. Forest Giant", "StompFalloff", (float)configData.general.forestGiantStompFalloff, 1f, 4f, "How sharply it fades toward the edge of hearing."); _enableBrackenSnap = BindBool(config, "E. Bracken", "Enabled", configData.general.enableBrackenSnap, "Bracken snaps camera to the side when it gets you."); _brackenSnapAngle = BindFloat(config, "E. Bracken", "SnapAngle", (float)configData.general.brackenSnapAngle, 0f, 180f, "Degrees the camera is snapped."); _enableWalkBob = BindBool(config, "F. Walk Bob", "Enabled", configData.general.enableWalkBob, "Camera bob."); _walkBobPitch = BindFloat(config, "F. Walk Bob", "Pitch", (float)configData.general.walkBobPitch, 0f, 3f, "Degrees the camera dips with each step."); _walkBobRoll = BindFloat(config, "F. Walk Bob", "Roll", (float)configData.general.walkBobRoll, 0f, 3f, "Degrees the camera leans side to side over a stride."); _walkBobSprintMultiplier = BindFloat(config, "F. Walk Bob", "SprintMultiplier", (float)configData.general.walkBobSprintMultiplier, 1f, 3f, "How much stronger the bob gets while sprinting."); _carryHunch = BindFloat(config, "F. Walk Bob", "CarryHunch", (float)configData.general.carryHunch, 0f, 5f, "Degrees the camera leans forward under a heavy load."); _followGameBobSetting = BindBool(config, "F. Walk Bob", "FollowGameSetting", configData.general.followGameBobSetting, "Turns the bob off when head bobbing is off in the game's own settings."); _enableJumpKick = BindBool(config, "G. Jump Kick", "Enabled", configData.general.enableJumpKick, "Quick downward dip when jumping."); _jumpKickStrength = BindFloat(config, "G. Jump Kick", "Strength", (float)configData.general.jumpKickStrength, 0f, 10f, "How far the camera dips. Sections 6 to 8 add their own dip from vertical speed."); _vanillaBobScale = BindFloat(config, "H. Vanilla Head Bob", "Scale", (float)configData.general.vanillaBobScale, 0f, 1f, "Scales games own up/down head bob."); _enableVanillaShakeEvents = BindBool(config, "I. Vanilla Shake Events", "Enabled", configData.general.enableVanillaShakeEvents, "Turns games own shake events into real camera shake: spike traps, Old Bird stomps, lightning, bridges, meteors. It replaces the flat screen slide the game does, so off means those events don't shake at all. REQUIRES 'EnableScreenShake'."); _vanillaShakeStrength = BindFloat(config, "I. Vanilla Shake Events", "Strength", (float)configData.general.vanillaShakeStrength, 0f, 3f, "How hard they shake."); _enableFearResponse = BindBool(config, "J. Fear Response", "Enabled", configData.general.enableFearResponse, "Your camera flinches when someone scares you."); _fearFlinch = BindFloat(config, "J. Fear Response", "Flinch", (float)configData.general.fearFlinch, 0f, 10f, "How hard the camera flinches."); _fearTremor = BindFloat(config, "J. Fear Response", "Tremor", (float)configData.general.fearTremor, 0f, 1f, "Degrees of trembling after a scare."); _enableKnockbackKick = BindBool(config, "K. Knockback", "Enabled", configData.general.enableKnockbackKick, "Shakes the camera away from anything that shoves you: meteor blasts, Old Bird stomps, ship magnet, cruiser hits, the fox tongue."); _knockbackKickStrength = BindFloat(config, "K. Knockback", "Strength", (float)configData.general.knockbackKickStrength, 0f, 15f, "How hard a full strength shove punches. Most real shoves land well under that."); _playerBumpKick = BindFloat(config, "K. Knockback", "PlayerBump", (float)configData.general.playerBumpKick, 0f, 15f, "How hard another player running into you shakes the camera. Needs 3 m/s of speed."); _enableLightningEffect = BindBool(config, "L. Lightning", "Enabled", configData.general.enableLightningEffect, "Your camera trembles while you hold a metal item lightning is about to hit."); _lightningTremor = BindFloat(config, "L. Lightning", "Tremor", (float)configData.general.lightningTremor, 0f, 3f, "Degrees of trembling."); _enableTinnitusEffect = BindBool(config, "M. Tinnitus", "Enabled", configData.general.enableTinnitusEffect, "Heavy sway while your ears ring after a blast."); _tinnitusSwayMultiplier = BindFloat(config, "M. Tinnitus", "SwayMultiplier", (float)configData.general.tinnitusSwayMultiplier, 1f, 10f, "Sway while your ears ring."); _enableExhaustionEffect = BindBool(config, "N. Exhaustion", "Enabled", configData.general.enableExhaustionEffect, "Breathing sway as your stamina runs out."); _exhaustionSwayMultiplier = BindFloat(config, "N. Exhaustion", "SwayMultiplier", (float)configData.general.exhaustionSwayMultiplier, 1f, 10f, "Strength of sway."); _exhaustionTriggerStamina = BindFloat(config, "N. Exhaustion", "TriggerStamina", (float)configData.general.exhaustionTriggerStamina, 0.05f, 1f, "Stamina level below which exhaustion sway starts creeping in."); _enableInsanityEffect = BindBool(config, "O. Insanity", "Enabled", configData.general.enableInsanityEffect, "Faster sway as your insanity climbs."); _insanitySwayMultiplier = BindFloat(config, "O. Insanity", "SwayMultiplier", (float)configData.general.insanitySwayMultiplier, 1f, 10f, "Strength of the insanity sway."); _insanityTriggerThreshold = BindFloat(config, "O. Insanity", "TriggerThreshold", (float)configData.general.insanityTriggerThreshold, 0f, 1f, "Fraction of max insanity the sway starts at."); _enableDrunknessEffect = BindBool(config, "P. Drunkness", "Enabled", configData.general.enableDrunknessEffect, "Smooth floating drift while you're on TZP."); _drunknessSwayMultiplier = BindFloat(config, "P. Drunkness", "SwayMultiplier", (float)configData.general.drunknessSwayMultiplier, 1.5f, 12f, "Strength of the drift."); _enableCriticalInjuryEffect = BindBool(config, "Q. Critical Injury", "Enabled", configData.general.enableCriticalInjuryEffect, "Pulsing sway while you're close to death."); _criticalInjurySwayMultiplier = BindFloat(config, "Q. Critical Injury", "SwayMultiplier", (float)configData.general.criticalInjurySwayMultiplier, 1f, 10f, "Strength of that pulse."); _enablePoisonEffect = BindBool(config, "R. Poison", "Enabled", configData.general.enablePoisonEffect, "Jittery sway while poisoned."); _poisonSwayMultiplier = BindFloat(config, "R. Poison", "SwayMultiplier", (float)configData.general.poisonSwayMultiplier, 1f, 10f, "Strength of the jitter."); _enableJetpackTurbulence = BindBool(config, "S. Jetpack", "Enabled", configData.general.enableJetpackTurbulence, "Turbulence while you're flying a jetpack."); _jetpackTurbulenceIntensity = BindFloat(config, "S. Jetpack", "Turbulence", (float)configData.general.jetpackTurbulenceIntensity, 0f, 10f, "Strength of the turbulence."); _enableShockEffect = BindBool(config, "T. Shock", "Enabled", configData.general.enableShockEffect, "Electric jitter while a zap gun zaps."); _shockShakeMultiplier = BindFloat(config, "T. Shock", "ShakeMultiplier", (float)configData.general.shockShakeMultiplier, 0f, 10f, "Strength of the jitter."); _enableSinkingTilt = BindBool(config, "U. Sinking", "Enabled", configData.general.enableSinkingTilt, "Forward tilt as you sink into quicksand."); _sinkingTiltStrength = BindFloat(config, "U. Sinking", "TiltStrength", (float)configData.general.sinkingTiltStrength, 0f, 45f, "Degrees of forward tilt once you're fully sunk."); MigrateToFeatureLayout(preBind); Sync(); config.SettingChanged += delegate { Sync(); }; ClearOrphanedEntries(config); config.Save(); config.SaveOnConfigSet = true; if (LethalConfigCompat.Present) { LethalConfigCompat.Register(_entries); } } private static void BindContext(ConfigFile c, string section, ContextEntries e, ConfigData.Contextual def) { e.Strafe = BindFloat(c, section, "StrafingRollFactor", (float)def.strafingRollFactor, 0f, 30f, "How hard the camera leans into sideways movement. Each of the three sections carries its own value."); e.ForwardPitch = BindFloat(c, section, "ForwardVelocityPitchFactor", (float)def.forwardVelocityPitchFactor, 0f, 30f, "How much the camera pitches with forward and back speed."); e.VerticalPitch = BindFloat(c, section, "VerticalVelocityPitchFactor", (float)def.verticalVelocityPitchFactor, 0f, 30f, "How much the camera pitches with vertical speed."); e.HSmooth = BindFloat(c, section, "HorizontalVelocitySmoothingFactor", (float)def.horizontalVelocitySmoothingFactor, 0f, 10f, "Smoothing for the strafe roll and forward pitch."); e.VSmooth = BindFloat(c, section, "VerticalVelocitySmoothingFactor", (float)def.verticalVelocitySmoothingFactor, 0f, 10f, "Smoothing for the vertical velocity pitch."); e.MouseSmoothing = BindFloat(c, section, "CameraSmoothing", (float)def.cameraSmoothing, 0f, 5f, "Mouse smoothing. 0 is raw input and anything above it adds aim lag."); } private static ConfigEntry<float> BindFloat(ConfigFile c, string section, string key, float def, float min, float max, string desc) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown ConfigEntry<float> val = c.Bind<float>(section, key, def, new ConfigDescription(desc, (AcceptableValueBase)(object)new AcceptableValueRange<float>(min, max), Array.Empty<object>())); _entries.Add((ConfigEntryBase)(object)val); return val; } private static ConfigEntry<bool> BindBool(ConfigFile c, string section, string key, bool def, string desc) { ConfigEntry<bool> val = c.Bind<bool>(section, key, def, desc); _entries.Add((ConfigEntryBase)(object)val); return val; } private static void Sync() { ConfigData.General general = _data.general; general.masterStrength = _masterStrength.Value; general.contextTransitionSmoothing = _contextTransitionSmoothing.Value; general.maxVelocityRoll = _maxVelocityRoll.Value; general.maxVelocityPitch = _maxVelocityPitch.Value; general.enableRoll = _enableRoll.Value; general.enablePitch = _enablePitch.Value; general.enableSway = _enableSway.Value; general.enableScreenShake = _enableScreenShake.Value; general.enableLandingDip = _enableLandingDip.Value; general.enableJumpKick = _enableJumpKick.Value; general.enableWalkBob = _enableWalkBob.Value; general.enableVanillaShakeEvents = _enableVanillaShakeEvents.Value; general.enableFearResponse = _enableFearResponse.Value; general.enableKnockbackKick = _enableKnockbackKick.Value; general.followGameBobSetting = _followGameBobSetting.Value; general.vanillaBobScale = _vanillaBobScale.Value; general.vanillaShakeStrength = _vanillaShakeStrength.Value; general.fearFlinch = _fearFlinch.Value; general.fearTremor = _fearTremor.Value; general.knockbackKickStrength = _knockbackKickStrength.Value; general.playerBumpKick = _playerBumpKick.Value; general.enableLightningEffect = _enableLightningEffect.Value; general.lightningTremor = _lightningTremor.Value; general.enableWeaponShake = _enableWeaponShake.Value; general.enableMeleeWeaponShake = _enableMeleeWeaponShake.Value; general.enableTinnitusEffect = _enableTinnitusEffect.Value; general.enableExhaustionEffect = _enableExhaustionEffect.Value; general.enableInsanityEffect = _enableInsanityEffect.Value; general.enableDrunknessEffect = _enableDrunknessEffect.Value; general.enableCriticalInjuryEffect = _enableCriticalInjuryEffect.Value; general.enablePoisonEffect = _enablePoisonEffect.Value; general.enableJetpackTurbulence = _enableJetpackTurbulence.Value; general.enableShockEffect = _enableShockEffect.Value; general.enableSinkingTilt = _enableSinkingTilt.Value; general.enableWaterEffect = _enableWaterEffect.Value; general.enableLeviathanEffects = _enableLeviathanEffects.Value; general.enableJesterShake = _enableJesterShake.Value; general.enableForestGiantEffect = _enableForestGiantEffect.Value; general.enableBrackenSnap = _enableBrackenSnap.Value; general.enableFreezeEffect = _enableFreezeEffect.Value; general.enableHealthCondition = _enableHealthCondition.Value; general.turningRollIntensity = _turningRollIntensity.Value; general.turningRollAccumulation = _turningRollAccumulation.Value; general.turningRollSmoothing = _turningRollSmoothing.Value; general.cameraSwayIntensity = _swayIntensity.Value; general.cameraSwayFrequency = _swayFrequency.Value; general.cameraSwayFadeInDelay = _swayFadeInDelay.Value; general.cameraSwayFadeInLength = _swayFadeInLength.Value; general.cameraSwayFadeOutLength = _swayFadeOutLength.Value; general.tinnitusSwayMultiplier = _tinnitusSwayMultiplier.Value; general.exhaustionSwayMultiplier = _exhaustionSwayMultiplier.Value; general.exhaustionTriggerStamina = _exhaustionTriggerStamina.Value; general.insanitySwayMultiplier = _insanitySwayMultiplier.Value; general.insanityTriggerThreshold = _insanityTriggerThreshold.Value; general.drunknessSwayMultiplier = _drunknessSwayMultiplier.Value; general.criticalInjurySwayMultiplier = _criticalInjurySwayMultiplier.Value; general.poisonSwayMultiplier = _poisonSwayMultiplier.Value; general.jetpackTurbulenceIntensity = _jetpackTurbulenceIntensity.Value; general.shockShakeMultiplier = _shockShakeMultiplier.Value; general.sinkingTiltStrength = _sinkingTiltStrength.Value; general.waterWadeStrength = _waterWadeStrength.Value; general.waterSubmergedDriftStrength = _waterSubmergedDriftStrength.Value; general.waterSplashStrength = _waterSplashStrength.Value; general.leviathanEmergeTrauma = _leviathanEmergeTrauma.Value; general.leviathanEmergeKick = _leviathanEmergeKick.Value; general.leviathanProximityStrength = _leviathanProximityStrength.Value; general.leviathanProximityRadius = _leviathanProximityRadius.Value; general.leviathanWarningTremorMultiplier = _leviathanWarningTremorMultiplier.Value; general.leviathanRumbleShakeMultiplier = _leviathanRumbleShakeMultiplier.Value; general.leviathanGrowlShakeMultiplier = _leviathanGrowlShakeMultiplier.Value; general.jesterStompTrauma = _jesterStompTrauma.Value; general.jesterStompRadius = _jesterStompRadius.Value; general.jesterStompFalloff = _jesterStompFalloff.Value; general.forestGiantStompTrauma = _forestGiantStompTrauma.Value; general.forestGiantStompFalloff = _forestGiantStompFalloff.Value; general.brackenSnapAngle = _brackenSnapAngle.Value; general.freezeStrength = _freezeStrength.Value; general.freezeBuildTime = _freezeBuildTime.Value; general.freezeRecoverTime = _freezeRecoverTime.Value; general.freezeLightReduce = _freezeLightReduce.Value; general.freezeLightRadius = _freezeLightRadius.Value; general.freezeShipOpenDoorTarget = _freezeShipOpenDoorTarget.Value; general.screenShakesMaxIntensity = _shakeMaxIntensity.Value; general.screenShakesMaxFrequency = _shakeMaxFrequency.Value; general.screenShakeDecay = _shakeDecay.Value; general.explosionTrauma = _explosionTrauma.Value; general.landingTrauma = _landingTrauma.Value; general.damageTrauma = _damageTrauma.Value; general.damageKick = _damageKick.Value; general.vehicleImpactTrauma = _vehicleImpactTrauma.Value; general.flashbangTrauma = _flashbangTrauma.Value; general.shipTakeoffShakeStrength = _shipTakeoffShakeStrength.Value; general.shipLandingShakeStrength = _shipLandingShakeStrength.Value; general.weaponShakeTrauma = _weaponShakeTrauma.Value; general.weaponRecoilKick = _weaponRecoilKick.Value; general.meleeWeaponShakeTrauma = _meleeWeaponShakeTrauma.Value; general.meleeWeaponRecoilKick = _meleeWeaponRecoilKick.Value; general.meleeWeaponMissMultiplier = _meleeWeaponMissMultiplier.Value; general.landingDipStrength = _landingDipStrength.Value; general.landingTiltStrength = _landingTiltStrength.Value; general.jumpKickStrength = _jumpKickStrength.Value; general.walkBobPitch = _walkBobPitch.Value; general.walkBobRoll = _walkBobRoll.Value; general.walkBobSprintMultiplier = _walkBobSprintMultiplier.Value; general.carryHunch = _carryHunch.Value; general.landingWeightInfluence = _landingWeightInfluence.Value; general.healthConditionTriggerLimit = _healthConditionTriggerLimit.Value; SyncContext(_walk, _data.walking); SyncContext(_sprint, _data.sprinting); SyncContext(_cruiser, _data.cruiser); } private static void SyncContext(ContextEntries e, ConfigData.Contextual c) { c.strafingRollFactor = e.Strafe.Value; c.forwardVelocityPitchFactor = e.ForwardPitch.Value; c.verticalVelocityPitchFactor = e.VerticalPitch.Value; c.horizontalVelocitySmoothingFactor = e.HSmooth.Value; c.verticalVelocitySmoothingFactor = e.VSmooth.Value; c.cameraSmoothing = e.MouseSmoothing.Value; } private static Dictionary<ConfigDefinition, string> SnapshotConfigEntries(ConfigFile config) { Dictionary<ConfigDefinition, string> dictionary = new Dictionary<ConfigDefinition, string>(); try { PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries"); if (propertyInfo != null && propertyInfo.GetValue(config) is Dictionary<ConfigDefinition, string> dictionary2) { foreach (KeyValuePair<ConfigDefinition, string> item in dictionary2) { dictionary[item.Key] = item.Value; } } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Could not read existing config for migration: " + ex.Message)); } return dictionary; } private static void MigrateToFeatureLayout(Dictionary<ConfigDefinition, string>