64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using MelonLoader;
|
|
using StressLevelZero.Interaction;
|
|
using StressLevelZero.Player;
|
|
using StressLevelZero.Rig;
|
|
using StressLevelZero.VRMK;
|
|
using UnhollowerBaseLib;
|
|
using UnityEngine;
|
|
|
|
namespace BoneSync.Data
|
|
{
|
|
// copied from Entanglement mod
|
|
public static class PlayerScripts
|
|
{
|
|
public static GameObject localPlayerGameObject;
|
|
public static RigManager playerRig;
|
|
public static PhysBody playerPhysBody;
|
|
public static Player_Health playerHealth;
|
|
public static PhysGrounder playerGrounder;
|
|
public static Hand playerLeftHand;
|
|
public static Hand playerRightHand;
|
|
public static bool reloadLevelOnDeath;
|
|
public static RuntimeAnimatorController playerAnimatorController;
|
|
public static Il2CppStringArray playerHandPoses = null;
|
|
|
|
public static void GetPlayerScripts()
|
|
{
|
|
if (playerRig != null)
|
|
return;
|
|
localPlayerGameObject = GameObject.Find("[RigManager (Default Brett)]");
|
|
playerRig = localPlayerGameObject.GetComponentInChildren<RigManager>();
|
|
playerHealth = playerRig.playerHealth;
|
|
|
|
reloadLevelOnDeath = playerHealth.reloadLevelOnDeath;
|
|
|
|
playerHealth.reloadLevelOnDeath = !BoneSync.IsConnected;
|
|
|
|
try
|
|
{
|
|
PhysicsRig physicsRig = playerRig.physicsRig;
|
|
playerPhysBody = physicsRig.physBody;
|
|
playerGrounder = playerPhysBody.physG;
|
|
playerLeftHand = physicsRig.leftHand;
|
|
playerRightHand = physicsRig.rightHand;
|
|
playerAnimatorController = playerRig.gameWorldSkeletonRig.characterAnimationManager.animator.runtimeAnimatorController;
|
|
} catch
|
|
{
|
|
SyncLogger.Warning("Failed to get physicsRig player scripts!");
|
|
}
|
|
}
|
|
|
|
public static void GetHandPoses()
|
|
{
|
|
// Checks if we already got the hand poses to prevent crashes
|
|
if (playerHandPoses == null)
|
|
CharacterAnimationManager.FetchHandPoseList(out playerHandPoses); // Lets hope this is constant!
|
|
}
|
|
}
|
|
}
|