using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Cryptography;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using RadiationLeak.Coroutines;
using RadiationLeak.Generators;
using RadiationLeak.Managers;
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("RadiationLeak")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RadiationLeak")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("6fcf72b2-ea07-4479-80e7-1e60efce0a52")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RadiationLeak
{
[BepInPlugin("com.actus.lethalcompany.radiationLeak", "Radiation Leak", "1.0.5")]
public class RadiationLeakBase : BaseUnityPlugin
{
private const string modGUID = "com.actus.lethalcompany.radiationLeak";
private const string modName = "Radiation Leak";
private const string modVersion = "1.0.5";
private readonly Harmony harmony = new Harmony("com.actus.lethalcompany.radiationLeak");
internal static RadiationLeakBase Instance;
internal static ManualLogSource logger;
private static string baseFolderPath;
internal AssetBundle networkAssets;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
logger = Logger.CreateLogSource("com.actus.lethalcompany.radiationLeak");
baseFolderPath = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd("RadiationLeak.dll".ToCharArray());
networkAssets = AssetBundle.LoadFromFile(Path.Combine(baseFolderPath, "radiationleakasset"));
harmony.PatchAll();
NetcodePatcher();
}
private static void NetcodePatcher()
{
logger.LogInfo((object)"NetcodePatcher is running!");
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
}
namespace RadiationLeak.Patches
{
[HarmonyPatch]
public class NetworkObjectPatch
{
private static GameObject networkPrefab;
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "Start")]
public static void Init()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
if (!((Object)(object)networkPrefab != (Object)null))
{
networkPrefab = (GameObject)RadiationLeakBase.Instance.networkAssets.LoadAsset("RadiationLeakNetworkManager.prefab");
RadiationLeakBase.logger.LogInfo((object)("Loaded RadiationLeakNetworkManager: " + (object)networkPrefab));
networkPrefab.AddComponent<NetworkHandler>();
NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
RadiationLeakBase.logger.LogInfo((object)"RadiationLeakNetworkManager added!");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(StartOfRound), "Awake")]
private static void SpawnNetworkObject()
{
//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)
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
GameObject val = Object.Instantiate<GameObject>(networkPrefab, Vector3.zero, Quaternion.identity);
val.GetComponent<NetworkObject>().Spawn(false);
RadiationLeakBase.logger.LogInfo((object)"RadiationLeakNetworkManager spawned!");
}
}
}
[HarmonyPatch(typeof(HUDManager), "AddNewScrapFoundToDisplay")]
internal class HudManagerPatch
{
[HarmonyPrefix]
public static void DislpayNewScrapValueOfApparatus(GrabbableObject GObject)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
if (GObject is LungProp && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
{
NetworkHandler.Instance.SyncAllClientsToDisplayNewScrapValueOfApparatus(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)GObject));
}
}
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
internal class PlayerControllerBPatch
{
private static float damageCoolDown = 20f;
private static LungProp apparatus;
[HarmonyPostfix]
public static void DamagePlayerWhenHoldingApparatus(ref PlayerControllerB __instance)
{
//IL_0036: 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_00e8: 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_00bb: 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)
if (!((NetworkBehaviour)__instance).IsOwner)
{
return;
}
bool flag = __instance.currentlyHeldObjectServer is LungProp;
apparatus = (LungProp)((!flag) ? ((object)apparatus) : ((object)(LungProp)__instance.currentlyHeldObjectServer));
if (!((Object)(object)apparatus != (Object)null) || !((NetworkBehaviour)apparatus).IsOwner)
{
return;
}
if (flag)
{
if (damageCoolDown > 0f)
{
damageCoolDown -= Time.deltaTime;
return;
}
if (__instance.health <= 20)
{
__instance.DamagePlayer(100, true, true, (CauseOfDeath)3, 0, false, default(Vector3));
RadiationLeakBase.logger.LogInfo((object)"[PlayerControllerBPatch] Player died of blast damage!");
}
else
{
__instance.DamagePlayer(10, true, true, (CauseOfDeath)3, 0, false, default(Vector3));
RadiationLeakBase.logger.LogInfo((object)("[PlayerControllerBPatch] Player took 10 radiation damage! Current health: " + __instance.health));
}
damageCoolDown = 20f;
}
else if (((GrabbableObject)apparatus).hasHitGround && !((GrabbableObject)apparatus).isInShipRoom)
{
LungProp val = apparatus;
RadiationLeakBase.logger.LogInfo((object)"[PlayerControllerBPatch] Ask server if apparatus should explode!");
NetworkHandler.Instance.AskServerIfApparatusShouldExplode(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)val));
apparatus = null;
}
}
}
[HarmonyPatch(typeof(StartOfRound), "StartGame")]
internal class StartOfRoundPatch
{
[HarmonyPostfix]
public static void SetScrapValueOfApparatus()
{
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
((MonoBehaviour)CoroutineRunner.Instance).StartCoroutine(DelayedExecution());
}
}
private static IEnumerator DelayedExecution()
{
yield return (object)new WaitForSeconds(15f);
LungProp apparatus = ((IEnumerable<LungProp>)Object.FindObjectsOfType<LungProp>()).FirstOrDefault((Func<LungProp, bool>)((LungProp prop) => prop.isLungDocked));
if ((Object)(object)apparatus != (Object)null)
{
RadiationLeakBase.logger.LogInfo((object)"[Server] Picked scrap value for new apparatus!");
NetworkHandler.Instance.SyncScrapValueOfApparatusToAllClients(SecureRandomNumberGenerator.GetRandomNumber(50, 200));
}
}
}
}
namespace RadiationLeak.Managers
{
public class NetworkHandler : NetworkBehaviour
{
public static NetworkHandler Instance { get; private set; }
[RuntimeInitializeOnLoadMethod]
internal static void ConfigureRpcHandler()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
RadiationLeakBase.logger.LogInfo((object)"[ConfigureRpcHandler] Starting RPC initialization process to ensure proper network communication.");
NetworkManager.__rpc_func_table.Add(226968735u, new RpcReceiveHandler(__rpc_handler_226968735));
NetworkManager.__rpc_func_table.Add(867206011u, new RpcReceiveHandler(__rpc_handler_867206011));
NetworkManager.__rpc_func_table.Add(377406330u, new RpcReceiveHandler(__rpc_handler_377406330));
NetworkManager.__rpc_func_table.Add(492953542u, new RpcReceiveHandler(__rpc_handler_492953542));
RadiationLeakBase.logger.LogInfo((object)"[ConfigureRpcHandler] RPC initialization completed successfully. Network communication is now set up.");
}
public override void OnNetworkSpawn()
{
RadiationLeakBase.logger.LogInfo((object)"[OnNetworkSpawn] Initializing NetworkHandler instance. Preparing to set up network behavior and spawn logic.");
if ((Object)(object)Instance != (Object)null && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer))
{
((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true);
}
Instance = this;
((NetworkBehaviour)this).OnNetworkSpawn();
RadiationLeakBase.logger.LogInfo((object)"[OnNetworkSpawn] NetworkHandler instance successfully initialized and ready. Network behavior and spawn logic are now active.");
}
[ClientRpc]
public void SyncScrapValueOfApparatusToAllClients(int scrapValue)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Invalid comparison between Unknown and I4
//IL_004b: 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_0059: 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)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(867206011u, val, (RpcDelivery)0);
FastBufferWriter val3 = val2;
((FastBufferWriter)(ref val3)).WriteValueSafe<int>(ref scrapValue, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 867206011u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
LungProp val4 = ((IEnumerable<LungProp>)Object.FindObjectsOfType<LungProp>()).FirstOrDefault((Func<LungProp, bool>)((LungProp prop) => prop.isLungDocked));
if ((Object)(object)val4 != (Object)null)
{
((GrabbableObject)val4).scrapValue = scrapValue;
}
else
{
RadiationLeakBase.logger.LogWarning((object)"[SyncScrapValueOfApparatusToAllClients] Unable to find the docked apparatus. This shouldn’t happen!");
}
}
}
private static void __rpc_handler_867206011(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_0055: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
FastBufferReader val = reader;
int scrapValue = default(int);
((FastBufferReader)(ref val)).ReadValueSafe<int>(ref scrapValue, default(ForPrimitives));
((NetworkBehaviour)(target as NetworkHandler)).__rpc_exec_stage = (__RpcExecStage)2;
((NetworkHandler)(object)target).SyncScrapValueOfApparatusToAllClients(scrapValue);
((NetworkBehaviour)(target as NetworkHandler)).__rpc_exec_stage = (__RpcExecStage)0;
}
}
[ClientRpc]
public void SyncAllClientsToDisplayNewScrapValueOfApparatus(NetworkBehaviourReference apparatus)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Invalid comparison between Unknown and I4
//IL_004b: 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_0059: 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)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (!((Object)(object)networkManager == (Object)null) && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(226968735u, val, (RpcDelivery)0);
FastBufferWriter val3 = val2;
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkBehaviourReference>(ref apparatus, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 226968735u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
LungProp val4 = (LungProp)NetworkBehaviourReference.op_Implicit(apparatus);
((GrabbableObject)val4).SetScrapValue(((GrabbableObject)val4).scrapValue);
}
}
}
private static void __rpc_handler_226968735(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
NetworkBehaviourReference apparatus = default(NetworkBehaviourReference);
FastBufferReader val = reader;
((FastBufferReader)(ref val)).ReadValueSafe<NetworkBehaviourReference>(ref apparatus, default(ForNetworkSerializable));
((NetworkBehaviour)(target as NetworkHandler)).__rpc_exec_stage = (__RpcExecStage)2;
((NetworkHandler)(object)target).SyncAllClientsToDisplayNewScrapValueOfApparatus(apparatus);
((NetworkBehaviour)(target as NetworkHandler)).__rpc_exec_stage = (__RpcExecStage)0;
}
}
[ServerRpc(RequireOwnership = false)]
public void AskServerIfApparatusShouldExplode(NetworkBehaviourReference apparatus)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Invalid comparison between Unknown and I4
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (!((Object)(object)networkManager != (Object)null) || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(377406330u, val, (RpcDelivery)0);
FastBufferWriter val3 = val2;
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkBehaviourReference>(ref apparatus, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 377406330u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
if (SecureRandomNumberGenerator.GetRandomNumber(1, 100) <= 10)
{
RadiationLeakBase.logger.LogInfo((object)"[AskServerIfApparatusShouldExplode] Explosion of the apparatus granted!");
LungProp val4 = (LungProp)NetworkBehaviourReference.op_Implicit(apparatus);
MeshRenderer component = ((Component)val4).GetComponent<MeshRenderer>();
Collider component2 = ((Component)val4).GetComponent<Collider>();
MeshRenderer[] componentsInChildren = ((Component)val4).GetComponentsInChildren<MeshRenderer>();
NetworkObject networkObject = default(NetworkObject);
((Component)val4).TryGetComponent<NetworkObject>(ref networkObject);
SyncExplosionOfApparatusToAllClients(apparatus);
((MonoBehaviour)CoroutineRunner.Instance).StartCoroutine(DelayedApparatusDestruction(component, component2, componentsInChildren, networkObject));
}
else
{
RadiationLeakBase.logger.LogInfo((object)"[AskServerIfApparatusShouldExplode] Explosion of the apparatus denied!");
}
}
}
[ClientRpc]
public void SyncExplosionOfApparatusToAllClients(NetworkBehaviourReference apparatus)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Invalid comparison between Unknown and I4
//IL_004b: 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_0059: 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)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (!((Object)(object)networkManager == (Object)null) && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(492953542u, val, (RpcDelivery)0);
FastBufferWriter val3 = val2;
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkBehaviourReference>(ref apparatus, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 492953542u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((MonoBehaviour)CoroutineRunner.Instance).StartCoroutine(DelayedApparatusExplosion((LungProp)NetworkBehaviourReference.op_Implicit(apparatus)));
}
}
}
private static void __rpc_handler_377406330(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
NetworkBehaviourReference apparatus = default(NetworkBehaviourReference);
FastBufferReader val = reader;
((FastBufferReader)(ref val)).ReadValueSafe<NetworkBehaviourReference>(ref apparatus, default(ForNetworkSerializable));
((NetworkBehaviour)(target as NetworkHandler)).__rpc_exec_stage = (__RpcExecStage)1;
((NetworkHandler)(object)target).AskServerIfApparatusShouldExplode(apparatus);
((NetworkBehaviour)(target as NetworkHandler)).__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_492953542(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: 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)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
NetworkBehaviourReference apparatus = default(NetworkBehaviourReference);
FastBufferReader val = reader;
((FastBufferReader)(ref val)).ReadValueSafe<NetworkBehaviourReference>(ref apparatus, default(ForNetworkSerializable));
((NetworkBehaviour)(target as NetworkHandler)).__rpc_exec_stage = (__RpcExecStage)2;
((NetworkHandler)(object)target).SyncExplosionOfApparatusToAllClients(apparatus);
((NetworkBehaviour)(target as NetworkHandler)).__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static IEnumerator DelayedApparatusExplosion(LungProp apparatus)
{
yield return (object)new WaitForSeconds(0.25f);
if ((Object)(object)apparatus != (Object)null)
{
RadiationLeakBase.logger.LogInfo((object)"[DelayedApparatusExplosion] SpawnExplosion!");
Landmine.SpawnExplosion(((GrabbableObject)apparatus).GetItemFloorPosition(default(Vector3)), true, 5f, 15f, 50, 5f, (GameObject)null, false);
}
else
{
RadiationLeakBase.logger.LogWarning((object)"Apparatus object is null before detonation. This should not occur!");
}
}
private static IEnumerator DelayedApparatusDestruction(MeshRenderer meshRenderer, Collider collider, MeshRenderer[] children, NetworkObject networkObject)
{
yield return (object)new WaitForSeconds(1f);
if ((Object)(object)meshRenderer != (Object)null)
{
RadiationLeakBase.logger.LogInfo((object)"Disabled meshRenderer!");
((Renderer)meshRenderer).enabled = false;
}
if ((Object)(object)collider != (Object)null)
{
RadiationLeakBase.logger.LogInfo((object)"Disabled collider!");
collider.enabled = false;
}
foreach (MeshRenderer child in children)
{
RadiationLeakBase.logger.LogInfo((object)"Disabled children of apparatus!");
((Renderer)child).enabled = false;
}
if ((Object)(object)networkObject != (Object)null)
{
networkObject.Despawn(true);
RadiationLeakBase.logger.LogInfo((object)"Destroyed apparatus object!");
}
}
}
}
namespace RadiationLeak.Generators
{
internal class SecureRandomNumberGenerator
{
public static int GetRandomNumber(int minInclusive, int maxInclusive)
{
using RNGCryptoServiceProvider rNGCryptoServiceProvider = new RNGCryptoServiceProvider();
byte[] array = new byte[4];
rNGCryptoServiceProvider.GetBytes(array);
int num = BitConverter.ToInt32(array, 0) & 0x7FFFFFFF;
return minInclusive + num % (maxInclusive - minInclusive + 1);
}
}
}
namespace RadiationLeak.Coroutines
{
public class CoroutineRunner : MonoBehaviour
{
private static CoroutineRunner _instance;
public static CoroutineRunner Instance
{
get
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
if ((Object)(object)_instance == (Object)null)
{
GameObject val = new GameObject("CoroutineRunner");
_instance = val.AddComponent<CoroutineRunner>();
Object.DontDestroyOnLoad((Object)(object)val);
}
return _instance;
}
}
}
}