Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BabySpectate v1.0.0
BabySpec.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BabySpec.Avatar; using BabySpec.Compat; using BabySpec.Config; using BabySpec.NetcodePatcher; using BabySpec.Networking; using BabySpec.Patches; using BabySpec.Stealth; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.Rendering.HighDefinition; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("BabySpec")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BabySpec")] [assembly: AssemblyTitle("BabySpec")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BabySpec { [BepInPlugin("com.maxim.babyspec", "BabySpec", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "com.maxim.babyspec"; public const string PluginName = "BabySpec"; public const string PluginVersion = "1.0.0"; private Harmony _harmony; public static Plugin Instance { get; private set; } public static ManualLogSource Log { get; private set; } public static BabySpecInputs Inputs { get; private set; } private void Awake() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; BabySpecConfig.Init(((BaseUnityPlugin)this).Config); Inputs = new BabySpecInputs(); InitializeNetcodePatcher(); _harmony = new Harmony("com.maxim.babyspec"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); PoltergeistCompat.Init(_harmony); Log.LogInfo((object)"BabySpec v1.0.0 loaded successfully!"); } private static void InitializeNetcodePatcher() { try { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type type in types) { MethodInfo[] methods; try { methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); } catch { continue; } MethodInfo[] array = methods; foreach (MethodInfo methodInfo in array) { if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0) { methodInfo.Invoke(null, null); } } } } catch (Exception arg) { Log.LogError((object)$"Failed to initialize NetcodePatcher RPCs: {arg}"); } } } } namespace BabySpec.Stealth { public static class BabyStealthManager { private static readonly HashSet<ulong> UntargetablePlayers = new HashSet<ulong>(); private static readonly HashSet<ulong> InvisiblePlayers = new HashSet<ulong>(); public static void SetPlayerStealth(ulong clientId, bool stealth) { if (stealth) { UntargetablePlayers.Add(clientId); InvisiblePlayers.Add(clientId); } else { UntargetablePlayers.Remove(clientId); InvisiblePlayers.Remove(clientId); } } public static void ReplaceAll(ulong[] stealthClientIds) { UntargetablePlayers.Clear(); InvisiblePlayers.Clear(); if (stealthClientIds != null) { foreach (ulong item in stealthClientIds) { UntargetablePlayers.Add(item); InvisiblePlayers.Add(item); } } } public static ulong[] GetAllStealthClientIds() { ulong[] array = new ulong[UntargetablePlayers.Count]; UntargetablePlayers.CopyTo(array); return array; } public static bool IsUntargetable(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return false; } if (!UntargetablePlayers.Contains(player.actualClientId)) { return UntargetablePlayers.Contains(player.playerClientId); } return true; } public static bool IsInvisible(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return false; } if (!InvisiblePlayers.Contains(player.actualClientId)) { return InvisiblePlayers.Contains(player.playerClientId); } return true; } public static void Clear() { UntargetablePlayers.Clear(); InvisiblePlayers.Clear(); } } } namespace BabySpec.Patches { [HarmonyPatch(typeof(EnemyAI))] internal static class EnemyAIStealthPatches { [HarmonyPostfix] [HarmonyPatch("PlayerIsTargetable")] private static void PlayerIsTargetablePostfix(PlayerControllerB playerScript, ref bool __result) { if (__result && BabyStealthManager.IsUntargetable(playerScript)) { __result = false; } } [HarmonyPostfix] [HarmonyPatch("CheckLineOfSightForPlayer")] private static void CheckLineOfSightForPlayerPostfix(ref PlayerControllerB __result) { if ((Object)(object)__result != (Object)null && BabyStealthManager.IsInvisible(__result)) { __result = null; } } [HarmonyPostfix] [HarmonyPatch("CheckLineOfSightForClosestPlayer")] private static void CheckLineOfSightForClosestPlayerPostfix(ref PlayerControllerB __result) { if ((Object)(object)__result != (Object)null && BabyStealthManager.IsInvisible(__result)) { __result = null; } } [HarmonyPostfix] [HarmonyPatch("GetAllPlayersInLineOfSight")] private static void GetAllPlayersInLineOfSightPostfix(ref PlayerControllerB[] __result) { if (__result == null || __result.Length == 0) { return; } bool flag = false; for (int i = 0; i < __result.Length; i++) { if (BabyStealthManager.IsInvisible(__result[i])) { flag = true; break; } } if (!flag) { return; } List<PlayerControllerB> list = new List<PlayerControllerB>(__result.Length); for (int j = 0; j < __result.Length; j++) { if ((Object)(object)__result[j] != (Object)null && !BabyStealthManager.IsInvisible(__result[j])) { list.Add(__result[j]); } } __result = ((list.Count > 0) ? list.ToArray() : null); } } [HarmonyPatch] internal static class LifecyclePatches { [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void GameNetworkManagerStartPostfix() { BabySpecPrefabBuilder.RegisterNetworkPrefabs(); } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] private static void GameNetworkManagerDisconnectPostfix() { BabySpecCameraController.Instance?.OnLeaveSpectatorMode(); BabyStealthManager.Clear(); BabySpecPrefabBuilder.ResetRegistrationFlag(); BabySpecConfig.ReloadLocalConfig(); } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPostfix] private static void StartOfRoundAwakePostfix() { BabySpecCameraController.EnsureCreated(); } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartOfRoundStartPostfix() { BabySpecPrefabBuilder.EnsureManeaterTemplateCached(); if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer && (Object)(object)BabySpecNetworkManager.Instance == (Object)null && (Object)(object)BabySpecPrefabBuilder.NetworkManagerPrefab != (Object)null) { GameObject obj = Object.Instantiate<GameObject>(BabySpecPrefabBuilder.NetworkManagerPrefab); obj.SetActive(true); obj.GetComponent<NetworkObject>().Spawn(true); } } [HarmonyPatch(typeof(StartOfRound), "ReviveDeadPlayers")] [HarmonyPostfix] private static void ReviveDeadPlayersPostfix() { BabySpecCameraController.Instance?.OnLeaveSpectatorMode(); if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer) { BabySpecNetworkManager.Instance?.CleanupAllAvatarsServer(); } } [HarmonyPatch(typeof(StartOfRound), "ShipHasLeft")] [HarmonyPostfix] private static void ShipHasLeftPostfix() { BabySpecCameraController.Instance?.OnLeaveSpectatorMode(); if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer) { BabySpecNetworkManager.Instance?.CleanupAllAvatarsServer(); } } [HarmonyPatch(typeof(StartOfRound), "OnPlayerDC")] [HarmonyPostfix] private static void OnPlayerDCPostfix(int playerObjectNumber, ulong clientId) { if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer) { BabySpecNetworkManager.Instance?.HandlePlayerDisconnectServer(clientId); } } } [HarmonyPatch] internal static class SpectatorPatches { private static readonly FieldInfo CullingCurrentTileField = AccessTools.Field(typeof(AdjacentRoomCullingModified), "currentTile"); private static readonly FieldInfo CullingDirtyField = AccessTools.Field(typeof(AdjacentRoomCullingModified), "dirty"); private static readonly FieldInfo CullingAllTilesField = AccessTools.Field(typeof(AdjacentRoomCullingModified), "allTiles"); private static readonly FieldInfo CullingVisibleTilesField = AccessTools.Field(typeof(AdjacentRoomCullingModified), "visibleTiles"); private static readonly FieldInfo CullingOldVisibleTilesField = AccessTools.Field(typeof(AdjacentRoomCullingModified), "oldVisibleTiles"); private static readonly MethodInfo CullingRefreshVisibilityMethod = AccessTools.Method(typeof(AdjacentRoomCullingModified), "RefreshVisibility", (Type[])null, (Type[])null); private static PropertyInfo _tileBoundsProperty; private static bool _forceRefreshCulling; private static bool _ownsCullingTarget; [HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")] [HarmonyPrefix] private static void KillPlayerPrefix(PlayerControllerB __instance) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)(object)GameNetworkManager.Instance?.localPlayerController && !__instance.isPlayerDead) { BabySpecCameraController.EnsureCreated(); BabySpecCameraController.Instance?.RecordLocalDeath(((Component)__instance).transform.position, __instance.isInsideFactory); } } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPrefix] private static void PlayerLateUpdatePrefix(PlayerControllerB __instance) { if (!((Object)(object)BabySpecCameraController.Instance == (Object)null) && BabySpecCameraController.Instance.IsBabyModeActive && (Object)(object)__instance == (Object)(object)GameNetworkManager.Instance?.localPlayerController && (Object)(object)__instance.playersManager != (Object)null) { __instance.playersManager.overrideSpectateCamera = true; } } [HarmonyPatch(typeof(PlayerControllerB), "SetNightVisionEnabled")] [HarmonyPostfix] private static void SetNightVisionEnabledPostfix(PlayerControllerB __instance) { if ((Object)(object)BabySpecCameraController.Instance != (Object)null && BabySpecCameraController.Instance.IsBabyModeActive && (Object)(object)__instance != (Object)null && (Object)(object)__instance.nightVision != (Object)null) { ((Behaviour)__instance.nightVision).enabled = false; } } [HarmonyPatch(typeof(ManualCameraRenderer), "LateUpdate")] [HarmonyPostfix] private static void ManualCameraRendererLateUpdatePostfix(ManualCameraRenderer __instance) { if (!((Object)(object)BabySpecCameraController.Instance == (Object)null) && BabySpecCameraController.Instance.IsBabyModeActive && (Object)(object)__instance != (Object)null && (Object)(object)__instance.targetedPlayer != (Object)null) { if ((Object)(object)__instance.targetedPlayer.nightVisionRadar != (Object)null) { ((Behaviour)__instance.targetedPlayer.nightVisionRadar).enabled = false; } if ((Object)(object)__instance.targetedPlayer.deadBody != (Object)null && (Object)(object)__instance.targetedPlayer.deadBody.nightVisionRadar != (Object)null) { ((Behaviour)__instance.targetedPlayer.deadBody.nightVisionRadar).enabled = false; } } } [HarmonyPatch(typeof(StartOfRound), "SetSpectateCameraToGameOverMode")] [HarmonyPrefix] private static bool SetSpectateCameraToGameOverModePrefix(bool enableGameOver) { if ((Object)(object)BabySpecCameraController.Instance == (Object)null || !BabySpecCameraController.Instance.IsBabyModeActive) { return true; } if (enableGameOver) { BabySpecCameraController.Instance.ExitBabyMode(restoreClassicSpectator: false, despawnAvatar: true); return true; } return false; } [HarmonyPatch(typeof(StartOfRound), "SwitchCamera")] [HarmonyPostfix] private static void SwitchCameraPostfix(StartOfRound __instance, Camera newCamera) { if (!((Object)(object)BabySpecCameraController.Instance == (Object)null)) { PlayerControllerB val = GameNetworkManager.Instance?.localPlayerController; if ((Object)(object)newCamera == (Object)(object)__instance.spectateCamera && (Object)(object)val != (Object)null && val.isPlayerDead) { BabySpecCameraController.Instance.OnEnterSpectatorMode(); } else if ((Object)(object)newCamera != (Object)(object)__instance.spectateCamera) { BabySpecCameraController.Instance.OnLeaveSpectatorMode(); } } } public static void RequestCullingRefresh() { _forceRefreshCulling = true; } private static void ResetCullingCache(AdjacentRoomCullingModified culling) { (CullingVisibleTilesField?.GetValue(culling) as IList)?.Clear(); (CullingOldVisibleTilesField?.GetValue(culling) as IList)?.Clear(); CullingCurrentTileField?.SetValue(culling, null); CullingDirtyField?.SetValue(culling, true); } [HarmonyPatch(typeof(AdjacentRoomCullingModified), "LateUpdate")] [HarmonyPrefix] private static void AdjacentRoomCullingLateUpdatePrefix(AdjacentRoomCullingModified __instance) { if ((Object)(object)BabySpecCameraController.Instance != (Object)null && BabySpecCameraController.Instance.IsBabyModeActive) { BabySpecAvatar localAvatar = BabySpecCameraController.Instance.LocalAvatar; if ((Object)(object)localAvatar != (Object)null && localAvatar.IsActiveAvatar) { Transform val = (((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.spectateCamera != (Object)null) ? ((Component)StartOfRound.Instance.spectateCamera).transform : ((Component)localAvatar).transform); bool flag = (Object)(object)__instance.TargetOverride != (Object)(object)val || !_ownsCullingTarget; __instance.TargetOverride = val; _ownsCullingTarget = true; if (_forceRefreshCulling || flag) { _forceRefreshCulling = false; ResetCullingCache(__instance); } } } else if (_ownsCullingTarget) { _ownsCullingTarget = false; __instance.TargetOverride = null; ResetCullingCache(__instance); _forceRefreshCulling = false; } } [HarmonyPatch(typeof(AdjacentRoomCullingModified), "LateUpdate")] [HarmonyPostfix] private static void AdjacentRoomCullingLateUpdatePostfix(AdjacentRoomCullingModified __instance) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || !__instance.Ready || (Object)(object)BabySpecCameraController.Instance == (Object)null || !BabySpecCameraController.Instance.IsBabyModeActive) { return; } BabySpecAvatar localAvatar = BabySpecCameraController.Instance.LocalAvatar; if (!((Object)(object)localAvatar == (Object)null) && localAvatar.IsActiveAvatar && localAvatar.IsInsideFactory && CullingCurrentTileField?.GetValue(__instance) == null) { object obj = FindNearestDungeonTile(__instance, ((Component)localAvatar).transform.position + Vector3.up * 0.5f); if (obj != null) { (CullingVisibleTilesField?.GetValue(__instance) as IList)?.Clear(); (CullingOldVisibleTilesField?.GetValue(__instance) as IList)?.Clear(); CullingCurrentTileField?.SetValue(__instance, obj); CullingRefreshVisibilityMethod?.Invoke(__instance, null); CullingDirtyField?.SetValue(__instance, false); } } } private static object FindNearestDungeonTile(AdjacentRoomCullingModified culling, Vector3 worldPos) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)culling == (Object)null || CullingAllTilesField == null) { return null; } try { if (!(CullingAllTilesField.GetValue(culling) is IEnumerable enumerable)) { return null; } object result = null; float num = float.MaxValue; foreach (object item in enumerable) { if (item == null) { continue; } if (_tileBoundsProperty == null) { _tileBoundsProperty = item.GetType().GetProperty("Bounds"); } float num2; if (_tileBoundsProperty != null) { Bounds val = (Bounds)_tileBoundsProperty.GetValue(item); num2 = ((Bounds)(ref val)).SqrDistance(worldPos); } else { Component val2 = (Component)((item is Component) ? item : null); if (val2 == null) { continue; } Vector3 val3 = val2.transform.position - worldPos; num2 = ((Vector3)(ref val3)).sqrMagnitude; } if (num2 < num) { num = num2; result = item; if (num <= 0.0001f) { break; } } } return result; } catch { return null; } } [HarmonyPatch(typeof(TimeOfDay), "SetInsideLightingDimness")] [HarmonyPostfix] private static void SetInsideLightingDimnessPostfix(TimeOfDay __instance) { if ((Object)(object)__instance == (Object)null || (Object)(object)BabySpecCameraController.Instance == (Object)null || !BabySpecCameraController.Instance.IsBabyModeActive) { return; } BabySpecAvatar localAvatar = BabySpecCameraController.Instance.LocalAvatar; if (!((Object)(object)localAvatar == (Object)null) && localAvatar.IsActiveAvatar) { bool flag = (__instance.insideLighting = localAvatar.IsInsideFactory); if ((Object)(object)__instance.sunDirect != (Object)null) { ((Behaviour)__instance.sunDirect).enabled = !flag; } if ((Object)(object)__instance.sunIndirect != (Object)null) { ((Behaviour)__instance.sunIndirect).enabled = !flag; } } } } [HarmonyPatch] internal static class TrapImmunityPatches { [HarmonyPatch(typeof(Landmine), "OnTriggerEnter")] [HarmonyPrefix] private static bool LandmineOnTriggerEnterPrefix(Collider other) { if ((Object)(object)other != (Object)null && (Object)(object)((Component)other).GetComponentInParent<BabySpecAvatar>() != (Object)null) { return false; } return true; } [HarmonyPatch(typeof(Landmine), "OnTriggerExit")] [HarmonyPrefix] private static bool LandmineOnTriggerExitPrefix(Collider other) { if ((Object)(object)other != (Object)null && (Object)(object)((Component)other).GetComponentInParent<BabySpecAvatar>() != (Object)null) { return false; } return true; } [HarmonyPatch(typeof(SpikeRoofTrap), "OnTriggerStay")] [HarmonyPrefix] private static bool SpikeRoofTrapOnTriggerStayPrefix(Collider other) { if ((Object)(object)other != (Object)null && (Object)(object)((Component)other).GetComponentInParent<BabySpecAvatar>() != (Object)null) { return false; } return true; } [HarmonyPatch(typeof(Turret), "CheckForPlayersInLineOfSight")] [HarmonyPostfix] private static void TurretCheckForPlayersPostfix(ref PlayerControllerB __result) { if ((Object)(object)__result != (Object)null && BabyStealthManager.IsInvisible(__result)) { __result = null; } } [HarmonyPatch(typeof(Landmine), "SpawnExplosion")] [HarmonyPostfix] private static void LandmineSpawnExplosionPostfix(Vector3 explosionPosition, float killRange, float damageRange, int nonLethalDamage) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)NetworkManager.Singleton == (Object)null || !NetworkManager.Singleton.IsServer || (Object)(object)BabySpecNetworkManager.Instance == (Object)null) { return; } int num = (((Object)(object)StartOfRound.Instance != (Object)null) ? StartOfRound.Instance.collidersAndRoomMaskAndDefault : (-1)); foreach (BabySpecAvatar allAvatar in BabySpecNetworkManager.Instance.GetAllAvatars()) { if (!((Object)(object)allAvatar == (Object)null) && allAvatar.IsActiveAvatar && !allAvatar.IsStunnedDead) { Vector3 val = ((Component)allAvatar).transform.position + Vector3.up * 0.3f; float num2 = Vector3.Distance(explosionPosition, val); if (!(num2 > damageRange) && !Physics.Linecast(explosionPosition, val, num, (QueryTriggerInteraction)1)) { int damage = ((num2 <= killRange) ? Mathf.Max(BabySpecConfig.MaxHealth, 100) : Mathf.Max(10, nonLethalDamage)); Vector3 val2 = val - explosionPosition; Vector3 normalized = ((Vector3)(ref val2)).normalized; allAvatar.ApplyDamageOnServer(damage, normalized, playHitSFX: true); } } } } [HarmonyPatch(typeof(OutOfBoundsTrigger), "OnTriggerEnter")] [HarmonyPrefix] private static bool OutOfBoundsTriggerPrefix(OutOfBoundsTrigger __instance, Collider other) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)other == (Object)null) { return true; } BabySpecAvatar componentInParent = ((Component)other).GetComponentInParent<BabySpecAvatar>(); if ((Object)(object)componentInParent != (Object)null) { if ((Object)(object)__instance == (Object)null || !((Behaviour)__instance).enabled) { return false; } StartOfRound instance = StartOfRound.Instance; if (__instance.disableWhenRoundStarts && ((Object)(object)instance == (Object)null || !instance.inShipPhase)) { return false; } if (!componentInParent.IsInsideFactory) { return false; } if (componentInParent.IsLocalControlledAvatar() && componentInParent.IsActiveAvatar && !componentInParent.IsStunnedDead) { Plugin.Log.LogInfo((object)("BabySpec triggered active OutOfBoundsTrigger '" + ((Object)__instance).name + "' inside factory.")); componentInParent.RequestDamageServerRpc(9999, Vector3.zero, playHitSFX: true, searchNavMeshHigher: true); } return false; } return true; } [HarmonyPatch(typeof(KillLocalPlayer), "OnTriggerEnter")] [HarmonyPrefix] private static bool KillLocalPlayerOnTriggerEnterPrefix(KillLocalPlayer __instance, Collider other) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)other == (Object)null) { return true; } BabySpecAvatar componentInParent = ((Component)other).GetComponentInParent<BabySpecAvatar>(); if ((Object)(object)componentInParent != (Object)null) { if ((Object)(object)__instance == (Object)null || !((Behaviour)__instance).enabled) { return false; } InteractTrigger component = ((Component)__instance).GetComponent<InteractTrigger>(); if ((Object)(object)component != (Object)null && (!((Behaviour)component).enabled || !component.interactable || !component.touchTrigger)) { return false; } if (__instance.disallowKillingInShip) { if (componentInParent.IsInsideFactory) { return false; } if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.shipInnerRoomBounds != (Object)null) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; if (((Bounds)(ref bounds)).Contains(((Component)componentInParent).transform.position)) { return false; } } } if (componentInParent.IsLocalControlledAvatar() && componentInParent.IsActiveAvatar && !componentInParent.IsStunnedDead) { int num = (__instance.justDamage ? 25 : 9999); Plugin.Log.LogInfo((object)$"BabySpec triggered active KillLocalPlayer '{((Object)__instance).name}' (dmg={num})."); componentInParent.RequestDamageServerRpc(num, Vector3.zero, playHitSFX: true, searchNavMeshHigher: true); } return false; } return true; } } } namespace BabySpec.Networking { public class BabySpecNetworkManager : NetworkBehaviour { private readonly Dictionary<ulong, BabySpecAvatar> _avatarsByOwner = new Dictionary<ulong, BabySpecAvatar>(); private readonly Dictionary<ulong, BabySkinType> _assignedSkinByOwner = new Dictionary<ulong, BabySkinType>(); public static BabySpecNetworkManager Instance { get; private set; } public override void OnNetworkSpawn() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) ((NetworkBehaviour)this).OnNetworkSpawn(); Instance = this; Plugin.Log.LogInfo((object)$"BabySpecNetworkManager spawned (IsServer={((NetworkBehaviour)this).IsServer})."); if (((NetworkBehaviour)this).IsServer) { BroadcastStealthList(); BroadcastConfigToAllClients(); } else { RequestInitialSyncServerRpc(); } } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } _avatarsByOwner.Clear(); _assignedSkinByOwner.Clear(); } public void RegisterAvatar(ulong ownerClientId, BabySpecAvatar avatar) { _avatarsByOwner[ownerClientId] = avatar; } public void UnregisterAvatar(ulong ownerClientId, BabySpecAvatar avatar) { if (_avatarsByOwner.TryGetValue(ownerClientId, out var value) && (Object)(object)value == (Object)(object)avatar) { _avatarsByOwner.Remove(ownerClientId); } } public BabySpecAvatar GetAvatar(ulong ownerClientId) { _avatarsByOwner.TryGetValue(ownerClientId, out var value); return value; } public IEnumerable<BabySpecAvatar> GetAllAvatars() { return _avatarsByOwner.Values; } [ServerRpc(RequireOwnership = false)] private void RequestInitialSyncServerRpc(ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4076605223u, rpcParams, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4076605223u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = rpcParams.Receive.SenderClientId; ClientRpcParams val2 = new ClientRpcParams { Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { senderClientId } } }; SyncStealthListClientRpc(BabyStealthManager.GetAllStealthClientIds(), val2); SendConfigToTarget(val2); } } } public void BroadcastConfigToAllClients() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)this).IsServer) { SendConfigToTarget(default(ClientRpcParams)); } } private void SendConfigToTarget(ClientRpcParams targetParams) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) SyncConfigClientRpc(BabySpecConfig.BabyScale, BabySpecConfig.MaxHealth, BabySpecConfig.StunDuration, BabySpecConfig.EmitAINoise, BabySpecConfig.AINoiseRange, BabySpecConfig.ShowOnScan, BabySpecConfig.AllowGrabBaby, BabySpecConfig.WalkSpeed, BabySpecConfig.SprintSpeed, BabySpecConfig.EnableNightVision, targetParams); } [ClientRpc] private void SyncConfigClientRpc(float babyScale, int maxHealth, float stunDuration, bool emitAINoise, float aiNoiseRange, bool showOnScan, bool allowGrabBaby, float walkSpeed, float sprintSpeed, bool enableNightVision, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(99304780u, rpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref babyScale, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, maxHealth); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref stunDuration, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref emitAINoise, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref aiNoiseRange, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref showOnScan, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref allowGrabBaby, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref walkSpeed, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref sprintSpeed, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref enableNightVision, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 99304780u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { BabySpecConfig.ApplySyncedConfig(babyScale, maxHealth, stunDuration, emitAINoise, aiNoiseRange, showOnScan, allowGrabBaby, walkSpeed, sprintSpeed, enableNightVision); Plugin.Log.LogInfo((object)"Applied synchronized BabySpec config from host."); } } } [ServerRpc(RequireOwnership = false)] public void SetBabyModeServerRpc(bool enable, bool despawn, Vector3 spawnPosition, bool isInsideFactory, ServerRpcParams rpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2923482508u, rpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref enable, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref despawn, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref spawnPosition); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isInsideFactory, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2923482508u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; ulong senderClientId = rpcParams.Receive.SenderClientId; BabySpecAvatar value4; if (enable) { BabyStealthManager.SetPlayerStealth(senderClientId, stealth: true); BroadcastStealthList(); if (!_assignedSkinByOwner.TryGetValue(senderClientId, out var value)) { value = BabyManeaterCosmeticsBridge.RollWeightedSkin(); _assignedSkinByOwner[senderClientId] = value; } bool flag = false; if (!_avatarsByOwner.TryGetValue(senderClientId, out var value2) || (Object)(object)value2 == (Object)null) { if ((Object)(object)BabySpecPrefabBuilder.AvatarPrefab == (Object)null) { Plugin.Log.LogError((object)"Cannot spawn BabySpecAvatar: AvatarPrefab is null."); return; } GameObject obj = Object.Instantiate<GameObject>(BabySpecPrefabBuilder.AvatarPrefab, spawnPosition, Quaternion.identity); obj.SetActive(true); obj.GetComponent<NetworkObject>().SpawnWithOwnership(senderClientId, true); value2 = obj.GetComponent<BabySpecAvatar>(); _avatarsByOwner[senderClientId] = value2; flag = true; } if (flag || !value2.IsActiveAvatar) { value2.ActivateOnServer(senderClientId, value, spawnPosition, isInsideFactory); } else { value2.ResumeControlOnServer(); } } else if (despawn) { if (_avatarsByOwner.TryGetValue(senderClientId, out var value3) && (Object)(object)value3 != (Object)null) { value3.DeactivateOnServer(); } BabyStealthManager.SetPlayerStealth(senderClientId, stealth: false); BroadcastStealthList(); } else if (_avatarsByOwner.TryGetValue(senderClientId, out value4) && (Object)(object)value4 != (Object)null && value4.IsActiveAvatar) { value4.PauseControlOnServer(); } } public void HandlePlayerDisconnectServer(ulong clientId) { if (!((NetworkBehaviour)this).IsServer) { return; } if (_avatarsByOwner.TryGetValue(clientId, out var value) && (Object)(object)value != (Object)null) { value.ForceReleaseIfHeldOnServer(); if ((Object)(object)((NetworkBehaviour)value).NetworkObject != (Object)null && ((NetworkBehaviour)value).NetworkObject.IsSpawned) { ((NetworkBehaviour)value).NetworkObject.Despawn(true); } } _avatarsByOwner.Remove(clientId); _assignedSkinByOwner.Remove(clientId); BabyStealthManager.SetPlayerStealth(clientId, stealth: false); BroadcastStealthList(); } public void CleanupAllAvatarsServer() { if (!((NetworkBehaviour)this).IsServer) { return; } foreach (BabySpecAvatar item in new List<BabySpecAvatar>(_avatarsByOwner.Values)) { if (!((Object)(object)item == (Object)null)) { item.ForceReleaseIfHeldOnServer(); if ((Object)(object)((NetworkBehaviour)item).NetworkObject != (Object)null && ((NetworkBehaviour)item).NetworkObject.IsSpawned) { ((NetworkBehaviour)item).NetworkObject.Despawn(true); } } } _avatarsByOwner.Clear(); _assignedSkinByOwner.Clear(); BabyStealthManager.Clear(); BroadcastStealthList(); } private void BroadcastStealthList() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) SyncStealthListClientRpc(BabyStealthManager.GetAllStealthClientIds()); } [ClientRpc] private void SyncStealthListClientRpc(ulong[] stealthClientIds, ClientRpcParams rpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(115580780u, rpcParams, (RpcDelivery)0); bool flag = stealthClientIds != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe<ulong>(stealthClientIds, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 115580780u, rpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; BabyStealthManager.ReplaceAll(stealthClientIds); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(4076605223u, new RpcReceiveHandler(__rpc_handler_4076605223), "RequestInitialSyncServerRpc"); ((NetworkBehaviour)this).__registerRpc(99304780u, new RpcReceiveHandler(__rpc_handler_99304780), "SyncConfigClientRpc"); ((NetworkBehaviour)this).__registerRpc(2923482508u, new RpcReceiveHandler(__rpc_handler_2923482508), "SetBabyModeServerRpc"); ((NetworkBehaviour)this).__registerRpc(115580780u, new RpcReceiveHandler(__rpc_handler_115580780), "SyncStealthListClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_4076605223(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((BabySpecNetworkManager)(object)target).RequestInitialSyncServerRpc(server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_99304780(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float babyScale = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref babyScale, default(ForPrimitives)); int maxHealth = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref maxHealth); float stunDuration = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref stunDuration, default(ForPrimitives)); bool emitAINoise = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref emitAINoise, default(ForPrimitives)); float aiNoiseRange = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref aiNoiseRange, default(ForPrimitives)); bool showOnScan = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref showOnScan, default(ForPrimitives)); bool allowGrabBaby = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref allowGrabBaby, default(ForPrimitives)); float walkSpeed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref walkSpeed, default(ForPrimitives)); float sprintSpeed = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref sprintSpeed, default(ForPrimitives)); bool enableNightVision = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enableNightVision, default(ForPrimitives)); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((BabySpecNetworkManager)(object)target).SyncConfigClientRpc(babyScale, maxHealth, stunDuration, emitAINoise, aiNoiseRange, showOnScan, allowGrabBaby, walkSpeed, sprintSpeed, enableNightVision, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2923482508(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool enable = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enable, default(ForPrimitives)); bool despawn = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref despawn, default(ForPrimitives)); Vector3 spawnPosition = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref spawnPosition); bool isInsideFactory = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isInsideFactory, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((BabySpecNetworkManager)(object)target).SetBabyModeServerRpc(enable, despawn, spawnPosition, isInsideFactory, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_115580780(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); ulong[] stealthClientIds = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<ulong>(ref stealthClientIds, default(ForPrimitives)); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)1; ((BabySpecNetworkManager)(object)target).SyncStealthListClientRpc(stealthClientIds, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "BabySpecNetworkManager"; } } public static class BabySpecPrefabBuilder { private static bool _prefabsRegistered; private static GameObject _prefabHolder; private const uint ManagerPrefabHash = 3031916225u; private const uint AvatarPrefabHash = 3031916226u; public static GameObject NetworkManagerPrefab { get; private set; } public static GameObject AvatarPrefab { get; private set; } public static CaveDwellerAI CachedManeaterTemplate { get; private set; } public static Item CachedBabyItemTemplate { get; private set; } private static Transform GetOrCreatePrefabHolder() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown if ((Object)(object)_prefabHolder == (Object)null) { _prefabHolder = new GameObject("BabySpecPrefabHolder"); _prefabHolder.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_prefabHolder); } return _prefabHolder.transform; } public static void RegisterNetworkPrefabs() { if (_prefabsRegistered || (Object)(object)NetworkManager.Singleton == (Object)null) { return; } try { if ((Object)(object)NetworkManagerPrefab == (Object)null) { NetworkManagerPrefab = CreateManagerPrefab(); } if ((Object)(object)AvatarPrefab == (Object)null) { AvatarPrefab = CreateAvatarPrefab(); } NetworkManager.Singleton.AddNetworkPrefab(NetworkManagerPrefab); NetworkManager.Singleton.AddNetworkPrefab(AvatarPrefab); _prefabsRegistered = true; Plugin.Log.LogInfo((object)"Registered BabySpec runtime network prefabs."); } catch (Exception arg) { Plugin.Log.LogError((object)$"Failed to register BabySpec network prefabs: {arg}"); } } public static void ResetRegistrationFlag() { _prefabsRegistered = false; } private static GameObject CreateManagerPrefab() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown GameObject val = new GameObject("BabySpecNetworkManager"); val.transform.SetParent(GetOrCreatePrefabHolder(), false); val.SetActive(true); SetGlobalObjectIdHash(val.AddComponent<NetworkObject>(), 3031916225u); val.AddComponent<BabySpecNetworkManager>(); return val; } private static GameObject CreateAvatarPrefab() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BabySpecAvatar"); val.transform.SetParent(GetOrCreatePrefabHolder(), false); val.SetActive(true); val.layer = 6; val.tag = "PhysicsProp"; SetGlobalObjectIdHash(val.AddComponent<NetworkObject>(), 3031916226u); CharacterController obj = val.AddComponent<CharacterController>(); obj.radius = 0.22f; obj.height = 0.55f; obj.center = new Vector3(0f, 0.28f, 0f); obj.stepOffset = 0.35f; obj.slopeLimit = 50f; obj.minMoveDistance = 0.001f; BoxCollider val2 = val.AddComponent<BoxCollider>(); ((Collider)val2).isTrigger = true; val2.center = new Vector3(0f, 0.3f, 0f); val2.size = new Vector3(0.55f, 0.55f, 0.65f); GameObject val3 = new GameObject("BabySpecHurtbox"); val3.transform.SetParent(val.transform, false); val3.layer = 19; val3.tag = "Untagged"; CapsuleCollider obj2 = val3.AddComponent<CapsuleCollider>(); ((Collider)obj2).isTrigger = true; obj2.radius = 0.28f; obj2.height = 0.65f; obj2.center = new Vector3(0f, 0.32f, 0f); val3.AddComponent<BabySpecHurtbox>(); GameObject val4 = new GameObject("BabySpecScanNode"); val4.transform.SetParent(val.transform, false); val4.transform.localPosition = new Vector3(0f, 0.4f, 0f); val4.layer = 22; BoxCollider obj3 = val4.AddComponent<BoxCollider>(); ((Collider)obj3).isTrigger = true; obj3.size = new Vector3(0.5f, 0.5f, 0.5f); ScanNodeProperties obj4 = val4.AddComponent<ScanNodeProperties>(); obj4.maxRange = 13; obj4.minRange = 1; obj4.requiresLineOfSight = true; obj4.headerText = "Baby Maneater"; obj4.subText = ""; obj4.scrapValue = 0; obj4.creatureScanID = -1; obj4.nodeType = 0; BabySpecGrabbable babySpecGrabbable = val.AddComponent<BabySpecGrabbable>(); ((GrabbableObject)babySpecGrabbable).grabbable = true; ((GrabbableObject)babySpecGrabbable).grabbableToEnemies = false; ((GrabbableObject)babySpecGrabbable).propColliders = (Collider[])(object)new Collider[1] { (Collider)val2 }; val.AddComponent<BabySpecAvatar>(); return val; } private static void SetGlobalObjectIdHash(NetworkObject netObj, uint hash) { Type? typeFromHandle = typeof(NetworkObject); typeFromHandle.GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(netObj, hash); typeFromHandle.GetField("PrefabGlobalObjectIdHash", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(netObj, hash); } public static bool EnsureManeaterTemplateCached() { //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CachedManeaterTemplate != (Object)null && (Object)(object)CachedBabyItemTemplate != (Object)null) { return true; } CaveDwellerAI val = null; if ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.levels != null) { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val2 in levels) { if (val2?.Enemies == null) { continue; } foreach (SpawnableEnemyWithRarity enemy in val2.Enemies) { if (!((Object)(object)enemy?.enemyType?.enemyPrefab == (Object)null)) { CaveDwellerAI component = enemy.enemyType.enemyPrefab.GetComponent<CaveDwellerAI>(); if ((Object)(object)component != (Object)null) { val = component; break; } } } if ((Object)(object)val != (Object)null) { break; } } } if ((Object)(object)val == (Object)null) { QuickMenuManager val3 = Object.FindObjectOfType<QuickMenuManager>(); if (val3?.testAllEnemiesLevel?.Enemies != null) { foreach (SpawnableEnemyWithRarity enemy2 in val3.testAllEnemiesLevel.Enemies) { if (!((Object)(object)enemy2?.enemyType?.enemyPrefab == (Object)null)) { CaveDwellerAI component2 = enemy2.enemyType.enemyPrefab.GetComponent<CaveDwellerAI>(); if ((Object)(object)component2 != (Object)null) { val = component2; break; } } } } } if ((Object)(object)val == (Object)null) { Plugin.Log.LogError((object)"Could not locate vanilla CaveDwellerAI prefab in any SelectableLevel!"); return false; } CachedManeaterTemplate = val; CaveDwellerPhysicsProp componentInChildren = ((Component)val).GetComponentInChildren<CaveDwellerPhysicsProp>(true); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)((GrabbableObject)componentInChildren).itemProperties != (Object)null) { CachedBabyItemTemplate = Object.Instantiate<Item>(((GrabbableObject)componentInChildren).itemProperties); ((Object)CachedBabyItemTemplate).name = "BabySpecManeaterItem"; CachedBabyItemTemplate.isScrap = false; CachedBabyItemTemplate.creditsWorth = 0; CachedBabyItemTemplate.minValue = 0; CachedBabyItemTemplate.maxValue = 0; CachedBabyItemTemplate.canBeGrabbedBeforeGameStart = true; CachedBabyItemTemplate.twoHanded = true; CachedBabyItemTemplate.twoHandedAnimation = true; CachedBabyItemTemplate.holdButtonUse = true; CachedBabyItemTemplate.weight = 1.05f; CachedBabyItemTemplate.itemName = "Baby Maneater"; CachedBabyItemTemplate.toolTips = new string[2] { "Rock baby : [LMB]", "Drop : [G]" }; } else { CachedBabyItemTemplate = ScriptableObject.CreateInstance<Item>(); ((Object)CachedBabyItemTemplate).name = "BabySpecManeaterItem"; CachedBabyItemTemplate.itemName = "Baby Maneater"; CachedBabyItemTemplate.twoHanded = true; CachedBabyItemTemplate.twoHandedAnimation = true; CachedBabyItemTemplate.holdButtonUse = true; CachedBabyItemTemplate.canBeGrabbedBeforeGameStart = true; CachedBabyItemTemplate.weight = 1.05f; CachedBabyItemTemplate.positionOffset = new Vector3(0.05f, -0.15f, 0.25f); CachedBabyItemTemplate.rotationOffset = new Vector3(0f, 180f, 0f); CachedBabyItemTemplate.toolTips = new string[2] { "Rock baby : [LMB]", "Drop : [G]" }; } Plugin.Log.LogInfo((object)"Cached vanilla CaveDwellerAI baby visual & item templates."); return true; } } } namespace BabySpec.Config { public static class BabySpecConfig { private static ConfigFile _boundConfig; private static ConfigEntry<float> _lightIntensityEntry; public static float BabyScale { get; private set; } = 0.7f; public static int BabyManeaterWeight { get; private set; } = 10; public static int FancyManeaterWeight { get; private set; } = 5; public static int EvilManeaterWeight { get; private set; } = 4; public static int PacifierManeaterWeight { get; private set; } = 5; public static int MaxHealth { get; private set; } = 40; public static float StunDuration { get; private set; } = 3f; public static bool EmitAINoise { get; private set; } = false; public static float AINoiseRange { get; private set; } = 18f; public static bool ShowOnScan { get; private set; } = true; public static bool AllowGrabBaby { get; private set; } = true; public static float WalkSpeed { get; private set; } = 4.6f; public static float SprintSpeed { get; private set; } = 7.5f; public static bool EnableNightVision { get; private set; } = true; public static float LightIntensity { get; private set; } = 8f; public static void Init(ConfigFile config) { if (_boundConfig != null) { _boundConfig.SettingChanged -= OnLocalSettingChanged; } _boundConfig = config; ApplyFromConfigFile(config); if (_boundConfig != null) { _boundConfig.SettingChanged += OnLocalSettingChanged; } } private static void OnLocalSettingChanged(object sender, SettingChangedEventArgs e) { if (_boundConfig == null) { return; } if (_lightIntensityEntry != null) { LightIntensity = Mathf.Clamp(_lightIntensityEntry.Value, 0f, 30f); } NetworkManager singleton = NetworkManager.Singleton; if (!((Object)(object)singleton != (Object)null) || !singleton.IsListening || singleton.IsServer) { ApplyFromConfigFile(_boundConfig); RefreshLiveEffects(); if ((Object)(object)singleton != (Object)null && singleton.IsListening && singleton.IsServer) { BabySpecNetworkManager.Instance?.BroadcastConfigToAllClients(); } } } public static void ReloadLocalConfig() { if (_boundConfig != null) { try { _boundConfig.Reload(); } catch { } ApplyFromConfigFile(_boundConfig); RefreshLiveEffects(); } } private static void ApplyFromConfigFile(ConfigFile config) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Expected O, but got Unknown //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Expected O, but got Unknown //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Expected O, but got Unknown BabyScale = config.Bind<float>("Model & Skins", "BabyScale", 0.7f, new ConfigDescription("[Host] Visual scale multiplier for the controlled Baby Maneater.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.3f, 2f), Array.Empty<object>())).Value; BabyManeaterWeight = config.Bind<int>("Model & Skins", "Baby maneater weight", 10, new ConfigDescription("[Host] Spawn weight for the Silly Baby Maneater skin (Propeller Hat + Candy).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())).Value; FancyManeaterWeight = config.Bind<int>("Model & Skins", "Fancy maneater weight", 5, new ConfigDescription("[Host] Spawn weight for the Fancy Maneater skin (Mustache + Monocle).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())).Value; EvilManeaterWeight = config.Bind<int>("Model & Skins", "Evil maneater weight", 4, new ConfigDescription("[Host] Spawn weight for the Evil Maneater skin (Horns).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())).Value; PacifierManeaterWeight = config.Bind<int>("Model & Skins", "Pacifier maneater weight", 5, new ConfigDescription("[Host] Spawn weight for the Pacifier Maneater skin.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())).Value; MaxHealth = config.Bind<int>("Combat & Respawn", "MaxHealth", 40, new ConfigDescription("[Host] Health points of the Baby Maneater.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 200), Array.Empty<object>())).Value; StunDuration = config.Bind<float>("Combat & Respawn", "StunDuration", 3f, new ConfigDescription("[Host] Duration (in seconds) spent immobilized on its back before respawning.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 30f), Array.Empty<object>())).Value; EmitAINoise = config.Bind<bool>("AI & Scan", "EmitAINoise", false, "[Host] If enabled, crying (and sprinting) emits PlayAudibleNoise so monsters can hear the sound.").Value; AINoiseRange = config.Bind<float>("AI & Scan", "AINoiseRange", 18f, new ConfigDescription("[Host] Range of the AI noise emitted when EmitAINoise is enabled.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 60f), Array.Empty<object>())).Value; ShowOnScan = config.Bind<bool>("AI & Scan", "ShowOnScan", true, "[Host] Whether living players see 'Baby [Username]' when scanning the Baby Maneater.").Value; AllowGrabBaby = config.Bind<bool>("AI & Scan", "AllowGrabBaby", true, "[Host] Allow living players to pick up and carry the Baby Maneater.").Value; WalkSpeed = config.Bind<float>("Movement", "WalkSpeed", 4.6f, new ConfigDescription("[Host] Normal walking speed of the Baby Maneater.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())).Value; SprintSpeed = config.Bind<float>("Movement", "SprintSpeed", 7.5f, new ConfigDescription("[Host] Sprinting speed of the Baby Maneater.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>())).Value; EnableNightVision = config.Bind<bool>("Movement", "EnableNightVision", true, "[Host] Allow toggling the global night-vision light with LMB.").Value; _lightIntensityEntry = config.Bind<float>("Client", "LightIntensity", 8f, new ConfigDescription("[Client] Local intensity of the night-vision light (not synchronized from host).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>())); LightIntensity = _lightIntensityEntry.Value; } public static void ApplySyncedConfig(float babyScale, int maxHealth, float stunDuration, bool emitAINoise, float aiNoiseRange, bool showOnScan, bool allowGrabBaby, float walkSpeed, float sprintSpeed, bool enableNightVision) { BabyScale = Mathf.Clamp(babyScale, 0.3f, 2f); MaxHealth = Mathf.Clamp(maxHealth, 1, 200); StunDuration = Mathf.Clamp(stunDuration, 0.5f, 30f); EmitAINoise = emitAINoise; AINoiseRange = Mathf.Clamp(aiNoiseRange, 5f, 60f); ShowOnScan = showOnScan; AllowGrabBaby = allowGrabBaby; WalkSpeed = Mathf.Clamp(walkSpeed, 1f, 15f); SprintSpeed = Mathf.Clamp(sprintSpeed, 1f, 20f); EnableNightVision = enableNightVision; RefreshLiveEffects(); } private static void RefreshLiveEffects() { if ((Object)(object)BabySpecNetworkManager.Instance != (Object)null) { foreach (BabySpecAvatar allAvatar in BabySpecNetworkManager.Instance.GetAllAvatars()) { if ((Object)(object)allAvatar != (Object)null) { allAvatar.RefreshFromSyncedConfig(); } } } BabySpecCameraController.Instance?.OnSyncedConfigChanged(); } } public class BabySpecInputs : LcInputActions { [InputAction("<Keyboard>/b", Name = "Toggle BabySpec Mode")] public InputAction ToggleBabyMode { get; set; } [InputAction("<Keyboard>/v", Name = "Switch 1st / 3rd Person Camera")] public InputAction ToggleCameraView { get; set; } [InputAction("<Keyboard>/c", Name = "Baby Cry")] public InputAction CryKey { get; set; } [InputAction("<Keyboard>/e", Name = "Interact")] public InputAction InteractKey { get; set; } [InputAction("<Keyboard>/h", Name = "Toggle Controls Display")] public InputAction ToggleControlsKey { get; set; } [InputAction("<Mouse>/leftButton", Name = "Toggle Baby Light")] public InputAction ToggleLightKey { get; set; } public static string GetBindingDisplay(InputAction action, string fallback) { if (action == null) { return fallback; } try { string bindingDisplayString = InputActionRebindingExtensions.GetBindingDisplayString(action, 0, (DisplayStringOptions)0); return string.IsNullOrEmpty(bindingDisplayString) ? fallback : bindingDisplayString; } catch { return fallback; } } } } namespace BabySpec.Compat { public static class PoltergeistCompat { private const string PoltergeistGuid = "coderCleric.Poltergeist"; private static Type _spectatorCamType; private static Type _patchesType; private static FieldInfo _camInstanceField; private static FieldInfo _camControllerActiveField; private static FieldInfo _vanillaModeField; private static FieldInfo _controlsTextField; private static FieldInfo _lightsField; private static FieldInfo _headField; private static MethodInfo _updateControlTextMethod; public static bool IsInstalled { get; private set; } public static void Init(Harmony harmony) { //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown if (!Chainloader.PluginInfos.TryGetValue("coderCleric.Poltergeist", out var value) || (Object)(object)((value != null) ? value.Instance : null) == (Object)null) { IsInstalled = false; return; } try { Assembly assembly = ((object)value.Instance).GetType().Assembly; _spectatorCamType = assembly.GetType("Poltergeist.SpectatorCamController"); _patchesType = assembly.GetType("Poltergeist.Patches"); if (!(_spectatorCamType == null) && !(_patchesType == null)) { _camInstanceField = _spectatorCamType.GetField("instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _camControllerActiveField = _patchesType.GetField("camControllerActive", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _vanillaModeField = _patchesType.GetField("vanillaMode", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _controlsTextField = _spectatorCamType.GetField("controlsText", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _lightsField = _spectatorCamType.GetField("lights", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _headField = _spectatorCamType.GetField("head", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); _updateControlTextMethod = _spectatorCamType.GetMethod("UpdateControlText", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo method = _spectatorCamType.GetMethod("SwitchModes", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (method != null && harmony != null) { HarmonyMethod val = new HarmonyMethod(typeof(PoltergeistCompat).GetMethod("OnPoltergeistSwitchModesPrefix", BindingFlags.Static | BindingFlags.NonPublic)); harmony.Patch((MethodBase)method, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } IsInstalled = true; Plugin.Log.LogInfo((object)"Poltergeist detected: 3-mode spectator cohabitation enabled."); } } catch (Exception ex) { Plugin.Log.LogWarning((object)("Failed to initialize Poltergeist compatibility bridge: " + ex.Message)); } } public static void PausePoltergeist() { if (!IsInstalled) { return; } try { _vanillaModeField?.SetValue(null, true); _camControllerActiveField?.SetValue(null, false); object obj = _camInstanceField?.GetValue(null); if (obj == null) { return; } if (_lightsField?.GetValue(obj) is Light[] array) { Light[] array2 = array; foreach (Light val in array2) { if ((Object)(object)val != (Object)null) { ((Behaviour)val).enabled = false; } } } object obj2 = _headField?.GetValue(obj); if (obj2 != null) { Type type = obj2.GetType(); type.GetField("isActive", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(obj2, false); type.GetMethod("Deactivate", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(obj2, null); } _updateControlTextMethod?.Invoke(obj, null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Failed to pause Poltergeist: " + ex.Message)); } } public static TextMeshProUGUI GetPoltergeistControlsText() { if (!IsInstalled || _camInstanceField == null || _controlsTextField == null) { return null; } try { object value = _camInstanceField.GetValue(null); if (value == null) { return null; } object? value2 = _controlsTextField.GetValue(value); return (TextMeshProUGUI)((value2 is TextMeshProUGUI) ? value2 : null); } catch { return null; } } private static void OnPoltergeistSwitchModesPrefix() { if ((Object)(object)BabySpecCameraController.Instance != (Object)null && BabySpecCameraController.Instance.IsBabyModeActive) { BabySpecCameraController.Instance.ExitBabyMode(restoreClassicSpectator: false); } } } } namespace BabySpec.Avatar { public enum BabySkinType { None, Silly, Fancy, Evil, Pacifier } public static class BabyManeaterCosmeticsBridge { private readonly struct CosmeticTransformData { public readonly Vector3 LocalPosition; public readonly Vector3 LocalEulerAngles; public readonly Vector3 LocalScale; public CosmeticTransformData(Vector3 pos, Vector3 rot, Vector3 scale) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) LocalPosition = pos; LocalEulerAngles = rot; LocalScale = scale; } } private static readonly CosmeticTransformData PropellerHatTransform = new CosmeticTransformData(new Vector3(-0.20204306f, 0.9605204f, -0.23717636f), new Vector3(349.96097f, 94.9584f, 330.76498f), new Vector3(464.2224f, 464.2224f, 464.22232f)); private static readonly CosmeticTransformData BabyCandyTransform = new CosmeticTransformData(new Vector3(0.38033116f, -0.06880533f, -0.27771744f), new Vector3(334.44446f, 207.58443f, 205.9928f), new Vector3(0.25532237f, 0.25532237f, 0.0182987f)); private static readonly CosmeticTransformData MustacheTransform = new CosmeticTransformData(new Vector3(-0.017746676f, 0.594866f, 0.6736852f), new Vector3(335.64508f, 0f, 0f), new Vector3(14.2f, 14.2f, 14.2f)); private static readonly CosmeticTransformData MonocleTransform = new CosmeticTransformData(new Vector3(-0.38123283f, 0.7593062f, 0.43297106f), new Vector3(329.07764f, 323.111f, 13.838256f), new Vector3(14.43f, 14.43f, 14.43f)); private static readonly CosmeticTransformData HornLeftTransform = new CosmeticTransformData(new Vector3(-0.52499986f, 0.8803636f, 0.19296086f), new Vector3(270.01978f, 0f, 0f), new Vector3(20.8f, 20.8f, 20.8f)); private static readonly CosmeticTransformData HornRightTransform = new CosmeticTransformData(new Vector3(0.525f, 0.8803636f, 0.19296074f), new Vector3(270.01978f, 0f, 0f), new Vector3(20.8f, 20.8f, 20.8f)); private static readonly CosmeticTransformData PacifierTransform = new CosmeticTransformData(new Vector3(-0.012f, 0.543f, 0.658f), new Vector3(10.271351f, 0f, 0f), new Vector3(10f, 10f, 10f)); private static bool _initialized; private static bool _assetsAvailable; private static AssetBundle _bundle; private static GameObject _propellerHat; private static GameObject _babyCandy; private static GameObject _mustache; private static GameObject _monocle; private static GameObject _leftHorn; private static GameObject _rightHorn; private static GameObject _pacifier; private static readonly Random Rng = new Random(); public static void EnsureInitialized() { if (_initialized) { return; } _initialized = true; try { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location) ?? string.Empty, "babyspecassets"); if (!File.Exists(text)) { Plugin.Log.LogError((object)("Could not find required asset bundle 'babyspecassets' next to BabySpec.dll at: " + text)); return; } _bundle = AssetBundle.LoadFromFile(text); if ((Object)(object)_bundle == (Object)null) { Plugin.Log.LogError((object)("Failed to load AssetBundle from: " + text)); return; } _propellerHat = _bundle.LoadAsset<GameObject>("Assets/BabyManeater/Prefabs/PropellerHat.prefab"); _babyCandy = _bundle.LoadAsset<GameObject>("Assets/BabyManeater/Prefabs/BabyCandy.prefab"); _mustache = _bundle.LoadAsset<GameObject>("Assets/BabyManeater/Prefabs/Mustache.prefab"); _monocle = _bundle.LoadAsset<GameObject>("Assets/BabyManeater/Prefabs/Monocle.prefab"); _leftHorn = _bundle.LoadAsset<GameObject>("Assets/BabyManeater/Prefabs/HornLeft.prefab"); _rightHorn = _bundle.LoadAsset<GameObject>("Assets/BabyManeater/Prefabs/HornRight.prefab"); _pacifier = _bundle.LoadAsset<GameObject>("Assets/BabyManeater/Prefabs/Pacifier.prefab"); _assetsAvailable = (Object)(object)_propellerHat != (Object)null || (Object)(object)_mustache != (Object)null || (Object)(object)_leftHorn != (Object)null || (Object)(object)_pacifier != (Object)null; if (_assetsAvailable) { Plugin.Log.LogInfo((object)"Loaded standalone BabySpec cosmetics from babyspecassets bundle."); } } catch (Exception arg) { Plugin.Log.LogError((object)$"Error loading babyspecassets bundle: {arg}"); } finally { if ((Object)(object)_bundle != (Object)null) { _bundle.Unload(false); _bundle = null; } } } public static BabySkinType RollWeightedSkin() { int num = Mathf.Max(0, BabySpecConfig.BabyManeaterWeight); int num2 = Mathf.Max(0, BabySpecConfig.FancyManeaterWeight); int num3 = Mathf.Max(0, BabySpecConfig.EvilManeaterWeight); int num4 = Mathf.Max(0, BabySpecConfig.PacifierManeaterWeight); int num5 = num + num2 + num3 + num4; if (num5 <= 0) { return (BabySkinType)Rng.Next(1, 5); } int num6 = Rng.Next(num5); if (num6 < num) { return BabySkinType.Silly; } num6 -= num; if (num6 < num2) { return BabySkinType.Fancy; } num6 -= num2; if (num6 < num3) { return BabySkinType.Evil; } return BabySkinType.Pacifier; } public static List<GameObject> ApplySkin(Transform babyMeshContainer, BabySkinType skinType) { List<GameObject> list = new List<GameObject>(); EnsureInitialized(); if (!_assetsAvailable || (Object)(object)babyMeshContainer == (Object)null || skinType == BabySkinType.None) { return list; } Transform val = babyMeshContainer.Find("BabyAnimContainer"); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"BabyAnimContainer not found under BabyMeshContainer; cannot attach cosmetics."); return list; } Transform obj = val.Find("Spine1"); Transform val2 = ((obj != null) ? obj.Find("Spine3") : null); Transform obj2 = val.Find("Spine1"); object obj3; if (obj2 == null) { obj3 = null; } else { Transform obj4 = obj2.Find("Spine2"); if (obj4 == null) { obj3 = null; } else { Transform obj5 = obj4.Find("TopLeg_L"); if (obj5 == null) { obj3 = null; } else { Transform obj6 = obj5.Find("TopLeg2_L"); obj3 = ((obj6 != null) ? obj6.Find("TopFoot_L") : null); } } } Transform val3 = (Transform)obj3; if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)"Baby Maneater head bone (Spine1/Spine3) not found."); return list; } switch (skinType) { case BabySkinType.Silly: SpawnCosmetic(_propellerHat, val2, PropellerHatTransform, list); if ((Object)(object)val3 != (Object)null) { SpawnCosmetic(_babyCandy, val3, BabyCandyTransform, list); } break; case BabySkinType.Fancy: SpawnCosmetic(_mustache, val2, MustacheTransform, list); SpawnCosmetic(_monocle, val2, MonocleTransform, list); break; case BabySkinType.Evil: SpawnCosmetic(_leftHorn, val2, HornLeftTransform, list); SpawnCosmetic(_rightHorn, val2, HornRightTransform, list); break; case BabySkinType.Pacifier: SpawnCosmetic(_pacifier, val2, PacifierTransform, list); break; } return list; } private static void SpawnCosmetic(GameObject prefab, Transform parent, CosmeticTransformData tData, List<GameObject> spawned) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)prefab == (Object)null) && !((Object)(object)parent == (Object)null)) { GameObject val = Object.Instantiate<GameObject>(prefab, parent); val.transform.localPosition = tData.LocalPosition; val.transform.localEulerAngles = tData.LocalEulerAngles; val.transform.localScale = tData.LocalScale; Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } Renderer[] componentsInChildren2 = val.GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { ((Component)componentsInChildren2[i]).gameObject.layer = 0; } spawned.Add(val); } } } public class BabySpecAvatar : NetworkBehaviour { private bool _isBeingRocked; private CharacterController _cc; private BabySpecGrabbable _grabbable; private BabySpecHurtbox _hurtbox; private Collider _hurtboxCollider; private Collider _grabCollider; private ScanNodeProperties _scanNode; private GameObject _visualRoot; private Transform _babyMeshContainer; private Animator _babyAnimator; private ParticleSystem _tearsParticle; private AudioSource _cryingAudio; private AudioSource _voiceAudio; private AudioClip[] _scaredVoiceClips; private readonly List<GameObject> _cosmeticObjects = new List<GameObject>(); private readonly List<Renderer> _firstPersonHideableRenderers = new List<Renderer>(); private InteractTrigger _hoveredTrigger; private EntranceTeleport _hoveredEntrance; private DoorLock _hoveredDoor; private int _currentHealth; private bool _lastDeathNeedsUpwardNavSearch; private double _respawnAtServerTime; private double _invulnerableUntilServerTime; private double _nextNoiseEmitServerTime; private double _nextInteractServerTime; private double _nextReleaseRequestServerTime; private float _verticalVelocity = -7f; private float _fallValueUncapped = -7f; private bool _takingFallDamage; private bool _isFallingFromJump; private bool _isFallingNoJump; private float _slopeModifier; private Vector3 _playerGroundNormal = Vector3.up; private Vector3 _controllerCollisionPoint; private readonly Vector3[] _testGroundPositions = (Vector3[])(object)new Vector3[5]; private Vector3 _lastValidNavPosition; private const float SlopeModifierSpeed = 1f; private const int GroundNormalLayerMask = 301992705; private InteractTrigger _activeLadder; private float _ladderProgress; private Vector3 _ladderBottomPos; private Vector3 _ladderTopPos; private Quaternion _ladderFacingRot; private double _nextSyncServerTime; private Vector3 _netTargetPos; private float _netTargetYaw; private bool _netIsRunning; private bool _hasNetTarget; private bool _visualsBuilt; private string _ownerDisplayName = "Baby Maneater"; private static readonly FieldInfo InteractableMaskField = AccessTools.Field(typeof(PlayerControllerB), "interactableObjectsMask"); public ulong OwnerPlayerClientId { get; private set; } public bool IsActiveAvatar { get; private set; } public bool IsStunnedDead { get; private set; } public bool IsCrying { get; private set; } public bool IsInsideFactory { get; private set; } public bool IsBeingHeld { get { if ((Object)(object)_grabbable != (Object)null) { return ((GrabbableObject)_grabbable).isHeld; } return false; } } public PlayerControllerB CarrierPlayer { get { if (!((Object)(object)_grabbable != (Object)null)) { return null; } return ((GrabbableObject)_grabbable).playerHeldBy; } } public bool IsBeingRocked { get { if (!IsBeingHeld) { return false; } if (_isBeingRocked) { return true; } PlayerControllerB carrierPlayer = CarrierPlayer; if ((Object)(object)carrierPlayer != (Object)null && (Object)(object)carrierPlayer.playerBodyAnimator != (Object)null) { return carrierPlayer.playerBodyAnimator.GetInteger("RockBaby") != 0; } return false; } } public bool IsClimbingLadder { get; private set; } public BabySkinType SkinType { get; private set; } private static double ServerNow { get { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)NetworkManager.Singleton != (Object)null)) { return Time.realtimeSinceStartup; } NetworkTime serverTime = NetworkManager.Singleton.ServerTime; return ((NetworkTime)(ref serverTime)).Time; } } private void Awake() { _cc = ((Component)this).GetComponent<CharacterController>(); _grabbable = ((Component)this).GetComponent<BabySpecGrabbable>(); _hurtbox = ((Component)this).GetComponentInChildren<BabySpecHurtbox>(true); _hurtboxCollider = (((Object)(object)_hurtbox != (Object)null) ? ((Component)_hurtbox).GetComponent<Collider>() : null); _grabCollider = (Collider)(object)((Component)this).GetComponent<BoxCollider>(); _scanNode = ((Component)this).GetComponentInChildren<ScanNodeProperties>(true); } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); OwnerPlayerClientId = ((NetworkBehaviour)this).OwnerClientId; BabySpecNetworkManager.Instance?.RegisterAvatar(OwnerPlayerClientId, this); EnsureVisualsBuilt(); SetAvatarActiveLocal(active: false); } public override void OnNetworkDespawn() { ((NetworkBehaviour)this).OnNetworkDespawn(); BabySpecNetworkManager.Instance?.UnregisterAvatar(OwnerPlayerClientId, this); BabySpecCameraController.Instance?.UnbindLocalAvatar(this); } private void EnsureVisualsBuilt() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) if (_visualsBuilt || !BabySpecPrefabBuilder.EnsureManeaterTemplateCached()) { return; } CaveDwellerAI cachedManeaterTemplate = BabySpecPrefabBuilder.CachedManeaterTemplate; if ((Object)(object)cachedManeaterTemplate == (Object)null || (Object)(object)cachedManeaterTemplate.babyContainer == (Object)null) { return; } _visualRoot = new GameObject("BabyVisualRoot"); _visualRoot.transform.SetParent(((Component)this).transform, false); _visualRoot.transform.localPosition = Vector3.zero; _visualRoot.transform.localRotation = Quaternion.identity; ApplyConfiguredScale(); GameObject val = Object.Instantiate<GameObject>(cachedManeaterTemplate.babyContainer, _visualRoot.transform); ((Object)val).name = "BabyMeshContainer"; val.SetActive(true); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.identity; Collider[] componentsInChildren = val.GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.Destroy((Object)(object)componentsInChildren[i]); } EnemyAICollisionDetect[] componentsInChildren2 = val.GetComponentsInChildren<EnemyAICollisionDetect>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.Destroy((Object)(object)componentsInChildren2[i]); } Renderer[] componentsInChildren3 = val.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren3) { if (!((Object)(object)val2 == (Object)null)) { int layer = ((Component)val2).gameObject.layer; if (layer == 14 || layer == 23) { Object.Destroy((Object)(object)val2); } else if (val2.enabled && !(val2 is ParticleSystemRenderer)) { ((Component)val2).gameObject.layer = 0; } } } _babyMeshContainer = val.transform; _babyAnimator = val.GetComponentInChildren<Animator>(true); _tearsParticle = val.GetComponentInChildren<ParticleSystem>(true); _cryingAudio = _visualRoot.AddComponent<AudioSource>(); if ((Object)(object)cachedManeaterTemplate.babyCryingAudio != (Object)null) { _cryingAudio.clip = cachedManeaterTemplate.babyCryingAudio.clip; _cryingAudio.loop = true; _cryingAudio.spatialBlend = 1f; _cryingAudio.minDistance = 2f; _cryingAudio.maxDistance = 22f; _cryingAudio.volume = 0.75f; _cryingAudio.rolloffMode = (AudioRolloffMode)1; _cryingAudio.playOnAwake = false; } _voiceAudio = _visualRoot.AddComponent<AudioSource>(); _voiceAudio.spatialBlend = 1f; _voiceAudio.minDistance = 2f; _voiceAudio.maxDistance = 22f; _voiceAudio.volume = 0.85f; _voiceAudio.rolloffMode = (AudioRolloffMode)1; _voiceAudio.playOnAwake = false; _scaredVoiceClips = cachedManeaterTemplate.scaredBabyVoiceSFX; RebuildHideableRenderersList(); _visualsBuilt = true; } private void RebuildHideableRenderersList() { _firstPersonHideableRenderers.Clear(); if ((Object)(object)_visualRoot == (Object)null) { return; } Renderer[] componentsInChildren = _visualRoot.GetComponentsInChildren<Renderer>(false); foreach (Renderer val in componentsInChildren) { if ((Object)(object)val != (Object)null && val.enabled && !(val is ParticleSystemRenderer)) { _firstPersonHideableRenderers.Add(val); } } } private void ApplyConfiguredScale() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(BabySpecConfig.BabyScale, 0.3f, 2f); if ((Object)(object)_visualRoot != (Object)null) { _visualRoot.transform.localScale = Vector3.one * num; } if ((Object)(object)_cc != (Object)null) { float num2 = Mathf.Max(0.04f, 0.22f * num); float num3 = Mathf.Max(num2 * 2f + 0.01f, 0.52f * num); float num4 = Mathf.Clamp(num2 * 0.15f, 0.008f, 0.06f); _cc.radius = num2; _cc.height = num3; _cc.skinWidth = num4; _cc.center = new Vector3(0f, num3 * 0.5f + num4, 0f); _cc.stepOffset = Mathf.Min(0.35f, Mathf.Max(0.02f, num3 - 0.02f)); _cc.slopeLimit = 60f; } Collider grabCollider = _grabCollider; BoxCollider val = (BoxCollider)(object)((grabCollider is BoxCollider) ? grabCollider : null); if (val != null) { Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(Mathf.Max(0.12f, 0.5f * num), Mathf.Max(0.12f, 0.5f * num), Mathf.Max(0.14f, 0.58f * num)); val.size = val2; val.center = new Vector3(0f, val2.y * 0.5f, 0f); } Collider hurtboxCollider = _hurtboxCollider; CapsuleCollider val3 = (CapsuleCollider)(object)((hurtboxCollider is CapsuleCollider) ? hurtboxCollider : null); if (val3 != null) { float num5 = Mathf.Max(0.06f, 0.26f * num); float num6 = Mathf.Max(num5 * 2f, 0.6f * num); val3.radius = num5; val3.height = num6; val3.center = new Vector3(0f, num6 * 0.5f, 0f); } if ((Object)(object)_scanNode != (Object)null) { ((Component)_scanNode).transform.localPosition = new Vector3(0f, Mathf.Max(0.1f, 0.45f * num), 0f); } } public void RefreshFromSyncedConfig() { ApplyConfiguredScale(); UpdateScanNodeSettings(); UpdateGrabInteractionState(); } private void UpdateGrabInteractionState() { bool flag = IsActiveAvatar && !IsStunnedDead && BabySpecConfig.AllowGrabBaby; ((Component)this).gameObject.tag = (flag ? "PhysicsProp" : "Untagged"); if ((Object)(object)_grabCollider != (Object)null) { _grabCollider.enabled = flag; } if ((Object)(object)_grabbable != (Object)null) { ((GrabbableObject)_grabbable).grabbable = flag; if (!flag && ((GrabbableObject)_grabbable).isHeld) { _grabbable.ForceCarrierDropLocal(); } } } private void ApplySkinLocal(BabySkinType skin) { if (SkinType == skin && _cosmeticObjects.Cou