[KeepVelocityOnExitFlight] Initial release

This commit is contained in:
NotAKidoS 2024-06-27 21:00:48 -05:00
parent c099d0b841
commit f052ec7c8d
5 changed files with 112 additions and 0 deletions

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>LoadedObjectHack</RootNamespace>
</PropertyGroup>
</Project>

View file

@ -0,0 +1,36 @@
using System.Reflection;
using ABI_RC.Core.Util.AnimatorManager;
using ABI_RC.Systems.Movement;
using ABI.CCK.Scripts;
using HarmonyLib;
using MelonLoader;
using UnityEngine;
namespace NAK.KeepVelocityOnExitFlight;
public class KeepVelocityOnExitFlightMod : MelonMod
{
public override void OnInitializeMelon()
{
HarmonyInstance.Patch(
typeof(BetterBetterCharacterController).GetMethod(nameof(BetterBetterCharacterController.ChangeFlight),
BindingFlags.Public | BindingFlags.Instance),
prefix: new HarmonyMethod(typeof(KeepVelocityOnExitFlightMod).GetMethod(nameof(Prefix_OnChangeFlight),
BindingFlags.NonPublic | BindingFlags.Static)),
postfix: new HarmonyMethod(typeof(KeepVelocityOnExitFlightMod).GetMethod(nameof(Postfix_OnChangeFlight),
BindingFlags.NonPublic | BindingFlags.Static))
);
}
// ReSharper disable once RedundantAssignment
private static void Prefix_OnChangeFlight(ref BetterBetterCharacterController __instance, ref Vector3 __state)
{
__state = __instance.GetVelocity();
}
private static void Postfix_OnChangeFlight(ref BetterBetterCharacterController __instance, ref Vector3 __state)
{
if (__instance.FlightAllowedInWorld && !__instance.IsFlying())
__instance.SetVelocity(__state);
}
}

View file

@ -0,0 +1,32 @@
using MelonLoader;
using NAK.KeepVelocityOnExitFlight.Properties;
using System.Reflection;
[assembly: AssemblyVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyFileVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyInformationalVersion(AssemblyInfoParams.Version)]
[assembly: AssemblyTitle(nameof(NAK.KeepVelocityOnExitFlight))]
[assembly: AssemblyCompany(AssemblyInfoParams.Author)]
[assembly: AssemblyProduct(nameof(NAK.KeepVelocityOnExitFlight))]
[assembly: MelonInfo(
typeof(NAK.KeepVelocityOnExitFlight.KeepVelocityOnExitFlightMod),
nameof(NAK.KeepVelocityOnExitFlight),
AssemblyInfoParams.Version,
AssemblyInfoParams.Author,
downloadLink: "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/KeepVelocityOnExitFlight"
)]
[assembly: MelonGame("Alpha Blend Interactive", "ChilloutVR")]
[assembly: MelonPlatform(MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonPlatformDomain(MelonPlatformDomainAttribute.CompatibleDomains.MONO)]
[assembly: MelonColor(255, 125, 126, 129)]
[assembly: MelonAuthorColor(255, 158, 21, 32)]
[assembly: HarmonyDontPatchAll]
namespace NAK.KeepVelocityOnExitFlight.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Author = "NotAKidoS";
}

View file

@ -0,0 +1,14 @@
# KeepVelocityOnExitFlight
Keeps the player's velocity when exiting flight mode. Makes it possible to fling yourself like in Garry's Mod.
---
Here is the block of text where I tell you this mod is not affiliated with or endorsed by ABI.
https://documentation.abinteractive.net/official/legal/tos/#7-modding-our-games
> This mod is an independent creation not affiliated with, supported by, or approved by Alpha Blend Interactive.
> Use of this mod is done so at the user's own risk and the creator cannot be held responsible for any issues arising from its use.
> To the best of my knowledge, I have adhered to the Modding Guidelines established by Alpha Blend Interactive.

View file

@ -0,0 +1,24 @@
{
"_id": -1,
"name": "KeepVelocityOnExitFlight",
"modversion": "1.0.0",
"gameversion": "2024r175",
"loaderversion": "0.6.1",
"modtype": "Mod",
"author": "NotAKidoS",
"description": "Keeps the player's velocity when exiting flight mode. Makes it possible to fling yourself like in Garry's Mod.",
"searchtags": [
"flight",
"mode",
"velocity",
"flying",
"fly"
],
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/releases/download/r33/KeepVelocityOnExitFlight.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/NAK_CVR_Mods/tree/main/KeepVelocityOnExitFlight/",
"changelog": "- Initial release",
"embedcolor": "#f61963"
}