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.1.0
LegalizeNuclearBombs.dll
Decompiled 2 months agousing 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 BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib; using REPOLib.Modules; 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: AssemblyCompany("BLOKBUSTR")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("3.1.0.0")] [assembly: AssemblyInformationalVersion("3.1.0+b90a153205151e30f1a60a07459a66931fe89304")] [assembly: AssemblyProduct("LegalizeNuclearBombs")] [assembly: AssemblyTitle("LegalizeNuclearBombs")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.1.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class LegalizeNuclearBombs : BaseUnityPlugin { public enum HitSensitivity { Light, Medium, Heavy } internal enum LogLevels { Disabled, Enabled, Verbose } 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> configSpawnUraniumCloud; public static ConfigEntry<float> configUraniumCloudSize; public static ConfigEntry<float> configUraniumCloudDuration; public static ConfigEntry<int> configUraniumPlayerDamage; public static ConfigEntry<float> configUraniumPlayerDamageRate; public static ConfigEntry<int> configUraniumEnemyDamage; public static ConfigEntry<float> configUraniumEnemyDamageRate; public static ConfigEntry<float> configWarningVolume; public static ConfigEntry<bool> configShowWarningVisual; public static ConfigEntry<float> configWarningCameraShakeStrength; public static ConfigEntry<float> configIndestructibleDroneBatteryDrain; internal static ConfigEntry<LogLevels> configDebugLogLevel; internal static LegalizeNuclearBombs Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; RegisterConfig(); Patch(); try { Logger.LogInfo((object)"Loading AssetBundle..."); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "LegalizeNuclearBombs"); BundleLoader.LoadBundle(text, (Action<AssetBundle>)delegate(AssetBundle assetBundle) { string[] allAssetNames = assetBundle.GetAllAssetNames(); foreach (string text2 in allAssetNames) { Logger.LogDebug((object)text2); } GameObject val = assetBundle.LoadAsset<GameObject>("Nuke Uranium Cloud"); Logger.LogDebug((object)$"{val}"); if (Object.op_Implicit((Object)(object)val)) { Utilities.FixAudioMixerGroups(val); } else { Logger.LogError((object)"Nuke Uranium Cloud prefab not found"); } }, true); } catch (Exception ex) { Logger.LogError((object)("Failed to fix Audio Mixer Group on prefab Nuke Uranium Cloud with error: " + ex.Message)); } Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); if (configDebugLogLevel.Value == LogLevels.Enabled) { Logger.LogDebug((object)"Debug logging is enabled."); } if (configDebugLogLevel.Value == LogLevels.Verbose) { Logger.LogDebug((object)"Verbose 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_0284: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Expected O, but got Unknown //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Expected O, but got Unknown //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Expected O, but got Unknown //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Expected O, but got Unknown //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Expected O, but got Unknown //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Expected O, but got Unknown //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0443: 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", 5f, new ConfigDescription("The strength of the explosion.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())); configPlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Nuke", "PlayerDamage", 150, 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", 200, 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."); configSpawnUraniumCloud = ((BaseUnityPlugin)this).Config.Bind<bool>("Uranium Cloud", "SpawnUraniumCloud", true, "Whether to spawn a uranium cloud upon explosion."); configUraniumCloudSize = ((BaseUnityPlugin)this).Config.Bind<float>("Uranium Cloud", "UraniumCloudSize", 20f, new ConfigDescription("The size of the uranium cloud, including its damage range.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 45f), Array.Empty<object>())); configUraniumCloudDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Uranium Cloud", "UraniumCloudDuration", 15f, new ConfigDescription("The duration that the uranium cloud will linger for. The HurtCollider will disappear once the duration expires, but particles will linger for several seconds longer.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 45f), Array.Empty<object>())); configUraniumPlayerDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Uranium Cloud", "UraniumPlayerDamage", 5, new ConfigDescription("The amount of damage dealt to players who are inside the uranium cloud.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 25), Array.Empty<object>())); configUraniumPlayerDamageRate = ((BaseUnityPlugin)this).Config.Bind<float>("Uranium Cloud", "UraniumPlayerDamageRate", 1.5f, new ConfigDescription("The rate per second to damage the player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 5f), Array.Empty<object>())); configUraniumEnemyDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Uranium Cloud", "UraniumEnemyDamage", 5, new ConfigDescription("The amount of damage dealt to enemies that are inside the uranium cloud.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 25), Array.Empty<object>())); configUraniumEnemyDamageRate = ((BaseUnityPlugin)this).Config.Bind<float>("Uranium Cloud", "UraniumEnemyDamageRate", 2f, new ConfigDescription("The rate per second to damage enemies.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.25f, 5f), Array.Empty<object>())); 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>())); configIndestructibleDroneBatteryDrain = ((BaseUnityPlugin)this).Config.Bind<float>("Items", "IndestructibleDroneBatteryDrain", 2f, new ConfigDescription("The multiplier to accelerate the Indestructible Drone's battery drain when attached to the Nuke. Set to 1 for vanilla behavior.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())); configDebugLogLevel = ((BaseUnityPlugin)this).Config.Bind<LogLevels>("Debug", "DebugLogLevel", LogLevels.Disabled, "The debug logging level to use. Keep this disabled during normal gameplay."); } private void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } public static void Debug(string message, Object obj) { if (configDebugLogLevel.Value > LogLevels.Disabled) { Logger.LogDebug((object)(Object.op_Implicit(obj) ? $"{obj} ({obj.GetInstanceID()}): {message}" : message)); } } public static void DebugVerbose(string message, Object obj) { if (configDebugLogLevel.Value == LogLevels.Verbose) { Logger.LogDebug((object)(Object.op_Implicit(obj) ? $"{obj} ({obj.GetInstanceID()}): {message}" : message)); } } } public class NukeUraniumCloud : MonoBehaviour { public ParticleSystem uraniumCloudParticles; public Light particlePointLight; public HurtCollider hurtCollider; public Sound uraniumGeigerLoop; internal float size; internal float duration; internal int damage; internal float damageRate; private float geigerLoopTime; private void Start() { //IL_0024: 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_0039: 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_006a: 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_0097: Unknown result type (might be due to invalid IL or missing references) particlePointLight.range = size * 1.5f; ((Component)uraniumCloudParticles).transform.localScale = Vector3.one * size * 0.2f; MainModule main = uraniumCloudParticles.main; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(duration + 3f, duration + 6f); uraniumCloudParticles.Play(); ((Component)hurtCollider).transform.localScale = Vector3.one * size; hurtCollider.playerDamage = damage; hurtCollider.playerDamageCooldown = damageRate; if (SemiFunc.IsMasterClientOrSingleplayer()) { hurtCollider.enemyDamage = LegalizeNuclearBombs.configEnemyDamage.Value; hurtCollider.enemyDamageCooldown = LegalizeNuclearBombs.configUraniumEnemyDamageRate.Value; } hurtCollider.timer = duration; ((Component)hurtCollider).gameObject.SetActive(true); geigerLoopTime = duration + 1f; Object.Destroy((Object)(object)((Component)this).gameObject, duration + 6f); LegalizeNuclearBombs.Debug($"Spawned NukeUraniumCloud with total duration {duration + 6f} seconds", (Object)(object)this); } private void Update() { uraniumGeigerLoop.PlayLoop(geigerLoopTime > 0f, 2f, 0.33f, 1f, 1f); if (geigerLoopTime > 0f) { geigerLoopTime -= Time.deltaTime; } if (SemiFunc.PerSecond(1f, (Object)(object)this)) { LegalizeNuclearBombs.DebugVerbose($"uraniumGeigerLoop playing: {uraniumGeigerLoop.Source.isPlaying}", (Object)(object)this); } } } public class ValuableWarhead : MonoBehaviour { public Transform center; public MeshRenderer mesh; private Material material; private static readonly int emissionColor = Shader.PropertyToID("_EmissionColor"); public List<ParticleSystem> explosionParticles; public GameObject uraniumCloudPrefab; [Space] public PhysGrabObject physGrabObject; public PhotonView photonView; public Sound warningSound; public Sound explosionDelaySound; private float explosionStrength; private int playerDamage; private bool spawnUraniumCloud; private float uraniumCloudSize; private float uraniumCloudDuration; private int uraniumPlayerDamage; private float uraniumPlayerDamageRate; private int hitCount; private bool detonated; 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).material; LegalizeNuclearBombs.Debug("New nuke valuable spawned", (Object)(object)this); if (!SemiFunc.IsNotMasterClient()) { explosionStrength = LegalizeNuclearBombs.configExplosionStrength.Value; playerDamage = LegalizeNuclearBombs.configPlayerDamage.Value; spawnUraniumCloud = LegalizeNuclearBombs.configSpawnUraniumCloud.Value; uraniumCloudSize = LegalizeNuclearBombs.configUraniumCloudSize.Value; uraniumCloudDuration = LegalizeNuclearBombs.configUraniumCloudDuration.Value; uraniumPlayerDamage = LegalizeNuclearBombs.configUraniumPlayerDamage.Value; uraniumPlayerDamageRate = LegalizeNuclearBombs.configUraniumPlayerDamageRate.Value; LogInitValues(); if (SemiFunc.IsMultiplayer()) { ((MonoBehaviour)this).StartCoroutine(LateStart()); } } } private IEnumerator LateStart() { yield return (object)new WaitForSeconds(5f); while (physGrabObject.impactDetector.indestructibleSpawnTimer > 0f) { yield return (object)new WaitForSeconds(0.1f); } photonView.RPC("SyncValuesRPC", (RpcTarget)1, new object[7] { explosionStrength, playerDamage, spawnUraniumCloud, uraniumCloudSize, uraniumCloudDuration, uraniumPlayerDamage, uraniumPlayerDamageRate }); LegalizeNuclearBombs.Debug("Synced values to clients", (Object)(object)this); } [PunRPC] private void SyncValuesRPC(float strength, int damage, bool cloud, float cloudSize, float cloudDuration, int cloudDamage, float cloudDamageRate, PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { explosionStrength = strength; playerDamage = damage; spawnUraniumCloud = cloud; uraniumCloudSize = cloudSize; uraniumCloudDuration = cloudDuration; uraniumPlayerDamage = cloudDamage; uraniumPlayerDamageRate = cloudDamageRate; LogInitValues(); } } private void LogInitValues() { LegalizeNuclearBombs.Logger.LogDebug((object)("Initialized values:" + $"\nexplosionStrength = {explosionStrength}" + $"\nplayerDamage = {playerDamage}" + $"\nspawnUraniumCloud = {spawnUraniumCloud}" + $"\nuraniumCloudSize = {uraniumCloudSize}" + $"\nuraniumCloudDuration = {uraniumCloudDuration}" + $"\nuraniumPlayerDamage = {uraniumPlayerDamage}" + $"\nuraniumPlayerDamageRate = {uraniumPlayerDamageRate}")); } private void Update() { EmissionLogic(); if (!SemiFunc.IsNotMasterClient() && explosionDelayActive) { ExplosionDelayLogic(); } } private void EmissionLogic() { //IL_004a: 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_00bd: 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) //IL_00fc: 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_0144: 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; } if (LegalizeNuclearBombs.configDebugLogLevel.Value == LegalizeNuclearBombs.LogLevels.Verbose) { LegalizeNuclearBombs.Logger.LogDebug((object)$"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) { LegalizeNuclearBombs.Debug("Photosensitivity is enabled, skipping explosion delay visual effects.", (Object)(object)this); 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()) { if (SemiFunc.IsMultiplayer()) { photonView.RPC("SetExplodeRPC", (RpcTarget)1, Array.Empty<object>()); } Explode(); } } [PunRPC] private void SetExplodeRPC(PhotonMessageInfo info = default(PhotonMessageInfo)) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.MasterOnlyRPC(info)) { Explode(); } } public void Explode() { //IL_0023: 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 (!detonated) { detonated = true; ((Component)this).GetComponent<ParticleScriptExplosion>().Spawn(center.position, explosionStrength, playerDamage, LegalizeNuclearBombs.configEnemyDamage.Value, LegalizeNuclearBombs.configExplosionStrength.Value, false, false, LegalizeNuclearBombs.configCameraShakeStrength.Value); if (spawnUraniumCloud) { NukeUraniumCloud component = Object.Instantiate<GameObject>(uraniumCloudPrefab, ((Component)center).transform.position, Quaternion.identity).GetComponent<NukeUraniumCloud>(); component.size = uraniumCloudSize; component.duration = uraniumCloudDuration; component.damage = uraniumPlayerDamage; component.damageRate = uraniumPlayerDamageRate; } if (Object.op_Implicit((Object)(object)physGrabObject)) { physGrabObject.impactDetector.DestroyObject(true); } } } } } namespace LegalizeNuclearBombs.Patches { [HarmonyPatch(typeof(ItemDroneIndestructible))] internal static class ItemDroneIndestructiblePatch { [HarmonyPostfix] [HarmonyPatch("Update")] private static void UpdatePatch(ItemDroneIndestructible __instance) { float value = LegalizeNuclearBombs.configIndestructibleDroneBatteryDrain.Value; __instance.itemDrone.itemBattery.batteryDrainRate = ((value <= 1f || __instance.itemEquippable.isEquipped || !__instance.itemDrone.magnetActive || !Object.op_Implicit((Object)(object)((Component)__instance.itemDrone.magnetTargetPhysGrabObject).GetComponent<ValuableWarhead>())) ? __instance.itemDrone.batteryDrainRate : (__instance.itemDrone.batteryDrainRate * value)); } } }