Decompiled source of BWS Mavic Drone v0.6.5
Mods/MavicDrone.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BoneLib; using BoneLib.BoneMenu; using BoneLib.Notifications; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Graphics2.VRS; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.AI; using Il2CppSLZ.Marrow.Combat; using Il2CppSLZ.Marrow.Data; using Il2CppSLZ.Marrow.PuppetMasta; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using LabFusion.Network; using LabFusion.Network.Serialization; using LabFusion.Player; using LabFusion.SDK.Modules; using MavicDrone; using MavicDrone.Drone; using MavicDrone.FX; using MavicDrone.Input; using MavicDrone.Net; using MavicDrone.Screens; using MavicDrone.Settings; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.Win32.SafeHandles; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(/*Could not decode attribute arguments.*/)] [assembly: MelonInfo(typeof(MavicDroneMod), "BWS Mavic Drone", "0.6.3", "Edvin", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: MelonAdditionalDependencies(new string[] { "BoneLib" })] [assembly: SecurityPermission((SecurityAction)8, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace MavicDrone { public sealed class MavicDroneMod : MelonMod { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action<LevelInfo> <>9__11_0; public static Action <>9__11_1; public static Action <>9__11_2; public static Action <>9__11_3; public static Action <>9__14_0; internal void <OnInitializeMelon>b__11_0(LevelInfo _) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Materials.ForgetLit(); Stats.Reset(); Rules.OnLevelLoaded(); Log.Try("Preloading effects", new Action(FxAssets.Preload)); if ((bool)S.AutoSpawn) { DroneManager.Spawn(); } if ((bool)S.ShowVersionOnStart && !_versionShown) { _versionShown = true; ShowVersion(); } } internal void <OnInitializeMelon>b__11_1() { if ((bool)S.PreviewOnPick) { Explosion.Preview(); } } internal void <OnInitializeMelon>b__11_2() { if ((bool)S.SmokePreviewOnPick) { Explosion.PreviewSmoke(); } } internal void <OnInitializeMelon>b__11_3() { if ((bool)S.SmokePreviewOnPick) { Explosion.PreviewSmokeLook(); } } internal void <OnLateUpdate>b__14_0() { VrScreen.LateUpdate(Time.deltaTime); } } public const string DiscordUrl = "https://discord.gg/UkPw3YyJg8"; public const string Version = "0.6.3"; public const string VersionName = "Fireball + dust cloud blasts, refill near you, 45 min battery, 5 km signal, Discord invite only once"; private static bool _versionShown; [field: CompilerGenerated] public static MavicDroneMod Instance { [CompilerGenerated] get; [CompilerGenerated] private set; } public static string BuildDate { get { try { return File.GetLastWriteTime(typeof(MavicDroneMod).Assembly.Location).ToString("yyyy-MM-dd HH:mm"); } catch { return "?"; } } } public static void ShowVersion() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if (!S.Notifications) { return; } try { Notifier.Send(new Notification { Title = NotificationText.op_Implicit("BWS Mavic Drone v0.6.3"), Message = NotificationText.op_Implicit("Built " + BuildDate + "\nFireball + dust cloud blasts, refill near you, 45 min battery, 5 km signal, Discord invite only once"), ShowTitleOnPopup = true, PopupLength = 4f, Type = (NotificationType)0 }); } catch (global::System.Exception e) { Log.Once("Version pop-up", e); } } public override void OnInitializeMelon() { //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Expected O, but got Unknown Instance = this; Log.Init(((MelonBase)this).LoggerInstance); Log.Msg($"Starting BWS Mavic Drone v{"0.6.3"} (built {BuildDate}) - {"Fireball + dust cloud blasts, refill near you, 45 min battery, 5 km signal, Discord invite only once"}"); Log.Step("settings"); DroneSettings.Init(); Log.Step("level hooks"); Hooking.OnLevelLoaded += delegate { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Materials.ForgetLit(); Stats.Reset(); Rules.OnLevelLoaded(); Log.Try("Preloading effects", new Action(FxAssets.Preload)); if ((bool)S.AutoSpawn) { DroneManager.Spawn(); } if ((bool)S.ShowVersionOnStart && !_versionShown) { _versionShown = true; ShowVersion(); } }; EnumSetting<ExplosionKind> explosionType = S.ExplosionType; object obj = <>c.<>9__11_1; if (obj == null) { Action val = delegate { if ((bool)S.PreviewOnPick) { Explosion.Preview(); } }; <>c.<>9__11_1 = val; obj = (object)val; } explosionType.PickedInMenu += (Action)obj; EnumSetting<SmokeKind> smokeType = S.SmokeType; object obj2 = <>c.<>9__11_2; if (obj2 == null) { Action val2 = delegate { if ((bool)S.SmokePreviewOnPick) { Explosion.PreviewSmoke(); } }; <>c.<>9__11_2 = val2; obj2 = (object)val2; } smokeType.PickedInMenu += (Action)obj2; EnumSetting<SmokeStyle> smokeLook = S.SmokeLook; object obj3 = <>c.<>9__11_3; if (obj3 == null) { Action val3 = delegate { if ((bool)S.SmokePreviewOnPick) { Explosion.PreviewSmokeLook(); } }; <>c.<>9__11_3 = val3; obj3 = (object)val3; } smokeLook.PickedInMenu += (Action)obj3; Enumerator<Setting> enumerator = DroneSettings.All.GetEnumerator(); try { while (enumerator.MoveNext()) { Setting current = enumerator.Current; if (current.Category == "Fusion host") { current.Changed += new Action(Rules.HostChanged); } } } finally { ((global::System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } Log.Step("multiplayer"); MavicNet.Init(); ShootDown.Hook(); Hooking.OnLevelUnloaded += new Action(DroneManager.OnLevelUnloaded); Log.Step("BoneMenu"); try { SettingsMenu.Build(); } catch (global::System.Exception e) { Log.Error("BoneMenu page could not be built. Settings still work from UserData/MelonPreferences.cfg.", e); } Log.Step("ready"); Log.Msg("BWS Mavic Drone ready. Open BoneMenu > BWS Mavic Drone to spawn it."); } public override void OnUpdate() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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 //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown float dt = Time.deltaTime; DroneSettings.Tick(); if (DroneManager.Current != null) { Log.Try("Controller input", (Action)delegate { DroneInput.Update(dt); }); } else { DroneInput.Clear(); } DroneInput.Tick(dt); Log.Try("Drone update", (Action)delegate { DroneManager.Update(dt); }); Log.Try("Explosion effects", (Action)delegate { Explosion.Update(dt); }); Log.Try("Multiplayer", (Action)delegate { MavicNet.Update(dt); }); Log.Try("Target range", new Action(TargetRange.Update)); } public override void OnFixedUpdate() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown float dt = Time.fixedDeltaTime; Log.Try("Drone physics", (Action)delegate { DroneManager.FixedUpdate(dt); }); Log.Try("Grenades", (Action)delegate { Grenades.FixedTick(dt); }); } public override void OnLateUpdate() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown object obj = <>c.<>9__14_0; if (obj == null) { Action val = delegate { VrScreen.LateUpdate(Time.deltaTime); }; <>c.<>9__14_0 = val; obj = (object)val; } Log.Try("VR screen", (Action)obj); } public override void OnGUI() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Log.Try("PC monitor view", new Action(DesktopView.OnGUI)); } public override void OnDeinitializeMelon() { PlayerLock.Release(); BodyHider.ShowAll(); PlayStationPad.Stop(); DroneSettings.SaveNow(); DroneManager.OnLevelUnloaded(); VrScreen.Destroy(); } } internal static class Log { private static Instance _logger; private static StreamWriter _file; private static readonly HashSet<string> _logged = new HashSet<string>(); private static readonly HashSet<string> _reported = new HashSet<string>(); public static void Init(Instance logger) { //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_0045: Expected O, but got Unknown _logger = logger; try { string userDataDirectory = MelonEnvironment.UserDataDirectory; string text = Path.Combine(userDataDirectory, "MavicDrone.log"); string text2 = Path.Combine(userDataDirectory, "MavicDrone-prev.log"); if (File.Exists(text)) { File.Copy(text, text2, true); } _file = new StreamWriter(text, false) { AutoFlush = true }; ((TextWriter)_file).WriteLine($"Mavic Drone log - {global::System.DateTime.Now:yyyy-MM-dd HH:mm:ss}"); } catch (global::System.Exception ex) { _file = null; Instance logger2 = _logger; if (logger2 != null) { logger2.Warning("Could not open UserData/MavicDrone.log: " + ex.Message); } } } private static void ToFile(string level, string text) { if (_file == null) { return; } try { ((TextWriter)_file).WriteLine($"[{global::System.DateTime.Now:HH:mm:ss.fff}] {level}{text}"); } catch { _file = null; } } public static void Msg(string text) { Instance logger = _logger; if (logger != null) { logger.Msg(text); } ToFile("", text); } public static void Warn(string text) { Instance logger = _logger; if (logger != null) { logger.Warning(text); } ToFile("WARNING ", text); } public static void Error(string text, global::System.Exception e = null) { string text2 = ((e == null) ? text : (text + "\n" + (object)e)); Instance logger = _logger; if (logger != null) { logger.Error(text2); } ToFile("ERROR ", text2); } public static void Step(string what) { ToFile("step: ", what); } public static void Debug(string text) { if ((bool)S.DebugLogging) { Instance logger = _logger; if (logger != null) { logger.Msg("[debug] " + text); } ToFile("debug ", text); } } public static void Safe(string what, Action action) { if (_reported.Contains(what)) { return; } try { action.Invoke(); } catch (global::System.Exception e) { Once(what, e); } } public static void Try(string what, Action action) { try { action.Invoke(); } catch (global::System.Exception e) { if (_logged.Add(what)) { Error(what + " threw an error (shown once).", e); } } } public static void Once(string key, global::System.Exception e) { if (_reported.Add(key)) { Error(key + " failed. This part of the mod is turned off until restart.", e); } } public static bool HasFailed(string key) { return _reported.Contains(key); } } internal static class Materials { private static Shader _overlay; private static Shader _lit; private static Texture2D _white; public static Texture2D White { get { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_white == (Object)null) { _white = new Texture2D(2, 2, (TextureFormat)4, false) { name = "MavicWhite" }; Color32[] array = (Color32[])(object)new Color32[4]; for (int i = 0; i < 4; i++) { array[i] = new Color32((byte)255, (byte)255, (byte)255, (byte)255); } _white.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array)); _white.Apply(); ((Object)_white).hideFlags = (HideFlags)32; } return _white; } } public static Shader OverlayShader { get { if ((Object)(object)_overlay != (Object)null) { return _overlay; } _overlay = FindShader("UI/Default", "Sprites/Default", "Universal Render Pipeline/Unlit", "Unlit/Texture"); Log.Msg("Screen shader: " + (((Object)(object)_overlay != (Object)null) ? ((Object)_overlay).name : "NONE FOUND")); return _overlay; } } public static Shader LitShader { get { if ((Object)(object)_lit != (Object)null) { return _lit; } _lit = FindShader("SLZ/LitMAS/LitMAS Opaque") ?? FindShaderContaining("LitMAS") ?? FindShader("SLZ/SLZ Standard ACES", "Universal Render Pipeline/Lit", "Standard"); Log.Msg("Drone body shader: " + (((Object)(object)_lit != (Object)null) ? ((Object)_lit).name : "none, using the unlit screen shader")); return _lit; } } public static void ForgetLit() { _lit = null; } public static Shader FindShader(params string[] names) { string[] array = names; foreach (string text in array) { try { Shader val = Shader.Find(text); if ((Object)(object)val != (Object)null && val.isSupported) { return val; } } catch { } } Il2CppReferenceArray<Object> val2 = null; try { val2 = Resources.FindObjectsOfTypeAll(Il2CppType.Of<Shader>()); } catch { } if (val2 == null) { return null; } array = names; foreach (string text2 in array) { global::System.Collections.Generic.IEnumerator<Object> enumerator = ((Il2CppArrayBase<Object>)(object)val2).GetEnumerator(); try { while (((global::System.Collections.IEnumerator)enumerator).MoveNext()) { Object current = enumerator.Current; Shader val3 = ((current != null) ? ((Il2CppObjectBase)current).TryCast<Shader>() : null); if ((Object)(object)val3 != (Object)null && ((Object)val3).name == text2 && val3.isSupported) { return val3; } } } finally { ((global::System.IDisposable)enumerator)?.Dispose(); } } return null; } private static Shader FindShaderContaining(string part) { try { global::System.Collections.Generic.IEnumerator<Object> enumerator = ((Il2CppArrayBase<Object>)(object)Resources.FindObjectsOfTypeAll(Il2CppType.Of<Shader>())).GetEnumerator(); try { while (((global::System.Collections.IEnumerator)enumerator).MoveNext()) { Object current = enumerator.Current; Shader val = ((current != null) ? ((Il2CppObjectBase)current).TryCast<Shader>() : null); if ((Object)(object)val != (Object)null && val.isSupported && ((Object)val).name.IndexOf(part, (StringComparison)5) >= 0 && ((Object)val).name.IndexOf("Transparent", (StringComparison)5) < 0) { return val; } } } finally { ((global::System.IDisposable)enumerator)?.Dispose(); } } catch { } return null; } public static Material Overlay(Texture tex, Color color, int renderQueue) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0033: 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_0043: Expected O, but got Unknown Material val = new Material(OverlayShader) { name = "MavicOverlay", mainTexture = (Texture)(((Object)(object)tex != (Object)null) ? ((object)tex) : ((object)White)) }; SetColor(val, color); val.renderQueue = renderQueue; ((Object)val).hideFlags = (HideFlags)32; return val; } public static Material Lit(Color color) { //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_0028: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) Shader litShader = LitShader; Material val = new Material(((Object)(object)litShader != (Object)null) ? litShader : OverlayShader) { name = "MavicBody" }; string[] array = new string[2] { "_BaseMap", "_MainTex" }; foreach (string text in array) { if (val.HasProperty(text)) { val.SetTexture(text, (Texture)(object)White); } } SetColor(val, color); if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", 0.35f); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", 0.35f); } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", 0.1f); } ((Object)val).hideFlags = (HideFlags)32; return val; } public static void SetColor(Material mat, Color c) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)mat == (Object)null)) { if (mat.HasProperty("_BaseColor")) { mat.SetColor("_BaseColor", c); } if (mat.HasProperty("_Color")) { mat.SetColor("_Color", c); } } } } } namespace MavicDrone.Settings { public enum FlightMode { Normal, Sport, Cine } public enum InputMode { Auto, QuestControllers, Gamepad, Both } public enum FeedResolution { Low480p, Medium720p, High1080p, Ultra1440p } public enum FeedAspect { Wide16x9, Classic4x3, Square1x1 } public enum FeedMsaa { Off, X2, X4 } public enum FeedTint { None, NightGreen, Amber, Cold, Dim } public enum CrosshairStyle { FullLines, Cross, Dot, Box, Brackets } public enum Units { Metric, Imperial } public enum VrAnchor { FirstPerson, Head, LeftWrist, World } public enum DesktopMode { Off, PictureInPicture, Fullscreen } public enum ScreenCorner { TopRight, TopLeft, BottomRight, BottomLeft } public enum SignalLossAction { Hover, ReturnHome, Land } public enum DroneColor { Grey, Black, White, Olive, Tan, Red } public enum DropMode { Single, Pair, Salvo } public enum CloseBlastSound { Mix, Recording1, Recording2, KVN, Off } public enum DiscordOnMenu { FirstTimeOnly, OncePerSession, EveryTime, Never } public enum SmokeKind { WhiteScreen, GreyBattlefield, BlackOil, Red, Green, Yellow, Violet, Orange, Blue, TacticalBurst } public static class S { private const string Flight = "Flight"; public static readonly BoolSetting AutoHover = new BoolSetting("Flight", "auto_hover", "Auto hover", def: true, "Drone holds its height and position when you let go of the sticks."); public static readonly FloatSetting HoverStrength = new FloatSetting("Flight", "hover_strength", "Hover strength", 6f, 1f, 20f, 0.5f, "How hard auto-hover corrects drift."); public static readonly BoolSetting PositionHold = new BoolSetting("Flight", "position_hold", "Position hold", def: true, "Brake to a stop when the move stick is centered."); public static readonly FloatSetting MaxSpeed = new FloatSetting("Flight", "max_speed", "Max speed (m/s)", 15f, 1f, 30f, 0.5f, "Mavic 3 Normal mode: 15 m/s."); public static readonly FloatSetting MaxAscent = new FloatSetting("Flight", "max_ascent", "Max climb (m/s)", 6f, 0.5f, 15f, 0.5f, "Mavic 3: 6 m/s (8 in Sport)."); public static readonly FloatSetting MaxDescent = new FloatSetting("Flight", "max_descent", "Max descent (m/s)", 6f, 0.5f, 15f, 0.5f); public static readonly FloatSetting MaxYawRate = new FloatSetting("Flight", "max_yaw_rate", "Max turn rate (deg/s)", 150f, 10f, 360f, 10f); public static readonly FloatSetting Acceleration = new FloatSetting("Flight", "acceleration", "Acceleration", 8f, 0.5f, 30f, 0.5f); public static readonly FloatSetting Braking = new FloatSetting("Flight", "braking", "Braking", 10f, 0.5f, 30f, 0.5f); public static readonly FloatSetting YawAcceleration = new FloatSetting("Flight", "yaw_acceleration", "Turn acceleration", 540f, 60f, 1440f, 30f); public static readonly EnumSetting<FlightMode> Mode = new EnumSetting<FlightMode>("Flight", "flight_mode", "Flight mode", FlightMode.Normal, "Sport is faster, Cine is slow and smooth."); public static readonly FloatSetting SportMultiplier = new FloatSetting("Flight", "sport_multiplier", "Sport speed x", 1.4f, 1f, 4f, 0.1f, "Mavic 3 Sport: 21 m/s."); public static readonly FloatSetting CineMultiplier = new FloatSetting("Flight", "cine_multiplier", "Cine speed x", 0.35f, 0.1f, 1f, 0.05f); public static readonly FloatSetting PrecisionMultiplier = new FloatSetting("Flight", "precision_multiplier", "Precision speed x", 0.3f, 0.05f, 1f, 0.05f, "Speed while holding precision (Quest right grip / PS5 L2)."); public static readonly FloatSetting MaxAltitude = new FloatSetting("Flight", "max_altitude", "Max altitude (m)", 120f, 5f, 500f, 5f, "Height above the launch point."); public static readonly FloatSetting GroundClearance = new FloatSetting("Flight", "ground_clearance", "Ground clearance (m)", 0.25f, 0f, 3f, 0.05f, "Auto-hover keeps at least this gap to the ground."); public static readonly BoolSetting ObstacleBrake = new BoolSetting("Flight", "obstacle_brake", "Obstacle braking", def: false, "Stops the drone before it flies into walls."); public static readonly BoolSetting WindEnabled = new BoolSetting("Flight", "wind_enabled", "Wind", def: false); public static readonly FloatSetting WindStrength = new FloatSetting("Flight", "wind_strength", "Wind strength (m/s)", 1.5f, 0f, 10f, 0.25f); public static readonly FloatSetting WindDirection = new FloatSetting("Flight", "wind_direction", "Wind direction (deg)", 45f, 0f, 345f, 15f); public static readonly FloatSetting TiltVisual = new FloatSetting("Flight", "tilt_visual", "Body tilt (deg)", 20f, 0f, 45f, 1f, "How far the drone leans when moving."); public static readonly BoolSetting Collisions = new BoolSetting("Flight", "collisions", "Collisions", def: true); public static readonly FloatSetting ReturnHomeSpeed = new FloatSetting("Flight", "return_home_speed", "Return home speed", 8f, 1f, 25f, 0.5f); public static readonly FloatSetting ReturnHomeHeight = new FloatSetting("Flight", "return_home_height", "Return home height (m)", 3f, 0.5f, 30f, 0.5f, "Height above your head the drone flies back at."); public static readonly BoolSetting RealisticFlight = new BoolSetting("Flight", "realistic_flight", "Realistic flight", def: true, "Flies like a real Mavic 3: it tilts to speed up and brake, air drag sets the top speed, gusts push it and the GPS hold catches it again."); public static readonly FloatSetting MaxTilt = new FloatSetting("Flight", "max_tilt", "Max tilt (deg)", 30f, 10f, 45f, 1f, "Normal mode tilt limit (Sport +5, Cine 20). More tilt = faster and quicker to stop."); public static readonly FloatSetting AttitudeResponse = new FloatSetting("Flight", "attitude_response", "Tilt response (s)", 0.2f, 0.05f, 0.8f, 0.05f, "How long the drone takes to lean into a move. Real Mavic about 0.2 s."); public static readonly FloatSetting Turbulence = new FloatSetting("Flight", "turbulence", "Air turbulence", 0.3f, 0f, 1f, 0.05f, "Small wobbles and drift in the air, stronger with wind."); private const string Controls = "Controls"; public static readonly EnumSetting<InputMode> Input = new EnumSetting<InputMode>("Controls", "input_mode", "Input device", InputMode.Auto, "Auto uses whichever controller you touched last (Quest controllers or PS5 pad)."); public static readonly FloatSetting GripThreshold = new FloatSetting("Controls", "grip_threshold", "Grip threshold", 0.6f, 0.1f, 0.95f, 0.05f, "How hard to squeeze grip to pick a grenade type or fly slow."); public static readonly FloatSetting Deadzone = new FloatSetting("Controls", "deadzone", "Stick deadzone", 0.12f, 0f, 0.5f, 0.01f); public static readonly FloatSetting Expo = new FloatSetting("Controls", "expo", "Stick expo", 0.3f, 0f, 1f, 0.05f, "Higher = finer control near center."); public static readonly FloatSetting MoveSensitivity = new FloatSetting("Controls", "move_sensitivity", "Move sensitivity", 1f, 0.1f, 2f, 0.05f); public static readonly FloatSetting LiftSensitivity = new FloatSetting("Controls", "lift_sensitivity", "Up/down sensitivity", 1f, 0.1f, 2f, 0.05f); public static readonly FloatSetting YawSensitivity = new FloatSetting("Controls", "yaw_sensitivity", "Turn sensitivity", 1f, 0.1f, 2f, 0.05f); public static readonly BoolSetting InvertForward = new BoolSetting("Controls", "invert_forward", "Invert forward/back", def: false); public static readonly BoolSetting InvertStrafe = new BoolSetting("Controls", "invert_strafe", "Invert left/right", def: false); public static readonly BoolSetting InvertLift = new BoolSetting("Controls", "invert_lift", "Invert up/down", def: false); public static readonly BoolSetting InvertYaw = new BoolSetting("Controls", "invert_yaw", "Invert turning", def: false); public static readonly BoolSetting SwapSticks = new BoolSetting("Controls", "swap_sticks", "Swap sticks", def: false, "Move on the left stick, height and turning on the right."); public static readonly BoolSetting BlockPlayerInput = new BoolSetting("Controls", "block_player_input", "Freeze body while piloting", def: true, "Stops your character walking and jumping while you fly."); public static readonly BoolSetting VrTriggerDrop = new BoolSetting("Controls", "vr_trigger_drop", "Drop with VR right trigger", def: true, "Quest, Valve Index and other VR controllers drop a grenade with a firm pull of the right trigger while you fly. Turn off to drop only with a gamepad (PS5 R2 / Xbox RT)."); public static readonly FloatSetting VrDropPull = new FloatSetting("Controls", "vr_drop_pull", "VR drop pull", 0.9f, 0.5f, 1f, 0.05f, "How far to pull the right trigger to drop (0.9 = almost all the way), so resting a finger on it never drops."); public static readonly FloatSetting TriggerThreshold = new FloatSetting("Controls", "trigger_threshold", "Trigger threshold", 0.6f, 0.1f, 0.95f, 0.05f); public static readonly IntSetting GamepadIndex = new IntSetting("Controls", "gamepad_index", "Gamepad slot", 0, 0, 3, "Which PS5/PS4 pad to use if several are connected (also the XInput slot)."); public static readonly FloatSetting PilotToggleHold = new FloatSetting("Controls", "pilot_toggle_hold", "Pilot toggle hold (s)", 0.6f, 0f, 2f, 0.1f, "Hold left stick click (Quest) or Options (PS5) this long to start/stop flying."); public static readonly BoolSetting Haptics = new BoolSetting("Controls", "haptics", "Rumble", def: true, "Rumble when a grenade drops or the battery is low."); private const string Cam = "Camera"; public static readonly BoolSetting HideOwnDrone = new BoolSetting("Camera", "hide_own_drone", "Hide the drone in its own camera", def: true, "The camera picture never shows the drone's own body, props or hanging munitions. Everyone else still sees your drone."); public static readonly FloatSetting Fov = new FloatSetting("Camera", "fov", "Field of view", 95f, 30f, 140f, 1f, "Vertical, in degrees. 95 = the KVN drone's first person view, which fills the whole headset."); public static readonly BoolSetting HeadLook = new BoolSetting("Camera", "head_look", "Head look", def: false, "First person: turning your head turns the drone camera. Recenter with Square (PS5) or right grip + left trigger (Quest)."); public static readonly FloatSetting HeadLookYaw = new FloatSetting("Camera", "head_look_yaw", "Head look max left/right", 120f, 0f, 180f, 5f); public static readonly FloatSetting HeadLookPitch = new FloatSetting("Camera", "head_look_pitch", "Head look max up/down", 80f, 0f, 90f, 5f); public static readonly BoolSetting Thermal = new BoolSetting("Camera", "thermal", "Thermal camera", def: false, "White-hot thermal view: the world goes grey and players and NPCs glow. Touchpad (PS5) or right grip + B (Quest) toggles it."); public static readonly FloatSetting ThermalGlow = new FloatSetting("Camera", "thermal_glow", "Thermal body glow", 0.85f, 0.2f, 1f, 0.05f); public static readonly FloatSetting ThermalContrast = new FloatSetting("Camera", "thermal_contrast", "Thermal contrast", 1.4f, 0.5f, 3f, 0.1f); public static readonly BoolSetting FullQualityFeed = new BoolSetting("Camera", "full_quality_feed", "Full quality picture", def: true, "Stops Bonelab from rendering the edges of the drone picture at low resolution (blocky pixels in VR)."); public static readonly FloatSetting MinZoom = new FloatSetting("Camera", "min_zoom", "Min zoom", 1f, 1f, 4f, 0.5f); public static readonly FloatSetting MaxZoom = new FloatSetting("Camera", "max_zoom", "Max zoom", 8f, 1f, 30f, 0.5f); public static readonly FloatSetting ZoomSpeed = new FloatSetting("Camera", "zoom_speed", "Zoom speed", 2f, 0.25f, 8f, 0.25f); public static readonly BoolSetting SteppedZoom = new BoolSetting("Camera", "stepped_zoom", "Stepped zoom", def: false, "Each press doubles or halves the zoom."); public static readonly FloatSetting TiltSpeed = new FloatSetting("Camera", "tilt_speed", "Tilt speed (deg/s)", 60f, 10f, 180f, 5f); public static readonly FloatSetting TiltMin = new FloatSetting("Camera", "tilt_min", "Tilt lowest (deg)", -90f, -90f, 0f, 5f); public static readonly FloatSetting TiltMax = new FloatSetting("Camera", "tilt_max", "Tilt highest (deg)", 20f, 0f, 45f, 5f); public static readonly FloatSetting StartTilt = new FloatSetting("Camera", "start_tilt", "Starting tilt (deg)", -60f, -90f, 30f, 5f); public static readonly BoolSetting InvertTilt = new BoolSetting("Camera", "invert_tilt", "Invert tilt buttons", def: false); public static readonly BoolSetting Stabilize = new BoolSetting("Camera", "stabilize", "Gimbal stabilizer", def: true, "Camera stays level when the drone leans."); public static readonly BoolSetting SnapDownButton = new BoolSetting("Camera", "snap_down_button", "Snap-down button", def: true, "Right stick click (Quest) or R3 (PS5) points the camera straight down."); public static readonly EnumSetting<FeedResolution> Resolution = new EnumSetting<FeedResolution>("Camera", "resolution", "Feed resolution", FeedResolution.Medium720p, "Higher costs more performance."); public static readonly EnumSetting<FeedAspect> Aspect = new EnumSetting<FeedAspect>("Camera", "aspect", "Feed aspect", FeedAspect.Wide16x9); public static readonly EnumSetting<FeedMsaa> Msaa = new EnumSetting<FeedMsaa>("Camera", "msaa", "Feed anti-aliasing", FeedMsaa.X2); public static readonly FloatSetting NearClip = new FloatSetting("Camera", "near_clip", "Near clip (m)", 0.05f, 0.01f, 1f, 0.01f); public static readonly FloatSetting FarClip = new FloatSetting("Camera", "far_clip", "View distance (m)", 1000f, 50f, 5000f, 50f); private const string Feed = "Feed look"; public static readonly BoolSetting Grain = new BoolSetting("Feed look", "grain", "Film grain", def: true); public static readonly FloatSetting GrainAmount = new FloatSetting("Feed look", "grain_amount", "Grain amount", 0.25f, 0f, 1f, 0.05f); public static readonly BoolSetting Scanlines = new BoolSetting("Feed look", "scanlines", "Scanlines", def: false); public static readonly BoolSetting Vignette = new BoolSetting("Feed look", "vignette", "Vignette", def: true); public static readonly FloatSetting VignetteStrength = new FloatSetting("Feed look", "vignette_strength", "Vignette strength", 0.5f, 0f, 1f, 0.05f); public static readonly EnumSetting<FeedTint> Tint = new EnumSetting<FeedTint>("Feed look", "tint", "Color tint", FeedTint.None); public static readonly FloatSetting Brightness = new FloatSetting("Feed look", "brightness", "Brightness", 1f, 0.3f, 1.5f, 0.05f); public static readonly BoolSetting SignalStatic = new BoolSetting("Feed look", "signal_static", "Static at range edge", def: true, "Feed breaks up as you near max signal range."); public static readonly FloatSetting StaticStrength = new FloatSetting("Feed look", "static_strength", "Static strength", 0.8f, 0f, 1f, 0.05f); public static readonly BoolSetting Jitter = new BoolSetting("Feed look", "jitter", "Analog jitter", def: false, "Small shake of the picture, like an analog video link."); public static readonly BoolSetting LowBatteryFlicker = new BoolSetting("Feed look", "low_battery_flicker", "Low battery flicker", def: true); private const string Crosshair = "Crosshair"; public static readonly BoolSetting CrosshairEnabled = new BoolSetting("Crosshair", "crosshair", "Crosshair", def: true); public static readonly EnumSetting<CrosshairStyle> CrossStyle = new EnumSetting<CrosshairStyle>("Crosshair", "crosshair_style", "Style", CrosshairStyle.Cross, "Cross is a small sight in the middle. FullLines draws thin lines across the whole feed."); public static readonly FloatSetting CrossR = new FloatSetting("Crosshair", "crosshair_r", "Red", 1f, 0f, 1f, 0.05f); public static readonly FloatSetting CrossG = new FloatSetting("Crosshair", "crosshair_g", "Green", 1f, 0f, 1f, 0.05f); public static readonly FloatSetting CrossB = new FloatSetting("Crosshair", "crosshair_b", "Blue", 1f, 0f, 1f, 0.05f); public static readonly FloatSetting CrossOpacity = new FloatSetting("Crosshair", "crosshair_opacity", "Opacity", 0.85f, 0.05f, 1f, 0.05f); public static readonly FloatSetting CrossThickness = new FloatSetting("Crosshair", "crosshair_thickness", "Thickness (px)", 2f, 0.5f, 10f, 0.5f, "Measured on a 1080p-high feed."); public static readonly FloatSetting CrossGap = new FloatSetting("Crosshair", "crosshair_gap", "Center gap (px)", 6f, 0f, 100f, 2f); public static readonly FloatSetting CrossLength = new FloatSetting("Crosshair", "crosshair_length", "Arm length", 0.03f, 0.005f, 0.5f, 0.005f, "Size of the Cross, Box and Brackets styles, as a share of feed height."); public static readonly BoolSetting CrossOutline = new BoolSetting("Crosshair", "crosshair_outline", "Dark outline", def: true, "Keeps the lines visible over snow and bright ground."); public static readonly BoolSetting CenterDot = new BoolSetting("Crosshair", "center_dot", "Center dot", def: false); public static readonly FloatSetting CenterDotSize = new FloatSetting("Crosshair", "center_dot_size", "Center dot size (px)", 4f, 1f, 20f, 1f); public static readonly BoolSetting ImpactPredictor = new BoolSetting("Crosshair", "impact_predictor", "Impact predictor", def: false, "Extra marker where a dropped grenade would land right now."); public static readonly BoolSetting RangeTicks = new BoolSetting("Crosshair", "range_ticks", "Tick marks", def: false); private const string Hud = "HUD"; public static readonly BoolSetting HudEnabled = new BoolSetting("HUD", "hud", "HUD", def: true); public static readonly BoolSetting HudAltitude = new BoolSetting("HUD", "hud_altitude", "Height (H)", def: true); public static readonly BoolSetting HudSpeed = new BoolSetting("HUD", "hud_speed", "Speeds (H.S, V.S)", def: true); public static readonly BoolSetting HudDistance = new BoolSetting("HUD", "hud_distance", "Distance (D)", def: true); public static readonly BoolSetting HudBattery = new BoolSetting("HUD", "hud_battery", "Battery and flight time", def: true); public static readonly BoolSetting HudPayload = new BoolSetting("HUD", "hud_payload", "Grenade payload", def: true); public static readonly BoolSetting HudHeading = new BoolSetting("HUD", "hud_heading", "Map circle", def: true, "North-up mini map with the drone arrow, you (blue) and home (H)."); public static readonly BoolSetting HudZoom = new BoolSetting("HUD", "hud_zoom", "Zoom and gimbal", def: true, "Zoom pill, and the gimbal pitch slider while the camera tilts."); public static readonly EnumSetting<Units> UnitSystem = new EnumSetting<Units>("HUD", "units", "Units", Units.Metric); public static readonly FloatSetting HudScale = new FloatSetting("HUD", "hud_scale", "HUD size", 1f, 0.5f, 2f, 0.1f); public static readonly FloatSetting HudOpacity = new FloatSetting("HUD", "hud_opacity", "HUD opacity", 0.9f, 0.1f, 1f, 0.05f); public static readonly BoolSetting HudControlsHint = new BoolSetting("HUD", "hud_controls_hint", "Controls hint (PC)", def: true); public static readonly BoolSetting HudRecDot = new BoolSetting("HUD", "hud_rec_dot", "Record button and timer", def: true, "Shutter shows recording with a timer while you fly."); public static readonly BoolSetting HudRangefinder = new BoolSetting("HUD", "hud_rangefinder", "Laser rangefinder", def: true, "Distance to whatever the crosshair points at, and the marked target (Circle on PS5, right grip + right stick click on Quest)."); public static readonly BoolSetting HudStats = new BoolSetting("HUD", "hud_stats", "Strike stats", def: true, "Drops, blasts, NPC hits and destroyed targets this level."); private const string Screens = "Screens"; public static readonly BoolSetting VrScreen = new BoolSetting("Screens", "vr_screen", "VR screen", def: true); public static readonly EnumSetting<VrAnchor> VrScreenAnchor = new EnumSetting<VrAnchor>("Screens", "vr_anchor", "Headset view", VrAnchor.FirstPerson, "FirstPerson: you see through the drone's eyes like the KVN drone (the picture fills your whole view). Head: floating screen. LeftWrist: wrist monitor. World: screen left in place."); public static readonly FloatSetting FirstPersonSize = new FloatSetting("Screens", "first_person_size", "First person view size", 1f, 0.5f, 1.5f, 0.05f, "1 = true scale (the picture covers exactly the camera's field of view)."); public static readonly FloatSetting HudSpread = new FloatSetting("Screens", "hud_spread", "First person HUD spread", 1f, 0.5f, 1.5f, 0.05f, "How far the HUD sits from the centre in first person. Lower it if text is cut off at the edges of your headset."); public static readonly BoolSetting HideBody = new BoolSetting("Screens", "hide_body", "Hide your hands in drone view", def: true, "Hides your own hands and body from your eyes while you look through the drone. The drone camera still sees you."); public static readonly FloatSetting VrDistance = new FloatSetting("Screens", "vr_distance", "VR screen distance (m)", 1.1f, 0.3f, 4f, 0.05f); public static readonly FloatSetting VrWidth = new FloatSetting("Screens", "vr_width", "VR screen width (m)", 1.5f, 0.2f, 3f, 0.05f); public static readonly FloatSetting VrHeightOffset = new FloatSetting("Screens", "vr_height_offset", "VR screen height", 0f, -1f, 1f, 0.05f); public static readonly FloatSetting VrSideOffset = new FloatSetting("Screens", "vr_side_offset", "VR screen sideways", 0f, -1f, 1f, 0.05f); public static readonly FloatSetting VrFollowSmoothing = new FloatSetting("Screens", "vr_follow_smoothing", "VR screen follow lag", 8f, 0f, 30f, 1f, "0 locks the screen to your head. Higher is smoother."); public static readonly BoolSetting VrOnlyWhenPiloting = new BoolSetting("Screens", "vr_only_piloting", "VR screen only while flying", def: true); public static readonly FloatSetting VrOpacity = new FloatSetting("Screens", "vr_opacity", "VR screen opacity", 1f, 0.2f, 1f, 0.05f); public static readonly FloatSetting WristWidth = new FloatSetting("Screens", "wrist_width", "Wrist screen width (m)", 0.18f, 0.08f, 0.5f, 0.01f); public static readonly EnumSetting<DesktopMode> Desktop = new EnumSetting<DesktopMode>("Screens", "desktop_mode", "PC monitor view", DesktopMode.PictureInPicture, "What the drone feed looks like on your computer screen."); public static readonly FloatSetting PipSize = new FloatSetting("Screens", "pip_size", "PC picture-in-picture size", 0.35f, 0.15f, 0.8f, 0.05f); public static readonly EnumSetting<ScreenCorner> PipCorner = new EnumSetting<ScreenCorner>("Screens", "pip_corner", "PC picture-in-picture corner", ScreenCorner.TopRight); public static readonly BoolSetting DesktopOnlyWhenPiloting = new BoolSetting("Screens", "desktop_only_piloting", "PC view only while flying", def: true); private const string Payload = "Grenades"; public static readonly IntSetting Capacity = new IntSetting("Grenades", "capacity", "Grenade slots", 4, 1, 12); public static readonly BoolSetting StartLoaded = new BoolSetting("Grenades", "start_loaded", "Spawn fully loaded", def: true); public static readonly EnumSetting<GrenadeKind> StartMunition = new EnumSetting<GrenadeKind>("Grenades", "start_munition", "Munition to spawn with", GrenadeKind.VOG25, "What the drone carries when you spawn it. Pick it before spawning (also: BoneMenu > Munitions)."); public static readonly BoolSetting SingleOnSpawn = new BoolSetting("Grenades", "single_on_spawn", "Start in single drop mode", def: true, "Every new drone drops one grenade per press until you change the drop mode in flight."); public static readonly BoolSetting InfiniteGrenades = new BoolSetting("Grenades", "infinite_grenades", "Infinite grenades", def: false, "Ignored in a Fusion lobby unless the host allows it."); public static readonly BoolSetting ReloadNeedsPlayer = new BoolSetting("Grenades", "reload_needs_player", "Reload only near you", def: true, "Loading grenades only works when the drone is close to you."); public static readonly FloatSetting ReloadDistance = new FloatSetting("Grenades", "reload_distance", "Reload distance (m)", 6f, 0.5f, 20f, 0.5f, "How close the drone must be to you (your head, chest or either hand) to reload."); public static readonly BoolSetting AutoReload = new BoolSetting("Grenades", "auto_reload", "Auto reload near you", def: true, "Fly the drone back within the reload distance of you (or land it next to you) and it fills up by itself after half a second, flying or not."); public static readonly FloatSetting DropCooldown = new FloatSetting("Grenades", "drop_cooldown", "Drop cooldown (s)", 0.8f, 0f, 3f, 0.1f, "Minimum time between two drops, so one press never drops two grenades."); public static readonly BoolSetting InheritVelocity = new BoolSetting("Grenades", "inherit_velocity", "Keep drone speed on drop", def: true, "Dropping while moving throws the grenade forward, like a real drop."); public static readonly FloatSetting FuseTime = new FloatSetting("Grenades", "hand_grenade_delay", "F-1 / RGD-5 delay after landing (s)", 3.2f, 0f, 10f, 0.1f, "Hand grenades go off this long after they hit the ground. 0 = on impact."); public static readonly BoolSetting RealisticFall = new BoolSetting("Grenades", "realistic_fall", "Realistic fall", def: true, "Dropped munitions wobble and spin as they fall like in real drone footage: finned rounds rock and roll nose-down, hand grenades tumble, everything bounces when it lands."); public static readonly FloatSetting MunitionWeight = new FloatSetting("Grenades", "munition_weight", "Munition weight x", 1f, 0.25f, 4f, 0.25f, "Every munition has its real weight (F-1 600 g, VOG-25 250 g, M433 230 g). This multiplies it."); public static readonly BoolSetting ShowPayload = new BoolSetting("Grenades", "show_payload", "Show grenades on drone", def: true); public static readonly FloatSetting CustomSpawnScale = new FloatSetting("Grenades", "custom_spawn_scale", "Mod grenade scale", 1f, 0.25f, 3f, 0.05f, "Size of grenades spawned from a mod barcode."); public static readonly EnumSetting<DropMode> DropModeSetting = new EnumSetting<DropMode>("Grenades", "drop_mode", "Drop mode", DropMode.Single, "Single drops one, Pair drops two, Salvo empties the whole payload. Change in flight with Cross (PS5) or right grip + left grip (Quest)."); public static readonly FloatSetting SalvoInterval = new FloatSetting("Grenades", "salvo_interval", "Salvo spacing (s)", 0.25f, 0.05f, 2f, 0.05f); public static readonly FloatSetting ArmingTime = new FloatSetting("Grenades", "arming_time", "Fuze arming time (s)", 0.15f, 0f, 2f, 0.05f, "Impact fuzes only arm after falling this long, so they can't go off on the drone."); public static readonly FloatSetting DudChance = new FloatSetting("Grenades", "dud_chance", "Dud chance", 0f, 0f, 0.5f, 0.01f, "Share of munitions that don't go off, like real field-modified rounds."); public static readonly BoolSetting FinStabilized = new BoolSetting("Grenades", "fin_stabilized", "Tail fins fly nose-down", def: true, "VOG-25, TBG and M433 drop rounds turn nose-first into the wind like real 3D-printed tail fins."); private const string Blast = "Explosions"; public static readonly EnumSetting<ExplosionKind> ExplosionType = new EnumSetting<ExplosionKind>("Explosions", "explosion_type", "Preview type", ExplosionKind.KVN_PG7V, "23 realistic explosions from the KVN drone mod plus the VOG-25, TBG and M433. Picking one sets off a harmless preview in front of you (or at the drone crosshair while flying)."); public static readonly BoolSetting PreviewOnPick = new BoolSetting("Explosions", "preview_on_pick", "Preview when picking a type", def: true); public static readonly FloatSetting PreviewDistance = new FloatSetting("Explosions", "preview_distance", "Preview distance (m)", 13f, 4f, 60f, 1f, "How far in front of you the preview goes off when you're not flying."); public static readonly FloatSetting ExplosionSize = new FloatSetting("Explosions", "explosion_size", "Explosion size", 1f, 0.2f, 4f, 0.1f); public static readonly EnumSetting<DropBlastLook> DropBlast = new EnumSetting<DropBlastLook>("Explosions", "drop_blast_look", "Drop blast look", DropBlastLook.FireballAndDust, "How the drone's munitions go off. FireballAndDust: a yellow fireball that cools into a dense tan dust cloud, like big-blast drone footage but smaller. QuickPuff: the older quick grey-tan puff. Damage is the same either way."); public static readonly FloatSetting SmokeAmount = new FloatSetting("Explosions", "smoke_amount", "Smoke amount", 1f, 0.1f, 3f, 0.1f); public static readonly FloatSetting ExplosionDamage = new FloatSetting("Explosions", "explosion_damage", "Damage multiplier", 2.5f, 0f, 6f, 0.1f, "2.5 = a drop grenade kills anyone right next to it and badly hurts people a few metres away."); public static readonly FloatSetting LethalRadius = new FloatSetting("Explosions", "lethal_radius", "Heavy damage radius (m)", 6f, 0.5f, 20f, 0.25f, "For the KVN PG-7V warhead. Each munition scales it (VOG-25 about 3 m)."); public static readonly FloatSetting DamageRadius = new FloatSetting("Explosions", "damage_radius", "Damage radius (m)", 12f, 1f, 60f, 0.5f, "Blast damage fades out to here (PG-7V size, scaled per munition)."); public static readonly FloatSetting BlastForce = new FloatSetting("Explosions", "blast_force", "Blast force", 1f, 0f, 5f, 0.1f, "How hard things and ragdolls get thrown."); public static readonly BoolSetting DamagePlayer = new BoolSetting("Explosions", "damage_player", "Damage the player", def: true); public static readonly BoolSetting DamageNpcs = new BoolSetting("Explosions", "damage_npcs", "Damage NPCs", def: true); public static readonly BoolSetting CoverProtects = new BoolSetting("Explosions", "cover", "Cover reduces damage", def: true, "Walls between you and the blast take some of it."); public static readonly BoolSetting Shrapnel = new BoolSetting("Explosions", "shrapnel", "Shrapnel", def: true, "Real fragments fly out at ~200 m/s, kick up dust and sparks and hurt what they hit."); public static readonly IntSetting ShrapnelCount = new IntSetting("Explosions", "shrapnel_count", "Shrapnel fragments", 80, 0, 200); public static readonly FloatSetting ShrapnelRange = new FloatSetting("Explosions", "shrapnel_range", "Shrapnel range (m)", 35f, 5f, 120f, 5f); public static readonly FloatSetting ShrapnelDamage = new FloatSetting("Explosions", "shrapnel_damage", "Shrapnel damage", 1f, 0f, 5f, 0.1f); public static readonly BoolSetting SmokeFacesCamera = new BoolSetting("Explosions", "smoke_faces_camera", "Smoke faces every camera", def: true, "Turns each smoke puff toward whichever camera draws it (headset and drone camera). Turn off only if it causes problems."); public static readonly BoolSetting ScorchMarks = new BoolSetting("Explosions", "scorch_marks", "Scorch marks", def: true, "Dark burn mark on the ground where it went off (stays 3 minutes)."); public static readonly EnumSetting<CloseBlastSound> CloseSound = new EnumSetting<CloseBlastSound>("Explosions", "close_sound", "Close blast sound", CloseBlastSound.Mix, "The sharp crack you hear close to a blast. Mix picks one of your two recordings (and the KVN one) at random."); public static readonly BoolSetting BlastShakesFeed = new BoolSetting("Explosions", "blast_shakes_feed", "Blast shakes drone camera", def: true); public static readonly BoolSetting BlastHitsDrone = new BoolSetting("Explosions", "blast_hits_drone", "Blasts hit your drone", def: true, "A blast right next to the drone knocks its motors out (it falls); further away it gets pushed."); public static readonly BoolSetting HitMarkers = new BoolSetting("Explosions", "hit_markers", "Hit confirmation", def: true, "Pop-up on the feed when a blast hits NPCs or targets."); private const string SmokeCat = "Smoke"; public static readonly EnumSetting<SmokeStyle> SmokeLook = new EnumSetting<SmokeStyle>("Smoke", "smoke_look", "Smoke look", SmokeStyle.Mix, "How all smoke is drawn: WispyPuffs, WindStreaks, Billowing, FineSpecks, PlumeRibbon, CurlSwirls, SunLit, SoftVolume, DustAndVeil, or Mix (fine swirling specks + dust skirt). Picking one shows a preview."); public static readonly EnumSetting<SmokeKind> SmokeType = new EnumSetting<SmokeKind>("Smoke", "smoke_type", "Smoke grenade type", SmokeKind.WhiteScreen, "What the SMOKE munition makes. Picking one shows a harmless preview."); public static readonly BoolSetting SmokePreviewOnPick = new BoolSetting("Smoke", "smoke_preview_on_pick", "Preview when picking a type", def: true); public static readonly FloatSetting SmokeWind = new FloatSetting("Smoke", "smoke_wind", "Breeze (m/s)", 2.5f, 0f, 10f, 0.25f, "Smoke always drifts with a light breeze, like in real footage. Flight wind adds to it."); public static readonly FloatSetting SmokeWindDirection = new FloatSetting("Smoke", "smoke_wind_direction", "Breeze direction (deg)", 70f, 0f, 355f, 5f); public static readonly FloatSetting SmokeTurbulence = new FloatSetting("Smoke", "smoke_turbulence", "Turbulence", 0.6f, 0f, 1.5f, 0.05f, "Swirls and billows in the smoke."); public static readonly FloatSetting SmokeDuration = new FloatSetting("Smoke", "smoke_duration", "Smoke grenade time (s)", 40f, 10f, 120f, 5f); public static readonly FloatSetting SmokeDensity = new FloatSetting("Smoke", "smoke_density", "Smoke grenade thickness", 1f, 0.3f, 2.5f, 0.1f); private const string FireCat = "Fire"; public static readonly BoolSetting FireEnabled = new BoolSetting("Fire", "fire_enabled", "Fire", def: false, "Lasting fire after blasts: burning ground, flying burning debris and catching fire. Off by default because it can make explosions lag. The blast's own flash and fireball always show."); public static readonly FloatSetting FireChance = new FloatSetting("Fire", "fire_chance", "Chance of fire", 0.08f, 0f, 1f, 0.01f, "How often the ground keeps burning after a blast (Molotov and TBG always burn more)."); public static readonly FloatSetting FireDuration = new FloatSetting("Fire", "fire_duration", "Fire duration (s)", 45f, 5f, 300f, 5f); public static readonly BoolSetting FireSpreads = new BoolSetting("Fire", "fire_spreads", "Fire spreads", def: true, "Burning ground creeps outward and lights new spots next to it."); public static readonly FloatSetting FireSpreadRate = new FloatSetting("Fire", "fire_spread_rate", "Spread speed", 1f, 0.2f, 3f, 0.1f); public static readonly IntSetting MaxFires = new IntSetting("Fire", "max_fires", "Max burning spots", 24, 4, 80); public static readonly FloatSetting FireDamage = new FloatSetting("Fire", "fire_damage", "Fire damage", 2f, 0f, 6f, 0.1f, "Standing in flames. 1 = the KVN mod's old value."); public static readonly BoolSetting BurnPlayer = new BoolSetting("Fire", "burn_player", "You catch fire", def: true, "Walking into flames or a fireball sets you on fire. Roll on the ground (Ragdoll mod) to put it out."); public static readonly FloatSetting BurnDamage = new FloatSetting("Fire", "burn_damage", "Burning damage (%/s)", 5f, 0f, 30f, 0.5f, "Health lost each second while you are on fire."); public static readonly FloatSetting BurnTime = new FloatSetting("Fire", "burn_time", "Burns out after (s)", 25f, 5f, 120f, 5f, "If you don't roll, the flames die down by themselves after this."); public static readonly BoolSetting BurnNpcs = new BoolSetting("Fire", "burn_npcs", "NPCs catch fire", def: true); private const string DamageCat = "Drone damage"; public static readonly BoolSetting Shootable = new BoolSetting("Drone damage", "shootable", "Can be shot down", def: true, "Bullets hit the drone. Enough hits and it loses power and falls smoking."); public static readonly IntSetting DroneHealth = new IntSetting("Drone damage", "drone_health", "Drone health", 100, 10, 500); public static readonly FloatSetting HitDamage = new FloatSetting("Drone damage", "hit_damage", "Damage per bullet", 34f, 1f, 100f, 1f); public static readonly BoolSetting PayloadDetonates = new BoolSetting("Drone damage", "payload_detonates", "Hit payload explodes", def: true, "A bullet in a hanging grenade sets it off."); public static readonly BoolSetting DamageSmoke = new BoolSetting("Drone damage", "damage_smoke", "Smoke when damaged", def: true); private const string Mp = "Multiplayer"; public static readonly BoolSetting FusionSync = new BoolSetting("Multiplayer", "fusion_sync", "Fusion sync", def: true, "In a Fusion lobby other players see your drone, its drops and explosions, and can shoot it down. Everyone needs this mod."); public static readonly IntSetting SyncRate = new IntSetting("Multiplayer", "sync_rate", "Sync rate (per second)", 15, 5, 40); private const string Host = "Fusion host"; public static readonly BoolSetting HostRules = new BoolSetting("Fusion host", "host_rules", "Use host rules", def: true, "When you host a Fusion lobby these rules are sent to every player and their drones obey them."); public static readonly FloatSetting HostBatteryMinutes = new FloatSetting("Fusion host", "host_battery_minutes", "Battery life (min)", 30f, 1f, 60f, 1f, "Flight time of every drone in your lobby."); public static readonly BoolSetting HostReloadNearPilot = new BoolSetting("Fusion host", "host_reload_near_pilot", "Reload by flying back to the pilot", def: true, "Off = no reloading at all in flight."); public static readonly IntSetting HostReloads = new IntSetting("Fusion host", "host_reloads", "Reloads allowed (0 = unlimited)", 0, 0, 20, "Times each player can refill the payload per level by flying back to themselves. 0 = as often as they like. A new drone always starts full."); public static readonly FloatSetting HostMaxRange = new FloatSetting("Fusion host", "host_max_range", "Max flight distance (m)", 5000f, 30f, 20000f, 50f, "Beyond this the drone loses signal and flies home."); public static readonly FloatSetting HostMaxAltitude = new FloatSetting("Fusion host", "host_max_altitude", "Max altitude (m)", 100f, 10f, 500f, 5f); public static readonly BoolSetting HostBigExplosions = new BoolSetting("Fusion host", "host_big_explosions", "Allow big explosions", def: false, "Off = artillery, mortars, mines, Shahed, Lancet, thermobaric RPG, fuel and C4 blasts are blocked (also as previews)."); public static readonly IntSetting HostMaxSlots = new IntSetting("Fusion host", "host_max_slots", "Max grenade slots", 4, 1, 12); public static readonly BoolSetting HostInfinite = new BoolSetting("Fusion host", "host_infinite", "Allow infinite grenades", def: false); public static readonly BoolSetting HostModGrenades = new BoolSetting("Fusion host", "host_mod_grenades", "Allow mod grenades (barcodes)", def: false); public static readonly FloatSetting HostDropCooldown = new FloatSetting("Fusion host", "host_drop_cooldown", "Min time between drops (s)", 1f, 0f, 10f, 0.25f); public static readonly FloatSetting HostDamage = new FloatSetting("Fusion host", "host_damage", "Explosion damage x", 1f, 0.1f, 3f, 0.1f, "Multiplies every player's damage setting."); public static readonly BoolSetting HostHurtPlayers = new BoolSetting("Fusion host", "host_hurt_players", "Explosions hurt players", def: true); public static readonly BoolSetting HostShootable = new BoolSetting("Fusion host", "host_shootable", "Drones can be shot down", def: true); public static readonly BoolSetting HostPreviews = new BoolSetting("Fusion host", "host_previews", "Allow explosion previews", def: false, "Previews are visible to you only, but they are still noise and light."); public static readonly BoolSetting HostThermal = new BoolSetting("Fusion host", "host_thermal", "Allow thermal camera", def: true); public static readonly BoolSetting HostFireSpread = new BoolSetting("Fusion host", "host_fire_spread", "Fire spreads", def: true); public static readonly BoolSetting HostTargets = new BoolSetting("Fusion host", "host_targets", "Allow target range", def: false); public static readonly FloatSetting HostRespawnCooldown = new FloatSetting("Fusion host", "host_respawn_cooldown", "Drone respawn wait (s)", 15f, 0f, 300f, 5f, "Time before a player can spawn a new drone after the last one."); public static readonly BoolSetting HostNewMavic = new BoolSetting("Fusion host", "host_new_mavic", "New players may fly the Mavic", def: true, "Default for players not set in the Pilots list."); public static readonly BoolSetting HostNewFpv = new BoolSetting("Fusion host", "host_new_fpv", "New players may fly FPV drones", def: true, "Default for players not set in the Pilots list (needs this mod on their game too)."); public static readonly IntSetting HostDroneLimit = new IntSetting("Fusion host", "host_drone_limit", "Drones per player (0 = unlimited)", 0, 0, 50, "How many Mavics each player may spawn in total. Set a different number per person on the Pilots page. Counts are saved, so leaving and rejoining (or restarting the game) doesn't reset them."); public static readonly BoolSetting HostHostAlways = new BoolSetting("Fusion host", "host_always", "Host can always fly", def: true); private const string Range = "Target range"; public static readonly IntSetting TargetCount = new IntSetting("Target range", "target_count", "Targets", 10, 1, 30); public static readonly FloatSetting TargetDistance = new FloatSetting("Target range", "target_distance", "Distance (m)", 30f, 8f, 150f, 2f); public static readonly BoolSetting VehicleTargets = new BoolSetting("Target range", "vehicle_targets", "Vehicles", def: true, "Trucks that blow up their fuel tank and burn when hit hard."); public static readonly BoolSetting InfantryTargets = new BoolSetting("Target range", "infantry_targets", "Infantry dummies", def: true); public static readonly BoolSetting TargetsRespawn = new BoolSetting("Target range", "targets_respawn", "Respawn destroyed targets", def: false, "Destroyed targets come back after 20 seconds."); private const string Battery = "Battery & range"; public static readonly BoolSetting BatteryEnabled = new BoolSetting("Battery & range", "battery", "Battery", def: true); public static readonly FloatSetting BatteryMinutes = new FloatSetting("Battery & range", "battery_minutes", "Flight time (min)", 45f, 1f, 180f, 1f, "How long one battery lasts. It also recharges when the drone sits still near you."); public static readonly FloatSetting SpeedDrain = new FloatSetting("Battery & range", "speed_drain", "Extra drain at speed", 0.5f, 0f, 3f, 0.1f); public static readonly FloatSetting LowBatteryWarning = new FloatSetting("Battery & range", "low_battery_warning", "Low battery warning (%)", 20f, 0f, 50f, 5f); public static readonly FloatSetting AutoReturnBattery = new FloatSetting("Battery & range", "auto_return_battery", "Auto return at (%)", 10f, 0f, 50f, 5f, "0 turns auto return off."); public static readonly FloatSetting SignalRange = new FloatSetting("Battery & range", "signal_range", "Signal range (m)", 5000f, 20f, 20000f, 50f, "How far the drone can fly from you before the picture gets noisy (last 15%) and the signal is lost."); public static readonly EnumSetting<SignalLossAction> SignalLoss = new EnumSetting<SignalLossAction>("Battery & range", "signal_loss_action", "On signal loss", SignalLossAction.ReturnHome); public static readonly BoolSetting RechargeNearPlayer = new BoolSetting("Battery & range", "recharge_near_player", "Recharge near you", def: true); public static readonly FloatSetting RechargeRate = new FloatSetting("Battery & range", "recharge_rate", "Recharge (%/s)", 5f, 0.5f, 50f, 0.5f); private const string Audio = "Audio"; public static readonly BoolSetting AudioEnabled = new BoolSetting("Audio", "audio", "Sound", def: true); public static readonly FloatSetting MotorVolume = new FloatSetting("Audio", "motor_volume", "Motor volume", 0.6f, 0f, 1f, 0.05f); public static readonly FloatSetting MotorPitch = new FloatSetting("Audio", "motor_pitch", "Motor pitch", 1f, 0.5f, 2f, 0.05f); public static readonly FloatSetting AudioRange = new FloatSetting("Audio", "audio_range", "Hearing distance (m)", 70f, 10f, 300f, 5f, "A real Mavic 3 is hard to hear past about 70 m: the sound fades, gets duller, and high up it is gone."); public static readonly FloatSetting ExplosionVolume = new FloatSetting("Audio", "explosion_volume", "Blast volume", 1f, 0f, 2f, 0.05f); public static readonly BoolSetting OnboardAudio = new BoolSetting("Audio", "onboard_audio", "Hear from inside the drone", def: true, "While you fly you hear what the drone hears: its own motors and explosions near the drone, instead of only what's near your body."); public static readonly FloatSetting OnboardVolume = new FloatSetting("Audio", "onboard_volume", "Drone motors inside (volume)", 0.45f, 0f, 1f, 0.05f); private const string Look = "Drone look"; public static readonly FloatSetting DroneScale = new FloatSetting("Drone look", "drone_scale", "Drone size", 1f, 0.5f, 3f, 0.1f); public static readonly EnumSetting<DroneColor> BodyColor = new EnumSetting<DroneColor>("Drone look", "drone_color", "Body color", DroneColor.Grey); public static readonly FloatSetting RotorSpeed = new FloatSetting("Drone look", "rotor_speed", "Rotor spin speed", 1f, 0f, 3f, 0.1f); public static readonly BoolSetting NavLights = new BoolSetting("Drone look", "nav_lights", "Navigation lights", def: true); public static readonly FloatSetting NavBlinkRate = new FloatSetting("Drone look", "nav_blink_rate", "Light blink rate (Hz)", 1f, 0.2f, 5f, 0.1f); public static readonly BoolSetting PropGuards = new BoolSetting("Drone look", "prop_guards", "Propeller guards", def: false); private const string General = "General"; public static readonly FloatSetting SpawnDistance = new FloatSetting("General", "spawn_distance", "Spawn distance (m)", 1.5f, 0.5f, 5f, 0.1f); public static readonly BoolSetting AutoSpawn = new BoolSetting("General", "auto_spawn", "Spawn drone on level load", def: false); public static readonly BoolSetting Notifications = new BoolSetting("General", "notifications", "Notifications (pop-ups)", def: true, "Turn off to hide every pop-up message from this mod. Also at the top of BoneMenu > BWS Mavic Drone."); public static readonly BoolSetting ShowVersionOnStart = new BoolSetting("General", "show_version_on_start", "Show version on start", def: true, "A pop-up with the mod's version and build date when the first level loads (like the KVN drone)."); public static readonly EnumSetting<DiscordOnMenu> DiscordOnMenuOpen = new EnumSetting<DiscordOnMenu>("General", "discord_on_menu", "Open BWS Discord with the menu", DiscordOnMenu.FirstTimeOnly, "FirstTimeOnly: the BWS Discord invite opens in your browser the very first time you open BWS Mavic Drone in BoneMenu, and never again. \"Join the BWS Discord\" in the menu always works."); public static readonly BoolSetting DebugLogging = new BoolSetting("General", "debug_logging", "Debug log", def: false, "Writes extra info to the MelonLoader console."); } public static class DroneSettings { public const string PrefsCategory = "MavicDrone"; public static readonly List<Setting> All = new List<Setting>(); public static readonly List<string> CategoryOrder = new List<string>(); private static MelonPreferences_Category _prefs; private static bool _dirty; private static float _saveAt; private static MelonPreferences_Entry<string> _pilots; private static MelonPreferences_Entry<bool> _discord; [field: CompilerGenerated] public static MelonPreferences_Entry<string>[] CustomBarcodes { [CompilerGenerated] get; [CompilerGenerated] private set; } = global::System.Array.Empty<MelonPreferences_Entry<string>>(); public static string PilotListRaw { get { return _pilots?.Value ?? ""; } set { if (_pilots != null) { _pilots.Value = value ?? ""; MarkDirty(); } } } internal static void Register(Setting setting) { All.Add(setting); if (!CategoryOrder.Contains(setting.Category)) { CategoryOrder.Add(setting.Category); } } public static void Init() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) RuntimeHelpers.RunClassConstructor(typeof(S).TypeHandle); _prefs = MelonPreferences.CreateCategory("MavicDrone", "Mavic Drone"); Enumerator<Setting> enumerator = All.GetEnumerator(); try { while (enumerator.MoveNext()) { enumerator.Current.Bind(_prefs); } } finally { ((global::System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } CustomBarcodes = new MelonPreferences_Entry<string>[3] { _prefs.CreateEntry<string>("custom_barcode_1", "", "Mod grenade 1 barcode", "Barcode of a grenade from another mod (Custom 1 slot). Leave empty to skip.", false, false, (ValueValidator)null, (string)null), _prefs.CreateEntry<string>("custom_barcode_2", "", "Mod grenade 2 barcode", "Barcode for the Custom 2 slot.", false, false, (ValueValidator)null, (string)null), _prefs.CreateEntry<string>("custom_barcode_3", "", "Mod grenade 3 barcode", "Barcode for the Custom 3 slot.", false, false, (ValueValidator)null, (string)null) }; _pilots = _prefs.CreateEntry<string>("host_pilot_list", "", "Fusion host pilot list", "Who may fly (player id = 1 Mavic, 2 FPV, 3 both). Set in BoneMenu > BWS Mavic Drone > Fusion host > Pilots.", true, false, (ValueValidator)null, (string)null); _discord = _prefs.CreateEntry<bool>("discord_opened", false, "Discord opened", "The BWS Discord invite was opened on first start.", true, false, (ValueValidator)null, (string)null); MelonPreferences_Entry<int> val = _prefs.CreateEntry<int>("config_version", 1, "Config version", "Used by the mod to update old settings. Don't edit.", true, false, (ValueValidator)null, (string)null); if (val.Value < 2) { S.CrossStyle.ResetToDefault(); S.CrossGap.ResetToDefault(); S.CrossLength.ResetToDefault(); val.Value = 2; Log.Msg("Updated the crosshair settings to the new small cross."); } if (val.Value < 3) { S.VrScreen.ResetToDefault(); S.VrScreenAnchor.ResetToDefault(); S.VrDistance.ResetToDefault(); S.VrWidth.ResetToDefault(); S.VrHeightOffset.ResetToDefault(); S.BlockPlayerInput.ResetToDefault(); val.Value = 3; Log.Msg("Updated the headset screen to the new bigger size."); } if (val.Value < 4) { S.VrScreenAnchor.ResetToDefault(); S.VrScreen.ResetToDefault(); S.Fov.ResetToDefault(); val.Value = 4; Log.Msg("Headset view switched to Immersive (through the drone camera)."); } if (val.Value < 5) { S.VrScreenAnchor.ResetToDefault(); S.VrScreen.ResetToDefault(); S.Fov.ResetToDefault(); val.Value = 5; Log.Msg("Headset view switched to first person (like the KVN drone)."); } if (val.Value < 6) { Setting[] array = new Setting[7] { S.MaxSpeed, S.MaxAscent, S.MaxDescent, S.MaxYawRate, S.SportMultiplier, S.ExplosionDamage, S.AudioRange }; for (int i = 0; i < array.Length; i++) { array[i].ResetToDefault(); } val.Value = 6; Log.Msg("Updated flight, damage and sound settings for 0.5.0."); } if (val.Value < 7) { S.DropCooldown.ResetToDefault(); S.DropModeSetting.ResetToDefault(); val.Value = 7; } if (val.Value < 8) { S.ReloadDistance.ResetToDefault(); val.Value = 8; } if (val.Value < 9) { Setting[] array = new Setting[5] { S.BatteryMinutes, S.SignalRange, S.HostBatteryMinutes, S.HostMaxRange, S.HostReloads }; for (int i = 0; i < array.Length; i++) { array[i].ResetToDefault(); } val.Value = 9; Log.Msg("Updated battery, signal and reload settings for 0.6.0."); } if (val.Value < 10) { S.DiscordOnMenuOpen.ResetToDefault(); val.Value = 10; } _prefs.SaveToFile(false); Log.Msg($"Loaded {All.Count} settings in {CategoryOrder.Count} categories."); } public static bool FirstStartDiscord() { if (_discord == null || _discord.Value) { return false; } _discord.Value = true; SaveNow(); return true; } public static void MarkDirty() { _dirty = true; _saveAt = Time.realtimeSinceStartup + 1.5f; } public static void Tick() { if (_dirty && _prefs != null && Time.realtimeSinceStartup >= _saveAt) { _dirty = false; _prefs.SaveToFile(false); } } public static void SaveNow() { _dirty = false; MelonPreferences_Category prefs = _prefs; if (prefs != null) { prefs.SaveToFile(false); } } public static void ResetCategory(string category) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) Enumerator<Setting> enumerator = All.GetEnumerator(); try { while (enumerator.MoveNext()) { Setting current = enumerator.Current; if (current.Category == category) { current.ResetToDefault(); } } } finally { ((global::System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } SaveNow(); } public static void ResetAll() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) Enumerator<Setting> enumerator = All.GetEnumerator(); try { while (enumerator.MoveNext()) { enumerator.Current.ResetToDefault(); } } finally { ((global::System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } SaveNow(); } public static int CountIn(string category) { //IL_0007: 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) int num = 0; Enumerator<Setting> enumerator = All.GetEnumerator(); try { while (enumerator.MoveNext()) { if (enumerator.Current.Category == category) { num++; } } return num; } finally { ((global::System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } } public abstract class Setting { [CompilerGenerated] private Action m_Changed; [field: CompilerGenerated] public string Id { [CompilerGenerated] get; } [field: CompilerGenerated] public string Name { [CompilerGenerated] get; } [field: CompilerGenerated] public string Category { [CompilerGenerated] get; } [field: CompilerGenerated] public string Description { [CompilerGenerated] get; } public abstract string ValueText { get; } public event Action Changed { [CompilerGenerated] add { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Action val = this.m_Changed; Action val2; do { val2 = val; Action val3 = (Action)global::System.Delegate.Combine((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value); val = Interlocked.CompareExchange<Action>(ref this.m_Changed, val3, val2); } while (val != val2); } [CompilerGenerated] remove { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Action val = this.m_Changed; Action val2; do { val2 = val; Action val3 = (Action)global::System.Delegate.Remove((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value); val = Interlocked.CompareExchange<Action>(ref this.m_Changed, val3, val2); } while (val != val2); } } protected Setting(string category, string id, string name, string description) { Category = category; Id = id; Name = name; Description = description ?? string.Empty; DroneSettings.Register(this); } internal abstract void Bind(MelonPreferences_Category prefs); internal abstract Element AddToPage(Page page, Color color); public abstract void ResetToDefault(); internal abstract void RefreshElement(); protected void RaiseChanged() { try { Action obj = this.Changed; if (obj != null) { obj.Invoke(); } } catch (global::System.Exception e) { Log.Error("Setting '" + Name + "' change", e); } } } public sealed class FloatSetting : Setting { private float _value; private MelonPreferences_Entry<float> _entry; private FloatElement _element; public override string ValueText => _value.ToString("0.##"); [field: CompilerGenerated] public float Default { [CompilerGenerated] get; } [field: CompilerGenerated] public float Min { [CompilerGenerated] get; } [field: CompilerGenerated] public float Max { [CompilerGenerated] get; } [field: CompilerGenerated] public float Step { [CompilerGenerated] get; } public float Value { get { return _value; } set { _value = Mathf.Clamp(value, Min, Max); if (_entry != null) { _entry.Value = _value; } DroneSettings.MarkDirty(); RaiseChanged(); } } public FloatSetting(string category, string id, string name, float def, float min, float max, float step, string description = null) : base(category, id, name, description) { Default = def; Min = min; Max = max; Step = step; _value = def; } public static implicit operator float(FloatSetting s) { return s._value; } internal override void Bind(MelonPreferences_Category prefs) { _entry = prefs.CreateEntry<float>(base.Id, Default, base.Name, base.Description, false, false, (ValueValidator)null, (string)null); _value = Mathf.Clamp(_entry.Value, Min, Max); } internal override Element AddToPage(Page page, Color color) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _element = page.CreateFloat(base.Name, color, _value, Step, Min, Max, (Action<float>)([CompilerGenerated] (float v) => { Value = v; })); if (!string.IsNullOrEmpty(base.Description)) { ((Element)_element).ElementTooltip = base.Description; } return (Element)(object)_element; } public override void ResetToDefault() { Value = Default; RefreshElement(); } internal override void RefreshElement() { if (_element != null) { _element.Value = _value; } } } public sealed class IntSetting : Setting { private int _value; private MelonPreferences_Entry<int> _entry; private IntElement _element; public override string ValueText => _value.ToString(); [field: CompilerGenerated] public int Default { [CompilerGenerated] get; } [field: CompilerGenerated] public int Min { [CompilerGenerated] get; } [field: CompilerGenerated] public int Max { [CompilerGenerated] get; } public int Value { get { return _value; } set { _value = Mathf.Clamp(value, Min, Max); if (_entry != null) { _entry.Value = _value; } DroneSettings.MarkDirty(); RaiseChanged(); } } public IntSetting(string category, string id, string name, int def, int min, int max, string description = null) : base(category, id, name, description) { Default = def; Min = min; Max = max; _value = def; } public static implicit operator int(IntSetting s) { return s._value; } internal override void Bind(MelonPreferences_Category prefs) { _entry = prefs.CreateEntry<int>(base.Id, Default, base.Name, base.Description, false, false, (ValueValidator)null, (string)null); _value = Mathf.Clamp(_entry.Value, Min, Max); } internal override Element AddToPage(Page page, Color color) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _element = page.CreateInt(base.Name, color, _value, 1, Min, Max, (Action<int>)([CompilerGenerated] (int v) => { Value = v; })); if (!string.IsNullOrEmpty(base.Description)) { ((Element)_element).ElementTooltip = base.Description; } return (Element)(object)_element; } public override void ResetToDefault() { Value = Default; RefreshElement(); } internal override void RefreshElement() { if (_element != null) { _element.Value = _value; } } } public sealed class BoolSetting : Setting { private bool _value; private MelonPreferences_Entry<bool> _entry; private BoolElement _element; public override string ValueText { get { if (!_value) { return "Off"; } return "On"; } } [field: CompilerGenerated] public bool Default { [CompilerGenerated] get; } public bool Value { get { return _value; } set { _value = value; if (_entry != null) { _entry.Value = _value; } DroneSettings.MarkDirty(); RaiseChanged(); } } public BoolSetting(string category, string id, string name, bool def, string description = null) : base(category, id, name, description) { Default = def; _value = def; } public static implicit operator bool(BoolSetting s) { return s._value; } internal override void Bind(MelonPreferences_Category prefs) { _entry = prefs.CreateEntry<bool>(base.Id, Default, base.Name, base.Description, false, false, (ValueValidator)null, (string)null); _value = _entry.Value; } internal override Element AddToPage(Page page, Color color) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _element = page.CreateBool(base.Name, color, _value, (Action<bool>)([CompilerGenerated] (bool v) => { Value = v; })); if (!string.IsNullOrEmpty(base.Description)) { ((Element)_element).ElementTooltip = base.Description; } return (Element)(object)_element; } public override void ResetToDefault() { Value = Default; RefreshElement(); } internal override void RefreshElement() { if (_element != null) { _element.Value = _value; } } } public sealed class EnumSetting<T> : Setting where T : struct, global::System.Enum { private T _value; private MelonPreferences_Entry<string> _entry; private EnumElement _element; public override string ValueText => ((object)_value/*cast due to .constrained prefix*/).ToString(); public T Default { [CompilerGenerated] get; } public T Value { get { return _value; } set { _value = value; if (_entry != null) { _entry.Value = ((object)_value/*cast due to .constrained prefix*/).ToString(); } DroneSettings.MarkDirty(); RaiseChanged(); } } public event Action PickedInMenu { [CompilerGenerated] add { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Action val = this.PickedInMenu; Action val2; do { val2 = val; Action val3 = (Action)global::System.Delegate.Combine((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value); val = Interlocked.CompareExchange<Action>(ref this.PickedInMenu, val3, val2); } while (val != val2); } [CompilerGenerated] remove { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Action val = this.PickedInMenu; Action val2; do { val2 = val; Action val3 = (Action)global::System.Delegate.Remove((global::System.Delegate)(object)val2, (global::System.Delegate)(object)value); val = Interlocked.CompareExchange<Action>(ref this.PickedInMenu, val3, val2); } while (val != val2); } } public EnumSetting(string category, string id, string name, T def, string description = null) : base(category, id, name, description) { Default = def; _value = def; } public static implicit operator T(EnumSetting<T> s) { return s._value; } internal override void Bind(MelonPreferences_Category prefs) { _entry = prefs.CreateEntry<string>(base.Id, ((object)Default/*cast due to .constrained prefix*/).ToString(), base.Name, base.Description + " Options: " + string.Join(", ", global::System.Enum.GetNames(typeof(T))), false, false, (ValueValidator)null, (string)null); T val = default(T); _value = (global::System.Enum.TryParse<T>(_entry.Value, true, ref val) ? val : Default); } internal override Element AddToPage(Page page, Color color) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) _element = page.CreateEnum(base.Name, color, (global::System.Enum)_value, (Action<global::System.Enum>)([CompilerGenerated] (global::System.Enum v) => { Value = (T)v; try { Action obj = this.PickedInMenu; if (obj != null) { obj.Invoke(); } } catch (global::System.Exception e) { Log.Error("Setting '" + base.Name + "' change", e); } })); if (!string.IsNullOrEmpty(base.Description)) { ((Element)_element).ElementTooltip = base.Description; } return (Element)(object)_element; } public override void ResetToDefault() { Value = Default; RefreshElement(); } internal override void RefreshElement() { if (_element != null) { _element.Value = _value; } } } internal static class SettingsMenu { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__11_0; public static Action<bool> <>9__11_1; public static Action <>9__11_2; public static Action <>9__11_3; public static Action <>9__11_4; public static Action <>9__11_5; public static Action <>9__11_6; public static Predicate<GrenadeKind> <>9__12_2; public static Action <>9__12_0; public static Action <>9__13_0; public static Action <>9__13_1; public static Action <>9__14_0; public static Action <>9__14_1; public static Action <>9__14_2; public static Action <>9__15_0; public static Action <>9__15_1; public static Action <>9__15_2; public static Action <>9__16_0; public static Action <>9__16_1; public static Action <>9__17_0; public static Action <>9__17_1; public static Action <>9__18_0; public static Action <>9__20_0; public static Action <>9__20_1; internal void <Build>b__11_0() { try { Application.OpenURL("https://discord.gg/UkPw3YyJg8"); Log.Msg("Opened the BWS Discord invite (menu button)."); } catch (global::System.Exception e) { Log.Once("Discord link", e); } } internal void <Build>b__11_1(bool v) { S.Notifications.Value = v; } internal void <Build>b__11_2() { DroneManager.Current?.ReturnHome(); } internal void <Build>b__11_3() { DroneManager.Current?.Land(); } internal void <Build>b__11_4() { DroneManager.Current?.LoadFull(); } internal void <Build>b__11_5() { DroneManager.Current?.Camera.Recenter(); } internal void <Build>b__11_6() { if (!Rules.ThermalAllowed) { DroneManager.Notify("Thermal off", "The Fusion host has turned the thermal camera off."); } else { S.Thermal.Value = !S.Thermal; } } internal void <BuildMunitions>b__12_0() { DroneRig current = DroneManager.Current; if (current != null) { GrenadeKind grenadeKind = Grenades.Available().Find((Predicate<GrenadeKind>)((GrenadeKind x) => x >= GrenadeKind.Custom1)); if (grenadeKind >= GrenadeKind.Custom1) { current.LoadAll(grenadeKind); } else { DroneManager.Notify("No mod grenades", "Put a barcode in custom_barcode_1 in UserData/MelonPreferences.cfg (and the host must allow them)."); } } } internal bool <BuildMunitions>b__12_2(GrenadeKind x) { return x >= GrenadeKind.Custom1; } internal void <BuildExplosions>b__13_0() { Explosion.Preview(); } internal void <BuildExplosions>b__13_1() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) Vector3 target; if (!Rules.Previews || !Rules.CanFlyMavic) { DroneManager.Notify("Blocked by host", "Not allowed in this lobby."); } else if (Explosion.InFrontOfPlayer(S.PreviewDistance, out target)) { Explosion.Explode(target, 1f, -1, authority: true, (int)S.ExplosionType.Value); } } internal void <BuildSmoke>b__14_0() { Explosion.PreviewSmoke(); } internal void <BuildSmoke>b__14_1() { Explosion.PreviewSmoke(); } internal void <BuildSmoke>b__14_2() { DroneManager.Notify("Smoke grenades", SmokeProfile.Get((int)S.SmokeType.Value).Name + " (change in Settings > Weapons & effects > Smoke)"); } internal void <BuildTargets>b__15_0() { DroneManager.Current?.MarkAtCrosshair(); } internal void <BuildTargets>b__15_1() { DroneManager.Current?.ClearMark(); } internal void <BuildTargets>b__15_2() { DroneManager.Notify("Strike stats", Stats.Summary); } internal void <BuildHost>b__16_0() { string message = ((!MavicNet.Available) ? "Fusion is not installed." : ((!MavicNet.InServer) ? "Not in a Fusion lobby. Host one and these rules go to every player." : ((!MavicNet.IsHost) ? ((Rules.Current != null) ? $"Host rules active: battery {Rules.Current.BatteryMinutes:0.#} min, range {Rules.Current.MaxRange:0} m, reloads {((!Rules.Current.ReloadNearPilot) ? "off" : ((Rules.ReloadsLeft == 2147483647) ? "unlimited" : (Rules.ReloadsLeft + " left")))}." : "Waiting for the host's rules (the host needs this mod).") : (S.HostRules ? "You are the host. Your rules are sent to everyone." : "You are the host, but host rules are off.")))); DroneManager.Notify("Fusion host", message); } internal void <BuildHost>b__16_1() { Rules.HostChanged(); DroneManager.Notify("Fusion host", MavicNet.IsHost ? "Rules sent." : "You are not the host."); } internal void <RefreshPilots>b__17_0() { } internal void <RefreshPilots>b__17_1() { } internal void <BuildSettings>b__18_0() { } internal void <RunSearch>b__20_0() { } internal void <RunSearch>b__20_1() { } } private static readonly Color Accent = new Color(0.95f, 0.62f, 0.2f); private static readonly Color ActionColor = new Color(0.55f, 0.85f, 1f); private static readonly Color Danger = new Color(1f, 0.4f, 0.35f); private static readonly Color Boom = new Color(1f, 0.5f, 0.25f); private static readonly Color HostColor = new Color(0.75f, 0.6f, 1f); private static readonly ValueTuple<string, Color, string[]>[] Groups = new ValueTuple<string, Color, string[]>[6] { new ValueTuple<string, Color, string[]>("Flying", new Color(0.6f, 0.9f, 1f), new string[2] { "Flight", "Controls" }), new ValueTuple<string, Color, string[]>("Camera & view", new Color(1f, 0.9f, 0.6f), new string[5] { "Camera", "Screens", "HUD", "Crosshair", "Feed look" }), new ValueTuple<string, Color, string[]>("Weapons & effects", new Color(1f, 0.55f, 0.4f), new string[4] { "Grenades", "Explosions", "Smoke", "Fire" }), new ValueTuple<string, Color, string[]>("Drone", new Color(0.7f, 1f, 0.6f), new string[4] { "Battery & range", "Drone damage", "Audio", "Drone look" }), new ValueTuple<string, Color, string[]>("Multiplayer", HostColor, new string[2] { "Multiplayer", "Fusion host" }), new ValueTuple<string, Color, string[]>("Other", new Color(0.8f, 0.8f, 0.8f), new string[2] { "Target range", "General" }) }; private static Page _results; private static Page _pilots; private static Page _root; private static bool _discordShown; private static void OnPageOpened(Page page) { try { if (page == null || _root == null || page != _root) { return; } DiscordOnMenu value = S.DiscordOnMenuOpen.Value; switch (value) { case DiscordOnMenu.OncePerSession: if (_discordShown) { return; } break; case DiscordOnMenu.Never: return; } if (value != DiscordOnMenu.FirstTimeOnly || DroneSettings.FirstStartDiscord()) { _discordShown = true; Application.OpenURL("https://discord.gg/UkPw3YyJg8"); Log.Msg("Opened the BWS Discord invite (BoneMenu)."); } } catch (global::System.Exception e) { Log.Once("Discord link", e); } } public static void Build() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown Page val = (_root = Page.Root.CreatePage("BWS Mavic Drone v0.6.3", Accent, 0, true)); try { Menu.OnPageOpened += OnPageOpened; } catch (global::System.Exception ex) { Log.Warn("BoneMenu page hook: " + ex.Message); } Color val2 = new Color(0.45f, 0.55f, 1f); object obj = <>c.<>9__11_0; if (obj == null) { Action val3 = delegate { try { Application.OpenURL("https://discord.gg/UkPw3YyJg8"); Log.Msg("Opened the BWS Discord invite (menu button)."); } catch (global::System.Exception e) { Log.Once("Discord link", e); } }; <>c.<>9__11_0 = val3; obj = (object)val3; } val.CreateFunction("Join the BWS Discord: discord.gg/UkPw3YyJg8", val2, (Action)obj); val.CreateFunction($"Version {"0.6.3"} (built {MavicDroneMod.BuildDate})", Color.white, new Action(MavicDroneMod.ShowVersion)); val.CreateBool("Notifications", new Color(1f, 1f, 0.6f), (bool)S.Notifications, (Action<bool>)delegate(bool v) { S.Notifications.Value = v; }); val.CreateFunction("Spawn drone", ActionColor, new Action(DroneManager.Spawn)); val.CreateFunction("Fly / stop flying", ActionColor, new Action(DroneManager.TogglePilot)); Color actionColor = ActionColor; object obj2 = <>c.<>9__11_2; if (obj2 == null) { Action val4 = delegate { DroneManager.Current?.ReturnHome(); }; <>c.<>9__11_2 = val4; obj2 = (object)val4; } val.CreateFunction("Return home", actionColor, (Action)obj2); Color actionColor2 = ActionColor; object obj3 = <>c.<>9__11_3; if (obj3 == null) { Action val5 = delegate { DroneManager.Current?.Land(); }; <>c.<>9__11_3 = val5; obj3 = (object)val5; } val.CreateFunction("Land", actionColor2, (Action)obj3); Color actionColor3 = ActionColor; object obj4 = <>c.<>9__11_4; if (obj4 == null) { Action val6 = delegate { DroneManager.Current?.LoadFull(); }; <>c.<>9__11_4 = val6; obj4 = (object)val6; } val.CreateFunction("Load full payload", actionColor3, (Action)obj4); Color actionColor4 = ActionColor; object obj5 = <>c.<>9__11_5; if (obj5 == null) { Action val7 = delegate { DroneManager.Current?.Camera.Recenter(); }; <>c.<>9__11_5 = val7; obj5 = (object)val7; } val.CreateFunction("Recenter headset view", actionColor4, (Action)obj5); Color actionColor5 = ActionColor; object obj6 = <>c.<>9__11_6; if (obj6 == null) { Action val8 = delegate { if (!Rules.ThermalAllowed) { DroneManager.Notify("Thermal off", "The Fusion host has turned the thermal camera off."); } else { S.Thermal.Value = !S.Thermal; } }; <>c.<>9__11_6 = val8; obj6 = (object)val8; } val.CreateFunction("Thermal on / off", actionColor5, (Action)obj6); val.CreateFunction("Remove drone", Danger, new Action(DroneManager.Despawn)); BuildMunitions(val); BuildExplosions(val); BuildSmoke(val); BuildTargets(val); BuildHost(val); BuildSettings(val); } private static void BuildMunitions(Page root) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown Page val = root.CreatePage("Munitions", new Color(1f, 0.6f, 0.45f), 0, true); for (GrenadeKind grenadeKind = GrenadeKind.F1; grenadeKind < GrenadeKind.Custom1; grenadeKind++) { GrenadeKind kind = grenadeKind; val.CreateFunction(Grenades.FullName(kind), Grenades.ColorOf(kind), (Action)delegate { S.StartMunition.Value = kind; DroneRig current = DroneManager.Current; if (current == null) { DroneManager.Notify("Munition selected", Grenades.FullName(kind) + " - spawn the drone to carry it."); } else { current.LoadAll(kind); } }); } Color actionColor = ActionColor; object obj = <>c.<>9__12_0; if (obj == null) { Action val2 = delegate { DroneRig current = DroneManager.Current; if (current != null) { GrenadeKind grenadeKind2 = G