using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.BoneMenu.Elements;
using FlatExtra;
using FlatPlayer;
using MelonLoader;
using MelonLoader.Preferences;
using SLZ.Marrow.Input;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Main), "FlatExtra", "1.0.0", "Bailout", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("FlatExtra")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FlatExtra")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5f860616-cfa3-4b65-bc59-fc7421b06216")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FlatExtra;
public class Main : MelonMod
{
private bool SceneLoaded = false;
public static float UIDefault;
public static float UIDistance = 0f;
public static int DismountKey = 120;
public static int SlomoKey = 118;
public static int EjectKey = 99;
public static int FOV = 90;
public override void OnInitializeMelon()
{
Hooking.OnLevelInitialized += delegate
{
OnSceneAwake();
};
Preferences.BonemenuCreator();
}
public void OnSceneAwake()
{
SceneLoaded = true;
UIDefault = Player.rigManager.uiRig.popUpMenu.dis_uiSpawn_Far;
ChangeUIDistance();
ChangeFOV();
}
public override void OnLateUpdate()
{
if (Preferences.IsEnabled && SceneLoaded && FlatBooter.isReady)
{
if (Input.GetKeyDown((KeyCode)DismountKey))
{
((XRController)FlatBooter.RightController).JoystickButton = true;
((XRController)FlatBooter.RightController).JoystickButtonDown = true;
}
if (Input.GetKeyUp((KeyCode)DismountKey))
{
((XRController)FlatBooter.RightController).JoystickButton = false;
((XRController)FlatBooter.RightController).JoystickButtonUp = true;
}
if (Input.GetKeyDown((KeyCode)SlomoKey))
{
((XRController)FlatBooter.LeftController).AButton = true;
((XRController)FlatBooter.LeftController).AButtonDown = true;
}
if (Input.GetKeyUp((KeyCode)SlomoKey))
{
((XRController)FlatBooter.LeftController).AButton = true;
((XRController)FlatBooter.LeftController).AButtonUp = true;
}
if (Input.GetKeyDown((KeyCode)EjectKey))
{
((XRController)FlatBooter.LeftController).BButton = true;
((XRController)FlatBooter.LeftController).BButtonDown = true;
((XRController)FlatBooter.RightController).BButton = true;
((XRController)FlatBooter.RightController).BButtonDown = true;
}
if (Input.GetKeyUp((KeyCode)EjectKey))
{
((XRController)FlatBooter.LeftController).BButton = false;
((XRController)FlatBooter.LeftController).BButtonUp = true;
((XRController)FlatBooter.RightController).BButton = false;
((XRController)FlatBooter.RightController).BButtonUp = true;
}
}
}
public static void ChangeUIDistance()
{
Player.rigManager.uiRig.popUpMenu.dis_uiSpawn_Far = Mathf.Clamp(UIDefault + UIDistance, 0.9f, UIDefault);
}
public static void ChangeFOV()
{
FlatBooter.mainCamera.fieldOfView = FOV;
}
}
public class Preferences : MelonMod
{
public static MelonPreferences_Category MelonPrefCategory { get; private set; }
public static MelonPreferences_Entry<bool> MelonPrefEnabled { get; private set; }
public static bool IsEnabled { get; private set; }
public static MelonPreferences_Entry<bool> MelonPrefVehicleDismount { get; private set; }
public static bool VehicleDismount { get; private set; }
public static MelonPreferences_Entry<bool> MelonPrefGunEject { get; private set; }
public static bool GunEject { get; private set; }
public static MelonPreferences_Entry<bool> MelonPrefSlomo { get; private set; }
public static bool Slomo { get; private set; }
public static MelonPreferences_Entry<float> MelonPrefUI { get; private set; }
public static MelonPreferences_Entry<int> MelonPrefFOV { get; private set; }
public static MelonPreferences_Entry<int> MelonPrefDismountKey { get; private set; }
public static MelonPreferences_Entry<int> MelonPrefEjectKey { get; private set; }
public static MelonPreferences_Entry<int> MelonPrefSlomoKey { get; private set; }
public static void BonemenuCreator()
{
MelonPrefCategory = MelonPreferences.CreateCategory("Fling");
MelonPrefEnabled = MelonPrefCategory.CreateEntry<bool>("Mod Enabled", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
IsEnabled = MelonPrefEnabled.Value;
MelonPrefVehicleDismount = MelonPrefCategory.CreateEntry<bool>("Dismount Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
VehicleDismount = MelonPrefVehicleDismount.Value;
MelonPrefGunEject = MelonPrefCategory.CreateEntry<bool>("Eject Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
GunEject = MelonPrefGunEject.Value;
MelonPrefSlomo = MelonPrefCategory.CreateEntry<bool>("Slomo Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
Slomo = MelonPrefSlomo.Value;
MelonPrefUI = MelonPrefCategory.CreateEntry<float>("UI Distance", 0f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPrefFOV = MelonPrefCategory.CreateEntry<int>("FOV", 90, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPrefDismountKey = MelonPrefCategory.CreateEntry<int>("Dismount Keycode", 120, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPrefEjectKey = MelonPrefCategory.CreateEntry<int>("Eject Keycode", 118, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPrefSlomoKey = MelonPrefCategory.CreateEntry<int>("Slomo Keycode", 99, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MenuCategory val = MenuManager.CreateCategory("Flatplayer Extras", "#ff8000");
val.CreateBoolElement("Mod Toggle", "#ff8000", IsEnabled, (Action<bool>)OnSetEnabled);
val.CreateBoolElement("Vehicle Dismount", "#ff8000", VehicleDismount, (Action<bool>)OnSetDismount);
val.CreateBoolElement("Gun Eject", "#ff8000", GunEject, (Action<bool>)OnSetEject);
val.CreateBoolElement("Slomo", "#ff8000", Slomo, (Action<bool>)OnSetSlomo);
val.CreateFloatElement("UI Distance", "#ff8000", Main.UIDistance, 0.2f, -3f, 0f, (Action<float>)delegate(float ud)
{
Main.UIDistance = ud;
MelonPrefUI.Value = ud;
MelonPrefCategory.SaveToFile(true);
Main.ChangeUIDistance();
});
val.CreateIntElement("FOV", "#ff8000", Main.FOV, 5, 30, 120, (Action<int>)delegate(int f)
{
Main.FOV = f;
MelonPrefFOV.Value = f;
MelonPrefCategory.SaveToFile(true);
Main.ChangeFOV();
});
MenuCategory val2 = val.CreateCategory("Controls", "#ff8000");
val2.CreateIntElement("Dismount Key", "#ff8000", Main.DismountKey, 1, 0, 509, (Action<int>)delegate(int dk)
{
Main.DismountKey = dk;
MelonPrefDismountKey.Value = dk;
MelonPrefCategory.SaveToFile(true);
});
val2.CreateIntElement("Eject Key", "#ff8000", Main.EjectKey, 1, 0, 509, (Action<int>)delegate(int ek)
{
Main.EjectKey = ek;
MelonPrefEjectKey.Value = ek;
MelonPrefCategory.SaveToFile(true);
});
val2.CreateIntElement("Slomo Key", "#ff8000", Main.SlomoKey, 1, 0, 509, (Action<int>)delegate(int sk)
{
Main.SlomoKey = sk;
MelonPrefSlomoKey.Value = sk;
MelonPrefCategory.SaveToFile(true);
});
}
public static void OnSetEnabled(bool value)
{
IsEnabled = value;
MelonPrefEnabled.Value = value;
MelonPrefCategory.SaveToFile(true);
}
public static void OnSetDismount(bool value)
{
VehicleDismount = value;
MelonPrefVehicleDismount.Value = value;
MelonPrefCategory.SaveToFile(true);
}
public static void OnSetEject(bool value)
{
GunEject = value;
MelonPrefGunEject.Value = value;
MelonPrefCategory.SaveToFile(true);
}
public static void OnSetSlomo(bool value)
{
Slomo = value;
MelonPrefSlomo.Value = value;
MelonPrefCategory.SaveToFile(true);
}
}
public static class BuildInfo
{
public const string Name = "FlatExtra";
public const string Author = "Bailout";
public const string Version = "1.0.0";
}