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 LegalizeNuclearBombs v3.0.1
LegalizeNuclearBombs.dll
Decompiled a week agousing System; using System.Collections.Generic; 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.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Photon.Pun; 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: AssemblyCompany("BLOKBUSTR")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("3.0.1.0")] [assembly: AssemblyInformationalVersion("3.0.1+7aeda39ea6ad9334e13ae5234a3069fc89670763")] [assembly: AssemblyProduct("LegalizeNuclearBombs")] [assembly: AssemblyTitle("LegalizeNuclearBombs")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.1.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace LegalizeNuclearBombs { [BepInPlugin("BLOKBUSTR.LegalizeNuclearBombs", "LegalizeNuclearBombs", "3.0.1")] public class LegalizeNuclearBombs : BaseUnityPlugin { public enum HitSensitivity { Light, Medium, Heavy } public static ConfigEntry<HitSensitivity> configHitSensitivity; public static ConfigEntry<int> configMaxHitCount; public static ConfigEntry<float> configExplosionStrength; public static ConfigEntry<int> configPlayerDamage; public static ConfigEntry<int> configEnemyDamage; public static ConfigEntry<float> configCameraShakeStrength; public static ConfigEntry<float> configExplosionDelayTime; public static ConfigEntry<float> configExplosionDelayVolume; public static ConfigEntry<bool> configExplosionDelayParticles; public static ConfigEntry<bool> configExplosionDelayCameraGlitch; public static ConfigEntry<bool> configExplosionUraniumCloud; public static ConfigEntry<float> configWarningVolume; public static ConfigEntry<bool> configShowWarningVisual; public static ConfigEntry<float> configWarningCameraShakeStrength; internal static ConfigEntry<bool> configEnableDebug; internal static LegalizeNuclearBombs Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; RegisterConfig(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); Debug("Debug logging is enabled."); } private void RegisterConfig() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Expected O, but got Unknown //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown configHitSensitivity = ((BaseUnityPlugin)this).Config.Bind<HitSensitivity>("Nuke", "HitSensitivity", HitSensitivity.Medium, "The minimum impact strength that the nuke is sensitive to."); configMaxHitCount = ((BaseUnityPlugin)this).Config.Bind<int>("Nuke", "MaxHitCount", 3, new ConfigDescription("The number of hits the nuke can take until it explodes. Set to 0 to disable and make it explode only when it loses all value (this will disable the explosion delay!).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); configExplosionStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Nuke", "ExplosionStrength", 12f, new ConfigDescription("The strength of the explosion.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 25f), Array.Empty<object>())); configPlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Nuke", "PlayerDamage", 200, new ConfigDescription("The amount of damage dealt to players.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())); configEnemyDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Nuke", "EnemyDamage", 400, new ConfigDescription("The amount of damage dealt to enemies.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1000), Array.Empty<object>())); configCameraShakeStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Nuke", "CameraShakeStrength", 5f, new ConfigDescription("The intensity of the explosion camera shake.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); configExplosionDelayTime = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion Delay", "ExplosionDelayTime", 1f, new ConfigDescription("Time in seconds that the explosion will be delayed after the nuke has taken its last hit. Can be adjusted to match the length of a custom sound added with loaforcsSoundAPI, as long as it's under 10 seconds. Please do not change if using the default sound.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); configExplosionDelayVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Explosion Delay", "ExplosionDelayVolume", 0.65f, new ConfigDescription("The volume of the explosion delay sound.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); configExplosionDelayParticles = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosion Delay", "ExplosionDelayParticles", true, "Whether to play particle effects during the explosion delay."); configExplosionDelayCameraGlitch = ((BaseUnityPlugin)this).Config.Bind<bool>("Explosion Delay", "ExplosionDelayCameraGlitch", true, "Whether to play the camera glitch effect to players holding the nuke when its explosion delay begins."); configExplosionUraniumCloud = ((BaseUnityPlugin)this).Config.Bind<bool>("Uranium Cloud", "ExplosionUraniumCloud", true, "Whether to spawn a uranium cloud upon explosion."); configWarningVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Break Warning", "WarningVolume", 0.35f, new ConfigDescription("The volume of the warning sound. Set to 0 to disable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); configShowWarningVisual = ((BaseUnityPlugin)this).Config.Bind<bool>("Break Warning", "ShowWarningVisual", true, "Whether to momentarily show a red glow on the nuke when the break warning triggers."); configWarningCameraShakeStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Break Warning", "WarningCameraShakeStrength", 1.5f, new ConfigDescription("The intensity of the warning camera shake.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); configEnableDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "EnableDebugLogging", false, "Whether to enable debug logging."); } public static void Debug(string message, Object? obj = null) { if (configEnableDebug.Value) { Logger.LogDebug((object)(Object.op_Implicit(obj) ? (((object)obj)?.ToString() + ": " + message) : message)); } } } public class NukeValuable : MonoBehaviour { public Transform center; public GameObject mesh; private Material material; private static readonly int emissionColor = Shader.PropertyToID("_EmissionColor"); private PhysGrabObject physGrabObject; private PhotonView photonView; public GameObject uraniumCloudPrefab; public Sound warningSound; public Sound explosionDelaySound; private int hitCount; private bool detonated; public List<ParticleSystem> explosionParticles; private bool explosionDelayActive; private bool explosionDelayImpulse = true; private float explosionDelayTime; private bool emissionActive; private bool emissionImpulse; private float emissionTime; private void Start() { material = ((Renderer)mesh.GetComponent<MeshRenderer>()).material; physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); photonView = ((Component)this).GetComponent<PhotonView>(); LegalizeNuclearBombs.Debug("New nuke valuable spawned", (Object?)(object)this); } private void Update() { EmissionLogic(); if (!SemiFunc.IsNotMasterClient() && explosionDelayActive) { ExplosionDelayLogic(); } } private void EmissionLogic() { //IL_0072: 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_00a8: 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_00e7: 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_012d: Unknown result type (might be due to invalid IL or missing references) if (!emissionActive) { emissionImpulse = true; return; } if (emissionImpulse) { GameDirector.instance.CameraImpact.ShakeDistance(LegalizeNuclearBombs.configWarningCameraShakeStrength.Value, 1f, 6f, ((Component)this).transform.position, 0.25f); emissionImpulse = false; } LegalizeNuclearBombs.Debug($"emissionColor: {material.GetColor(emissionColor).r}"); material.SetColor(emissionColor, Color.white * Mathf.Lerp(material.GetColor(emissionColor).r, Mathf.Clamp(emissionTime, 0f, 1f), 0.35f)); if (material.GetColor(emissionColor).r > 0.01f) { if (emissionTime > 0f) { emissionTime -= Time.deltaTime; } } else { material.SetColor(emissionColor, Color.black); emissionActive = false; } } private void ExplosionDelayLogic() { //IL_0061: 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) explosionDelayTime -= Time.deltaTime; if (explosionDelayTime <= 0f) { SetExplode(); } else if (explosionDelayImpulse) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("ExplosionDelayRPC", (RpcTarget)0, Array.Empty<object>()); } else { ExplosionDelayRPC(); } explosionDelayImpulse = false; } } [PunRPC] private void ExplosionDelayRPC(PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(info)) { return; } float value = LegalizeNuclearBombs.configExplosionDelayVolume.Value; if (value > 0f) { explosionDelaySound.Play(((Component)center).transform.position, value, 1f, 1f, 1f); } material.SetColor(emissionColor, Color.white); if (GameplayManager.instance.photosensitivity) { return; } if (LegalizeNuclearBombs.configExplosionDelayCameraGlitch.Value && physGrabObject.grabbedLocal) { CameraGlitch.Instance.PlayLong(); } foreach (ParticleSystem explosionParticle in explosionParticles) { explosionParticle.Play(); } } public void PotentialExplodeLight() { if (!SemiFunc.IsNotMasterClient() && LegalizeNuclearBombs.configHitSensitivity.Value == LegalizeNuclearBombs.HitSensitivity.Light) { PotentialExplodeHeavy(); } } public void PotentialExplodeMedium() { if (!SemiFunc.IsNotMasterClient() && LegalizeNuclearBombs.configHitSensitivity.Value != LegalizeNuclearBombs.HitSensitivity.Heavy) { PotentialExplodeHeavy(); } } public void PotentialExplodeHeavy() { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsNotMasterClient() || LegalizeNuclearBombs.configMaxHitCount.Value <= 0) { return; } hitCount++; if (hitCount >= LegalizeNuclearBombs.configMaxHitCount.Value) { if (explosionDelayActive) { return; } if (LegalizeNuclearBombs.configExplosionDelayTime.Value <= 0f) { SetExplode(); } else { explosionDelayTime = LegalizeNuclearBombs.configExplosionDelayTime.Value; explosionDelayActive = true; } } else if (hitCount >= LegalizeNuclearBombs.configMaxHitCount.Value - 1) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("PlayWarningRPC", (RpcTarget)0, Array.Empty<object>()); } else { PlayWarningRPC(); } } LegalizeNuclearBombs.Debug("hitCount: " + hitCount, (Object?)(object)this); } [PunRPC] private void PlayWarningRPC(PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0001: 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) if (SemiFunc.MasterOnlyRPC(info)) { float value = LegalizeNuclearBombs.configWarningVolume.Value; if (value > 0f) { warningSound.Play(center.position, value, 1f, 1f, 1f); } if (LegalizeNuclearBombs.configShowWarningVisual.Value) { emissionTime = 1.5f; emissionImpulse = true; emissionActive = true; } LegalizeNuclearBombs.Debug("Played warning, one hit left", (Object?)(object)this); } } public void SetExplode() { if (!SemiFunc.IsNotMasterClient()) { float value = LegalizeNuclearBombs.configExplosionStrength.Value; int value2 = LegalizeNuclearBombs.configPlayerDamage.Value; bool value3 = LegalizeNuclearBombs.configExplosionUraniumCloud.Value; if (SemiFunc.IsMultiplayer()) { photonView.RPC("SetExplodeRPC", (RpcTarget)1, new object[3] { value, value2, value3 }); } Explode(value, value2, value3); } } [PunRPC] private void SetExplodeRPC(float explosionStrength, int playerDamage, bool uranium, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { Explode(explosionStrength, playerDamage, uranium); } } public void Explode(float explosionStrength, int playerDamage, bool uranium) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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) if (!detonated) { detonated = true; ((Component)this).GetComponent<ParticleScriptExplosion>().Spawn(center.position, explosionStrength, playerDamage, LegalizeNuclearBombs.configEnemyDamage.Value, LegalizeNuclearBombs.configExplosionStrength.Value, false, false, LegalizeNuclearBombs.configCameraShakeStrength.Value); if (uranium) { Object.Instantiate<GameObject>(uraniumCloudPrefab, ((Component)center).transform.position, Quaternion.identity).GetComponent<UraniumScript>(); } if (Object.op_Implicit((Object)(object)physGrabObject)) { physGrabObject.impactDetector.DestroyObject(true); } LegalizeNuclearBombs.Debug($"Explode (explosionStrength: {explosionStrength}, playerDamage = {playerDamage}, uranium = {uranium})", (Object?)(object)this); } } } }