using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using HarmonyLib; using GameNetcodeStuff; using ScarletMansion.GamePatch.Components; namespace ScarletMansion.GamePatch { public class PlayerControllerBPatch { [HarmonyPatch(typeof(PlayerControllerB), "Awake")] [HarmonyPrefix] public static void AwakePatch(ref PlayerControllerB __instance){ var currentComp = __instance.GetComponent(); if (currentComp == null) { Plugin.logger.LogDebug($"Adding Scarlet player script to player {__instance.playerClientId}"); var comp = __instance.gameObject.AddComponent(); comp.Initialize(__instance); comp.Register(); } else { currentComp.Register(); Plugin.logger.LogWarning($"Player {__instance.playerClientId} already has Scarlet player script. Skipping. YOU CAN PROBABLY IGNORE THIS!"); } } /* [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] public static void UpdatePatch(ref PlayerControllerB __instance) { if (GameNetworkManager.Instance.localPlayerController == null) return; var controller = ScarletPlayerControllerB.GetScarletPlayerScript(__instance); if (controller.playerOverrideController != null) return; controller.playerOverrideController = new AnimatorOverrideController(__instance.playerBodyAnimator.runtimeAnimatorController); __instance.playerBodyAnimator.runtimeAnimatorController = controller.playerOverrideController; } */ } }