mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
further cleanup of repo
This commit is contained in:
parent
4f8dcb0cd0
commit
323eb92f2e
140 changed files with 1 additions and 2430 deletions
|
@ -0,0 +1,37 @@
|
|||
using System.Collections;
|
||||
using ABI_RC.Core.Base;
|
||||
using ABI_RC.Core.Player;
|
||||
using HarmonyLib;
|
||||
using MelonLoader;
|
||||
using NAK.OriginShift;
|
||||
using NAK.OriginShift.Components;
|
||||
using UnityEngine;
|
||||
|
||||
namespace OriginShift.Integrations;
|
||||
|
||||
public static class RagdollAddon
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
OriginShiftMod.HarmonyInst.Patch(
|
||||
AccessTools.Method(typeof(PlayerSetup), nameof(PlayerSetup.SetupAvatar)),
|
||||
postfix: new HarmonyMethod(typeof(RagdollAddon), nameof(OnPostPlayerSetupSetupAvatar))
|
||||
);
|
||||
}
|
||||
|
||||
private static void OnPostPlayerSetupSetupAvatar()
|
||||
{
|
||||
OriginShiftMod.Logger.Msg("Found Ragdoll, fixing compatibility...");
|
||||
MelonCoroutines.Start(FixRagdollCompatibility());
|
||||
}
|
||||
|
||||
private static IEnumerator FixRagdollCompatibility()
|
||||
{
|
||||
yield return null; // wait a frame for the avatar to be setup
|
||||
GameObject ragdollObj = GameObject.Find("_PLAYERLOCAL/[PlayerAvatarPuppet]");
|
||||
|
||||
// get all rigidbodies in the ragdoll
|
||||
var ragdollRigidbodies = ragdollObj.GetComponentsInChildren<Rigidbody>();
|
||||
foreach (Rigidbody rb in ragdollRigidbodies) rb.AddComponentIfMissing<OriginShiftRigidbodyReceiver>();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue