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 RealisticGasLeak v0.1.0
BepInEx/plugins/RealisticGasLeak.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using RuntimeNetcodeRPCValidator; using TMPro; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("RealisticGasLeak")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RealisticGasLeak")] [assembly: AssemblyTitle("RealisticGasLeak")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 RealisticGasLeak { public static class FlashlightPatch { private static ManualLogSource logger = Logger.CreateLogSource("FlashlightPatch"); [HarmonyPatch(typeof(FlashlightItem), "ItemActivate")] [HarmonyPrefix] public static void Prefix(FlashlightItem __instance) { //IL_003f: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0076: 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) if (((TMP_Text)HUDManager.Instance.statusEffectText).alpha > 0f) { logger.LogInfo((object)"should explode"); PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; SerializableVector3 position = new SerializableVector3(((Component)localPlayerController).transform.position); SmkNetworkManager._instance.SpawnExplosionServerRpc(position); localPlayerController.KillPlayer(((Component)localPlayerController).transform.position + Vector3.up + Vector3.back * 2f, true, (CauseOfDeath)3, 0); } else { logger.LogInfo((object)"nah"); } } } public class SmkNetworkManager : NetworkBehaviour { public static SmkNetworkManager _instance; private static ManualLogSource logger = Logger.CreateLogSource("NetworkPatch"); private void Awake() { _instance = this; } [ServerRpc(RequireOwnership = false)] public void SpawnExplosionServerRpc(SerializableVector3 position) { SpawnExplosionClientRpc(position); } [ClientRpc] private void SpawnExplosionClientRpc(SerializableVector3 position) { //IL_0003: 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_000d: Unknown result type (might be due to invalid IL or missing references) SpawnExplosion(position.ToVector3() + Vector3.up); } public void SpawnExplosion(Vector3 explosionPosition, float damageRadius = 6f, float minDamage = 50f, float maxDamage = 100f) { //IL_000b: 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_004a: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_0281: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00da: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) Object.Instantiate<GameObject>(StartOfRound.Instance.explosionPrefab, explosionPosition, Quaternion.Euler(-90f, 0f, 0f), RoundManager.Instance.mapPropsContainer.transform).SetActive(true); float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, explosionPosition); if (num < 14f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else if (num < 25f) { HUDManager.Instance.ShakeCamera((ScreenShakeType)0); } Collider[] array = Physics.OverlapSphere(explosionPosition, damageRadius, 2621448, (QueryTriggerInteraction)2); Collider[] array2 = array; foreach (Collider val in array2) { float num2 = Vector3.Distance(explosionPosition, ((Component)val).transform.position); if (num2 > 4f && Physics.Linecast(explosionPosition, ((Component)val).transform.position + Vector3.up * 0.3f, 256, (QueryTriggerInteraction)1)) { continue; } if (((Component)val).gameObject.layer == 3) { PlayerControllerB component = ((Component)val).gameObject.GetComponent<PlayerControllerB>(); if ((Object)component != (Object)null && ((NetworkBehaviour)component).IsOwner) { float num3 = Mathf.Lerp(minDamage, maxDamage, num2 / damageRadius); component.DamagePlayer(Mathf.RoundToInt(num3), true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } else if (((Component)val).gameObject.layer == 21) { Landmine componentInChildren = ((Component)val).gameObject.GetComponentInChildren<Landmine>(); if ((Object)componentInChildren != (Object)null && !componentInChildren.hasExploded && num2 < damageRadius) { logger.LogInfo((object)"Setting off other mine"); componentInChildren.ExplodeMineServerRpc(); } } else if (((Component)val).gameObject.layer == 19) { EnemyAICollisionDetect componentInChildren2 = ((Component)val).gameObject.GetComponentInChildren<EnemyAICollisionDetect>(); if ((Object)componentInChildren2 != (Object)null && ((NetworkBehaviour)componentInChildren2.mainScript).IsOwner && num2 < damageRadius * 0.75f) { componentInChildren2.mainScript.HitEnemyOnLocalClient(6, default(Vector3), (PlayerControllerB)null, false); } } } int num4 = ~LayerMask.GetMask(new string[1] { "Colliders" }); array = Physics.OverlapSphere(explosionPosition, 10f, num4); for (int j = 0; j < array.Length; j++) { Rigidbody component2 = ((Component)array[j]).GetComponent<Rigidbody>(); if ((Object)component2 != (Object)null) { component2.AddExplosionForce(70f, explosionPosition, 10f); } } } } [Serializable] public class SerializableVector3 { public float x; public float y; public float z; public SerializableVector3(Vector3 vec3) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) x = vec3.x; y = vec3.y; z = vec3.z; } public Vector3 ToVector3() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: 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) return new Vector3(x, y, z); } } [BepInPlugin("RealisticGasLeak", "RealisticGasLeak", "1.0.0")] [BepInDependency("NicholaScott.BepInEx.RuntimeNetcodeRPCValidator", "0.2.5")] public class Plugin : BaseUnityPlugin { private NetcodeValidator netcodeValidator; private void Awake() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown netcodeValidator = new NetcodeValidator("RealisticGasLeak"); netcodeValidator.PatchAll(); netcodeValidator.BindToPreExistingObjectByBehaviour<SmkNetworkManager, Terminal>(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin RealisticGasLeak is loaded!"); Harmony.CreateAndPatchAll(typeof(FlashlightPatch), "RealisticGasLeak"); } } public static class PluginInfo { public const string PLUGIN_GUID = "RealisticGasLeak"; public const string PLUGIN_NAME = "RealisticGasLeak"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }