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 ThrowableEmberCharge v1.0.0
StickyEmberCharge.dll
Decompiled a week agousing System; 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 HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_guiutils")] [assembly: IgnoresAccessChecksTo("assembly_utils")] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: IgnoresAccessChecksTo("Splatform")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyCompany("StickyEmberCharge")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("StickyEmberCharge")] [assembly: AssemblyTitle("StickyEmberCharge")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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; } } } namespace StickyEmberCharge { [BepInPlugin("ElKameleon.StickyEmberCharge", "Sticky Ember Charge", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public sealed class StickyEmberChargePlugin : BaseUnityPlugin { public const string ModGuid = "ElKameleon.StickyEmberCharge"; public const string ModName = "Sticky Ember Charge"; public const string ModVersion = "1.0.0"; private const string ItemPrefabName = "StickyEmberCharge"; private const string ProxyPrefabName = "stickyember_projectile"; private const string OozeItemName = "BombOoze"; private const string OozeProjectileName = "oozebomb_projectile"; private const string EmberItemName = "BombDynamite"; private const string EmberProjectileName = "bombdynamite_projectile"; private const string EmberExplosionName = "bombdynamite_explosion"; private const string StickyExplosionName = "stickyember_explosion"; internal const string FlightVisualName = "SEC_EmberVisual"; private const float HeldVisualScale = 0.7f; private const string EmbeddedBundleResourceName = "StickyEmberCharge.Assets.stickyember"; private const string StickyShellPrefabPath = "assets/stickyembercharge/prefabs/stickyembershell.prefab"; private const string EmbeddedIconResourceName = "StickyEmberCharge.Assets.stickyember_icon.png"; private Sprite _stickyEmberIcon; private Harmony _harmony; private bool _registered; private AssetBundle _stickyEmberBundle; private GameObject _stickyEmberShellPrefab; private void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown LoadStickyEmberAssets(); LoadStickyEmberIcon(); _harmony = new Harmony("ElKameleon.StickyEmberCharge"); _harmony.PatchAll(); PrefabManager.OnVanillaPrefabsAvailable += RegisterModContent; } private void OnDestroy() { PrefabManager.OnVanillaPrefabsAvailable -= RegisterModContent; Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } if ((Object)(object)_stickyEmberBundle != (Object)null) { _stickyEmberBundle.Unload(false); _stickyEmberBundle = null; _stickyEmberShellPrefab = null; } _stickyEmberIcon = null; } private void LoadStickyEmberAssets() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); using (Stream stream = executingAssembly.GetManifestResourceStream("StickyEmberCharge.Assets.stickyember")) { if (stream == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not find embedded AssetBundle resource 'StickyEmberCharge.Assets.stickyember'."); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Embedded resources:"); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { ((BaseUnityPlugin)this).Logger.LogInfo((object)(" " + text)); } return; } _stickyEmberBundle = AssetBundle.LoadFromStream(stream); } if ((Object)(object)_stickyEmberBundle == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load embedded stickyember AssetBundle."); return; } _stickyEmberShellPrefab = _stickyEmberBundle.LoadAsset<GameObject>("assets/stickyembercharge/prefabs/stickyembershell.prefab"); if ((Object)(object)_stickyEmberShellPrefab == (Object)null) { string[] manifestResourceNames = _stickyEmberBundle.GetAllAssetNames(); foreach (string text2 in manifestResourceNames) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Sticky Ember bundle asset: " + text2)); if (text2.EndsWith("/stickyembershell.prefab", StringComparison.OrdinalIgnoreCase)) { _stickyEmberShellPrefab = _stickyEmberBundle.LoadAsset<GameObject>(text2); break; } } } if ((Object)(object)_stickyEmberShellPrefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"stickyember AssetBundle loaded, but StickyEmberShell prefab was not found."); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)"StickyEmberShell prefab loaded successfully."); } } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to load Sticky Ember assets: {arg}"); } } private void LoadStickyEmberIcon() { //IL_0088: 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) using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("StickyEmberCharge.Assets.stickyember_icon.png"); if (stream == null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Could not find embedded icon resource 'StickyEmberCharge.Assets.stickyember_icon.png'."); return; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = AssetUtils.LoadImage(array); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load Sticky Ember icon PNG."); return; } ((Object)val).name = "StickyEmberCharge_Icon"; _stickyEmberIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); ((Object)_stickyEmberIcon).name = "StickyEmberCharge_Icon"; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Sticky Ember icon loaded successfully."); } private void RegisterModContent() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown if (_registered) { return; } _registered = true; try { GameObject oozeItem = RequirePrefab("BombOoze"); GameObject oozeProjectile = RequirePrefab("oozebomb_projectile"); GameObject emberProjectile = RequirePrefab("bombdynamite_projectile"); GameObject val = CreateInstantExplosion(RequirePrefab("bombdynamite_explosion")); PrefabManager.Instance.AddPrefab(new CustomPrefab(val, false)); GameObject val2 = CreateProxyProjectile(oozeProjectile, emberProjectile, val, _stickyEmberShellPrefab); PrefabManager.Instance.AddPrefab(new CustomPrefab(val2, false)); CreateStickyEmberItem(oozeItem, val2, _stickyEmberShellPrefab, _stickyEmberIcon); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Sticky Ember Charge 1.0.0 registered successfully."); } catch (Exception arg) { _registered = false; ((BaseUnityPlugin)this).Logger.LogError((object)string.Format("Failed to register {0}: {1}", "Sticky Ember Charge", arg)); } finally { PrefabManager.OnVanillaPrefabsAvailable -= RegisterModContent; } } private static GameObject CreateInstantExplosion(GameObject vanillaExplosion) { GameObject obj = PrefabManager.Instance.CreateClonedPrefab("stickyember_explosion", vanillaExplosion); Aoe component = obj.GetComponent<Aoe>(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException("bombdynamite_explosion has no Aoe component."); } component.m_activationDelay = 0f; component.m_ttl = 0.05f; component.m_ttlMax = 0.05f; component.m_hitAfterTtl = true; return obj; } private static GameObject CreateProxyProjectile(GameObject oozeProjectile, GameObject emberProjectile, GameObject stickyExplosion, GameObject stickyShellPrefab) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabManager.Instance.CreateClonedPrefab("stickyember_projectile", oozeProjectile); Projectile component = val.GetComponent<Projectile>(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException("oozebomb_projectile has no Projectile component."); } component.m_spawnOnHit = null; component.m_spawnOnTtl = false; component.m_spawnOnHitChance = 1f; component.m_spawnCount = 1; if (component.m_randomSpawnOnHit != null) { component.m_randomSpawnOnHit.Clear(); } component.m_aoe = 0f; component.m_damage = default(DamageTypes); component.m_attackForce = 0f; component.m_hitEffects = new EffectList(); component.m_hitWaterEffects = new EffectList(); component.m_spawnOnHitEffects = new EffectList(); component.m_bounce = false; component.m_stayAfterHitStatic = true; component.m_stayAfterHitDynamic = true; component.m_stayTTL = 3f; component.m_attachToRigidBody = true; component.m_attachToClosestBone = true; component.m_hideOnHit = null; component.m_stopEmittersOnHit = false; component.m_canChangeVisuals = false; foreach (Transform item in val.transform) { ((Component)item).gameObject.SetActive(false); } GameObject visual = CreateSafeEmberVisual(emberProjectile, val.transform, stickyShellPrefab); component.m_visual = visual; StickyEmberProjectileController.StickyExplosionPrefab = stickyExplosion; val.AddComponent<StickyEmberProjectileController>(); return val; } private static void CreateStickyEmberItem(GameObject oozeItem, GameObject proxyProjectile, GameObject stickyShellPrefab, Sprite stickyIcon) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0026: 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_0036: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) ItemConfig val = new ItemConfig { Name = "Sticky Ember Charge", Description = "Hot, sticky, and somebody else's problem now. Throw responsibly. Or don't.", CraftingStation = CraftingStations.Workbench, MinStationLevel = 1, Amount = 10 }; val.AddRequirement("BombDynamite", 10, 0); val.AddRequirement("Ooze", 1, 0); CustomItem val2 = new CustomItem("StickyEmberCharge", "BombDynamite", val); if ((Object)(object)stickyIcon != (Object)null) { val2.ItemDrop.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { stickyIcon }; } Transform val3 = FindChildRecursive(((Component)val2.ItemDrop).transform, "attach"); if ((Object)(object)val3 != (Object)null) { if ((Object)(object)stickyShellPrefab != (Object)null) { MeshFilter componentInChildren = ((Component)val3).GetComponentInChildren<MeshFilter>(true); Transform val4 = (((Object)(object)componentInChildren != (Object)null) ? ((Component)componentInChildren).transform : val3); GameObject obj = Object.Instantiate<GameObject>(stickyShellPrefab, val4, false); ((Object)obj).name = "SEC_HeldStickyShell"; obj.transform.localPosition = Vector3.zero; obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = Vector3.one; obj.SetActive(true); } val3.localScale *= 0.7f; } ItemDrop component = oozeItem.GetComponent<ItemDrop>(); if ((Object)(object)component == (Object)null) { throw new InvalidOperationException("BombOoze has no ItemDrop component."); } Attack val5 = ShallowClone<Attack>(component.m_itemData.m_shared.m_attack); val5.m_attackProjectile = proxyProjectile; val5.m_projectileAccuracy = 0f; val5.m_projectileAccuracyMin = 0f; val2.ItemDrop.m_itemData.m_shared.m_attack = val5; ItemManager.Instance.AddItem(val2); } private static GameObject CreateSafeEmberVisual(GameObject emberProjectile, Transform parent, GameObject stickyShellPrefab) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0038: 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_00c5: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SEC_EmberVisual"); val.transform.SetParent(parent, false); val.layer = emberProjectile.layer; foreach (Transform item in emberProjectile.transform) { Object.Instantiate<GameObject>(((Component)item).gameObject, val.transform, false); } TimedDestruction[] componentsInChildren = val.GetComponentsInChildren<TimedDestruction>(true); foreach (TimedDestruction obj in componentsInChildren) { ((MonoBehaviour)obj).CancelInvoke("DestroyNow"); obj.m_triggerOnAwake = false; ((Behaviour)obj).enabled = false; Object.DestroyImmediate((Object)(object)obj); } ParticleSystem[] componentsInChildren2 = val.GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val2 in componentsInChildren2) { MainModule main = val2.main; ((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)0; ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>(); if (IsFlightTrailParticle(val2)) { ((Component)val2).gameObject.SetActive(true); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = true; } EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = true; val2.Clear(true); val2.Play(true); } else { val2.Stop(true, (ParticleSystemStopBehavior)0); EmissionModule emission2 = val2.emission; ((EmissionModule)(ref emission2)).enabled = false; if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = false; } } } TrailRenderer[] componentsInChildren3 = val.GetComponentsInChildren<TrailRenderer>(true); foreach (TrailRenderer obj2 in componentsInChildren3) { ((Renderer)obj2).enabled = true; obj2.emitting = true; obj2.Clear(); } Light[] componentsInChildren4 = val.GetComponentsInChildren<Light>(true); for (int i = 0; i < componentsInChildren4.Length; i++) { ((Behaviour)componentsInChildren4[i]).enabled = false; } if ((Object)(object)stickyShellPrefab != (Object)null) { GameObject obj3 = Object.Instantiate<GameObject>(stickyShellPrefab, val.transform, false); ((Object)obj3).name = "SEC_StickyShell"; obj3.transform.localPosition = Vector3.zero; obj3.transform.localRotation = Quaternion.identity; obj3.transform.localScale = Vector3.one; obj3.SetActive(true); } return val; } internal static bool IsFlightTrailParticle(ParticleSystem ps) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 if ((Object)(object)ps == (Object)null) { return false; } TrailModule trails = ps.trails; if (((TrailModule)(ref trails)).enabled) { return true; } ParticleSystemRenderer component = ((Component)ps).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component == (Object)null) { return false; } if ((int)component.renderMode == 1) { return true; } string text = ((Object)((Component)ps).gameObject).name.ToLowerInvariant(); if (!text.Contains("trail")) { return text.Contains("streak"); } return true; } internal static bool IsFusePulseParticle(ParticleSystem ps) { //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ps == (Object)null || IsFlightTrailParticle(ps)) { return false; } string text = ((Object)((Component)ps).gameObject).name.ToLowerInvariant(); ParticleSystemRenderer component = ((Component)ps).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null && ((Renderer)component).sharedMaterials != null) { Material[] sharedMaterials = ((Renderer)component).sharedMaterials; foreach (Material val in sharedMaterials) { if ((Object)(object)val != (Object)null) { text = text + " " + ((Object)val).name.ToLowerInvariant(); } } } string[] array = new string[6] { "smoke", "dust", "fog", "cloud", "ash", "debris" }; foreach (string value in array) { if (text.Contains(value)) { return false; } } array = new string[7] { "fuse", "flash", "glow", "pulse", "spark", "ember", "fire" }; foreach (string value2 in array) { if (text.Contains(value2)) { return true; } } MainModule main = ps.main; MinMaxCurve startSpeed = ((MainModule)(ref main)).startSpeed; float num = Mathf.Abs(((MinMaxCurve)(ref startSpeed)).constantMin); startSpeed = ((MainModule)(ref main)).startSpeed; return Mathf.Max(num, Mathf.Abs(((MinMaxCurve)(ref startSpeed)).constantMax)) <= 0.5f; } private static Transform FindChildRecursive(Transform root, string childName) { if ((Object)(object)root == (Object)null) { return null; } for (int i = 0; i < root.childCount; i++) { Transform child = root.GetChild(i); if (string.Equals(((Object)child).name, childName, StringComparison.OrdinalIgnoreCase)) { return child; } Transform val = FindChildRecursive(child, childName); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static GameObject RequirePrefab(string name) { GameObject prefab = PrefabManager.Instance.GetPrefab(name); if ((Object)(object)prefab == (Object)null) { throw new InvalidOperationException("Could not find vanilla prefab '" + name + "'."); } return prefab; } private static T ShallowClone<T>(T source) where T : class { if (source == null) { throw new ArgumentNullException("source"); } MethodInfo? method = typeof(object).GetMethod("MemberwiseClone", BindingFlags.Instance | BindingFlags.NonPublic); if (method == null) { throw new InvalidOperationException("Could not access MemberwiseClone."); } return (T)method.Invoke(source, null); } } public sealed class StickyEmberProjectileController : MonoBehaviour { internal static GameObject StickyExplosionPrefab; private const float DetachedSafetyTtl = 60f; private static readonly FieldInfo DidHitField = typeof(Projectile).GetField("m_didHit", BindingFlags.Instance | BindingFlags.NonPublic); private static readonly FieldInfo VelocityField = typeof(Projectile).GetField("m_vel", BindingFlags.Instance | BindingFlags.NonPublic); private Projectile _projectile; private ZNetView _nview; private bool _armed; private bool _visualStarted; private GameObject _supportObject; private bool _watchSupport; private bool _detachedFuseMode; private bool _detonationQueued; private float _detachedFuseRemaining; private float _flightRotateX; private float _flightRotateY; private float _flightRotateZ; private void Awake() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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 _projectile = ((Component)this).GetComponent<Projectile>(); _nview = ((Component)this).GetComponent<ZNetView>(); if ((Object)(object)_projectile != (Object)null) { _flightRotateX = _projectile.m_rotateVisual; _flightRotateY = _projectile.m_rotateVisualY; _flightRotateZ = _projectile.m_rotateVisualZ; Projectile projectile = _projectile; projectile.m_onHit = (OnProjectileHit)Delegate.Combine((Delegate?)(object)projectile.m_onHit, (Delegate?)new OnProjectileHit(OnProjectileHit)); } } private void OnDestroy() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown if ((Object)(object)_projectile != (Object)null) { Projectile projectile = _projectile; projectile.m_onHit = (OnProjectileHit)Delegate.Remove((Delegate?)(object)projectile.m_onHit, (Delegate?)new OnProjectileHit(OnProjectileHit)); } } private void OnProjectileHit(Collider collider, Vector3 hitPoint, bool water) { if ((Object)(object)_projectile == (Object)null) { return; } RememberSupport(collider); _projectile.m_rotateVisual = 0f; _projectile.m_rotateVisualY = 0f; _projectile.m_rotateVisualZ = 0f; if (_armed) { if (_detachedFuseMode) { _projectile.m_stayTTL = 60f; } } else if (!((Object)(object)StickyExplosionPrefab == (Object)null)) { _armed = true; _projectile.m_spawnOnHit = StickyExplosionPrefab; _projectile.m_spawnOnTtl = true; _projectile.m_spawnOnHitChance = 1f; _projectile.m_spawnCount = 1; } } private void Update() { if ((Object)(object)_projectile == (Object)null || (Object)(object)_nview == (Object)null || !_nview.IsValid() || !_nview.IsOwner()) { return; } if (_armed && _watchSupport && !Object.op_Implicit((Object)(object)_supportObject) && !_detonationQueued) { ReleaseFromDestroyedSupport(); } if (_detachedFuseMode && !_detonationQueued) { _detachedFuseRemaining -= Time.deltaTime; if (!(_detachedFuseRemaining > 0f)) { _detonationQueued = true; _projectile.m_spawnOnHit = StickyExplosionPrefab; _projectile.m_spawnOnTtl = true; _projectile.m_spawnOnHitChance = 1f; _projectile.m_spawnCount = 1; _projectile.m_ttl = 0.001f; } } } private void RememberSupport(Collider collider) { _supportObject = null; _watchSupport = false; if (!((Object)(object)collider == (Object)null)) { ZNetView componentInParent = ((Component)collider).gameObject.GetComponentInParent<ZNetView>(); if ((Object)(object)componentInParent != (Object)null) { _supportObject = ((Component)componentInParent).gameObject; _watchSupport = true; } else { _supportObject = ((Component)collider).gameObject; _watchSupport = true; } } } private void ReleaseFromDestroyedSupport() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (DidHitField == null || VelocityField == null) { Debug.LogError((object)"[Sticky Ember Charge] Could not access Projectile m_didHit/m_vel; destroyed-support falling is unavailable."); _watchSupport = false; return; } if (!_detachedFuseMode) { _detachedFuseMode = true; _detachedFuseRemaining = Mathf.Max(0.01f, _projectile.m_ttl); } _watchSupport = false; _supportObject = null; _projectile.m_spawnOnHit = null; _projectile.m_spawnOnTtl = false; _projectile.m_stayTTL = 60f; _projectile.m_ttl = 60f; DidHitField.SetValue(_projectile, false); VelocityField.SetValue(_projectile, Vector3.zero); _projectile.m_rotateVisual = _flightRotateX; _projectile.m_rotateVisualY = _flightRotateY; _projectile.m_rotateVisualZ = _flightRotateZ; } internal void OnNetworkHit() { if ((Object)(object)_projectile != (Object)null) { _projectile.m_rotateVisual = 0f; _projectile.m_rotateVisualY = 0f; _projectile.m_rotateVisualZ = 0f; } StartFuseVisual(); } private void StartFuseVisual() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) if (_visualStarted) { return; } _visualStarted = true; Transform val = ((Component)this).transform.Find("SEC_EmberVisual"); if ((Object)(object)val == (Object)null) { return; } ParticleSystem[] componentsInChildren = ((Component)val).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val2 in componentsInChildren) { if (StickyEmberChargePlugin.IsFlightTrailParticle(val2)) { EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = false; val2.Stop(true, (ParticleSystemStopBehavior)1); } else if (StickyEmberChargePlugin.IsFusePulseParticle(val2)) { ((Component)val2).gameObject.SetActive(true); MainModule main = val2.main; ((MainModule)(ref main)).stopAction = (ParticleSystemStopAction)0; ParticleSystemRenderer component = ((Component)val2).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).enabled = true; } EmissionModule emission2 = val2.emission; ((EmissionModule)(ref emission2)).enabled = true; val2.Clear(true); val2.Play(true); } } TrailRenderer[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<TrailRenderer>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].emitting = false; } Light[] componentsInChildren3 = ((Component)val).GetComponentsInChildren<Light>(true); foreach (Light obj in componentsInChildren3) { ((Component)obj).gameObject.SetActive(true); ((Behaviour)obj).enabled = true; } TimedDestruction[] componentsInChildren4 = ((Component)val).GetComponentsInChildren<TimedDestruction>(true); foreach (TimedDestruction obj2 in componentsInChildren4) { ((MonoBehaviour)obj2).CancelInvoke("DestroyNow"); obj2.m_triggerOnAwake = false; ((Behaviour)obj2).enabled = false; } } } [HarmonyPatch(typeof(Projectile), "RPC_OnHit")] internal static class ProjectileRpcOnHitPatch { private static void Postfix(Projectile __instance) { StickyEmberProjectileController component = ((Component)__instance).GetComponent<StickyEmberProjectileController>(); if ((Object)(object)component != (Object)null) { component.OnNetworkHit(); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }