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 TheManBehindTheTree v1.0.1
EggRoom.dll
Decompiled 9 hours agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using EggRoom.NetcodePatcher; using GameNetcodeStuff; using HarmonyLib; using LethalLevelLoader; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("EggRoom")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("MelanieMelicious")] [assembly: AssemblyProduct("Egg Room")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [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; } } } public class EggDoor : NetworkBehaviour { internal static EggDoor Instance; [SerializeField] private Transform exitPoint; [SerializeField] private AudioSource theSong; internal Transform entrancePoint; private bool isEntrance; private void Start() { Instance = this; } public void TeleportOut() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00aa: 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) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; Transform thisPlayerBody = localPlayerController.thisPlayerBody; if ((Object)(object)entrancePoint == (Object)null) { entrancePoint = StartOfRound.Instance.playerSpawnPositions[0]; } localPlayerController.TeleportPlayer(entrancePoint.position, false, 0f, false, true); localPlayerController.isInsideFactory = !isEntrance; localPlayerController.isInElevator = false; localPlayerController.isInHangarShipRoom = false; TeleportOutServerRpc((int)localPlayerController.playerClientId, entrancePoint.position.x, entrancePoint.position.y, entrancePoint.position.z, entrancePoint.eulerAngles.y); localPlayerController.thisController.SimpleMove(Vector3.zero); theSong.Stop(); Object.FindObjectOfType<AudioReverbPresets>().audioPresets[1].ChangeAudioReverbForPlayer(StartOfRound.Instance.allPlayerScripts[GameNetworkManager.Instance.localPlayerController.playerClientId]); } [ServerRpc(RequireOwnership = false)] private void TeleportOutServerRpc(int playerObj, float posX, float posY, float posZ, float rotY) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1174278369u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerObj); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref posX, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref posY, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref posZ, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref rotY, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1174278369u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; TeleportOutClientRpc(playerObj, posX, posY, posZ, rotY); } } } [ClientRpc] private void TeleportOutClientRpc(int playerObj, float posX, float posY, float posZ, float rotY) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(117754141u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerObj); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref posX, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref posY, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref posZ, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref rotY, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 117754141u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)StartOfRound.Instance.allPlayerScripts[playerObj] == (Object)(object)GameNetworkManager.Instance.localPlayerController)) { StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(new Vector3(posX, posY, posZ), true, rotY, false, true); } } } internal void TeleportIn(EntranceTeleport entrance) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_00a0: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; Transform thisPlayerBody = localPlayerController.thisPlayerBody; entrancePoint = entrance.entrancePoint; isEntrance = entrance.isEntranceToBuilding; localPlayerController.TeleportPlayer(exitPoint.position, false, 0f, false, true); localPlayerController.isInsideFactory = true; localPlayerController.isInElevator = false; localPlayerController.isInHangarShipRoom = false; thisPlayerBody.eulerAngles = new Vector3(thisPlayerBody.eulerAngles.x, exitPoint.eulerAngles.y, thisPlayerBody.eulerAngles.z); TeleportInServerRpc((int)localPlayerController.playerClientId); localPlayerController.thisController.SimpleMove(Vector3.zero); theSong.Play(); TimeOfDay.Instance.TimeOfDayMusic.Stop(); } [ServerRpc(RequireOwnership = false)] private void TeleportInServerRpc(int playerObj) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(227115706u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerObj); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 227115706u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; TeleportInClientRpc(playerObj); } } } [ClientRpc] private void TeleportInClientRpc(int playerObj) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1232680621u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerObj); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1232680621u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((Object)(object)StartOfRound.Instance.allPlayerScripts[playerObj] == (Object)(object)GameNetworkManager.Instance.localPlayerController)) { StartOfRound.Instance.allPlayerScripts[playerObj].TeleportPlayer(exitPoint.position, true, exitPoint.eulerAngles.y, false, true); } } } 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(1174278369u, new RpcReceiveHandler(__rpc_handler_1174278369), "TeleportOutServerRpc"); ((NetworkBehaviour)this).__registerRpc(117754141u, new RpcReceiveHandler(__rpc_handler_117754141), "TeleportOutClientRpc"); ((NetworkBehaviour)this).__registerRpc(227115706u, new RpcReceiveHandler(__rpc_handler_227115706), "TeleportInServerRpc"); ((NetworkBehaviour)this).__registerRpc(1232680621u, new RpcReceiveHandler(__rpc_handler_1232680621), "TeleportInClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1174278369(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerObj = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObj); float posX = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref posX, default(ForPrimitives)); float posY = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref posY, default(ForPrimitives)); float posZ = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref posZ, default(ForPrimitives)); float rotY = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref rotY, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EggDoor)(object)target).TeleportOutServerRpc(playerObj, posX, posY, posZ, rotY); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_117754141(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerObj = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObj); float posX = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref posX, default(ForPrimitives)); float posY = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref posY, default(ForPrimitives)); float posZ = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref posZ, default(ForPrimitives)); float rotY = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref rotY, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((EggDoor)(object)target).TeleportOutClientRpc(playerObj, posX, posY, posZ, rotY); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_227115706(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerObj = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObj); target.__rpc_exec_stage = (__RpcExecStage)1; ((EggDoor)(object)target).TeleportInServerRpc(playerObj); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1232680621(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerObj = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObj); target.__rpc_exec_stage = (__RpcExecStage)1; ((EggDoor)(object)target).TeleportInClientRpc(playerObj); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "EggDoor"; } } internal class HarmonyPatches { [HarmonyPrefix] [HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayer")] private static bool EggRoomChance(EntranceTeleport __instance) { if (Random.Range(0, 50) >= 1) { return true; } EggDoor.Instance.TeleportIn(__instance); if (__instance.audioReverbPreset != -1) { Object.FindObjectOfType<AudioReverbPresets>().audioPresets[__instance.audioReverbPreset].ChangeAudioReverbForPlayer(StartOfRound.Instance.allPlayerScripts[GameNetworkManager.Instance.localPlayerController.playerClientId]); } return false; } [HarmonyPostfix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void SpawnEggRoom(StartOfRound __instance) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (GameNetworkManager.Instance.isHostingGame) { GameObject val = Object.Instantiate<GameObject>(Plugin.bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/WellThereIsAManHere/TheManBehindTheTree.prefab"), new Vector3(1000f, 1000f, 1000f), Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); } } } [BepInPlugin("MelanieMelicious.EggRoomScript", "Melanie Melicious - Egg Room Side B (Script)", "1.0.0")] internal class Plugin : BaseUnityPlugin { private const string GUID = "MelanieMelicious.EggRoomScript"; private const string NAME = "Melanie Melicious - Egg Room Side B (Script)"; private const string VERSION = "1.0.0"; private readonly Harmony harmony = new Harmony("MelanieMelicious.EggRoomScript"); internal static AssetBundle bundle; private void Awake() { bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "thetreeman")); harmony.PatchAll(typeof(HarmonyPatches)); LethalLevelLoaderNetworkManager.RegisterNetworkPrefab(bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/WellThereIsAManHere/TheManBehindTheTree.prefab")); } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace EggRoom.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }