Flight mode consideration

Possible IK pose consideration
Minor fixes
This commit is contained in:
SDraw 2023-04-18 12:08:49 +03:00
parent fb2a7ed119
commit 823a76d95a
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
3 changed files with 62 additions and 22 deletions

View file

@ -1,13 +1,14 @@
using ABI_RC.Core;
using ABI.CCK.Components;
using ABI_RC.Core;
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Player;
using ABI_RC.Core.Util.AssetFiltering;
using ABI_RC.Systems.IK.SubSystems;
using ABI_RC.Systems.MovementSystem;
using System;
using System.Collections.Generic;
using System.Reflection;
using ABI_RC.Core.Util.AssetFiltering;
using ABI.CCK.Components;
using System.Linq;
using System.Reflection;
namespace ml_prm
{
@ -54,6 +55,11 @@ namespace ml_prm
new HarmonyLib.HarmonyMethod(typeof(PlayerRagdollMod).GetMethod(nameof(OnCombatDown_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
null
);
HarmonyInstance.Patch(
typeof(MovementSystem).GetMethod(nameof(MovementSystem.ToggleFlight)),
null,
new HarmonyLib.HarmonyMethod(typeof(PlayerRagdollMod).GetMethod(nameof(OnToggleFlight_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
);
// Whitelist the toggle script
(typeof(SharedFilter).GetField("_localComponentWhitelist", BindingFlags.NonPublic | BindingFlags.Static)?.GetValue(null) as HashSet<Type>)?.Add(typeof(RagdollToggle));
@ -77,6 +83,7 @@ namespace ml_prm
m_localController = PlayerSetup.Instance.gameObject.AddComponent<RagdollController>();
}
// Patches
static void OnAvatarClear_Postfix() => ms_instance?.OnAvatarClear();
void OnAvatarClear()
{
@ -164,5 +171,19 @@ namespace ml_prm
MelonLoader.MelonLogger.Error(e);
}
}
static void OnToggleFlight_Postfix() => ms_instance?.OnToggleFlight();
void OnToggleFlight()
{
try
{
if(m_localController != null)
m_localController.OnToggleFlight();
}
catch(Exception e)
{
MelonLoader.MelonLogger.Error(e);
}
}
}
}