Decompiled source of HuntSmallDynamiteBundle v1.0.0
HuntSmallDynamiteBundle.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using OtherLoader; using UnityEngine; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace BitWizrd.HuntSmallDynamiteBundle { [BepInPlugin("BitWizrd.HuntSmallDynamiteBundle", "HuntSmallDynamiteBundle", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class HuntSmallDynamiteBundlePlugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; LoadAssets(); } private void LoadAssets() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "BitWizrd.HuntSmallDynamiteBundle"); OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntSmallDynamiteBundle", "", "smalldynamitebundle", "", ""); } } } public class AudioStopWhenDone : MonoBehaviour { public AudioSource Src; public float Delay; public float Duration = 1f; private void Awake() { if ((Object)(object)Src == (Object)null) { Src = ((Component)this).GetComponent<AudioSource>(); } } private void OnEnable() { ((MonoBehaviour)this).CancelInvoke(); if ((Object)(object)Src != (Object)null && Src.loop && !Src.isPlaying) { Src.Play(); } if (Duration > 0f) { ((MonoBehaviour)this).Invoke("StopLoop", Mathf.Max(0f, Delay) + Duration); } } private void OnDisable() { ((MonoBehaviour)this).CancelInvoke(); } private void StopLoop() { if ((Object)(object)Src != (Object)null && Src.loop) { Src.Stop(); } ((Behaviour)this).enabled = false; } } public class AutoDestructWhenDone : MonoBehaviour { [Tooltip("Seconds between checks.")] public float PollInterval = 0.5f; [Tooltip("Seconds after enabling before the first check, so a delayed start is not mistaken for finished.")] public float StartGrace = 1f; private ParticleSystem[] m_systems; private AudioSource[] m_sources; private float m_nextPoll; private void OnEnable() { m_nextPoll = Time.time + Mathf.Max(StartGrace, PollInterval); } private void Update() { if (!Application.isPlaying || Time.time < m_nextPoll) { return; } m_nextPoll = Time.time + PollInterval; if (m_systems == null) { m_systems = ((Component)this).GetComponentsInChildren<ParticleSystem>(true); m_sources = ((Component)this).GetComponentsInChildren<AudioSource>(true); } for (int i = 0; i < m_systems.Length; i++) { ParticleSystem val = m_systems[i]; if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeInHierarchy && val.IsAlive(false)) { return; } } for (int j = 0; j < m_sources.Length; j++) { AudioSource val2 = m_sources[j]; if ((Object)(object)val2 != (Object)null && ((Component)val2).gameObject.activeInHierarchy && val2.isPlaying) { return; } } Object.Destroy((Object)(object)((Component)this).gameObject); } } public class BloodBondSR : MonoBehaviour { private void Awake() { string name = "Ammo_69_CashMoney_D100(Clone)"; ((Object)((Component)this).gameObject).name = name; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Object)((Component)componentsInChildren[i]).gameObject).name = name; } } } public class ComponentActivateRandomRuntime : MonoBehaviour { public float Probability; public int Group; public float SelectionStart; [NonSerialized] private bool rollResolved; [NonSerialized] private float sharedRoll; private void Awake() { if (Probability >= 1f) { return; } bool flag; if (Group != 0) { if (!rollResolved) { ResolveGroupRollsForRoot(); } flag = sharedRoll >= SelectionStart && sharedRoll <= SelectionStart + Probability; } else { flag = Random.value <= Probability; } if (!flag) { ((Component)this).gameObject.SetActive(false); } } private void ResolveGroupRollsForRoot() { ComponentActivateRandomRuntime[] componentsInChildren = ((Component)((Component)this).transform.root).GetComponentsInChildren<ComponentActivateRandomRuntime>(true); Dictionary<int, float> dictionary = new Dictionary<int, float>(); foreach (ComponentActivateRandomRuntime componentActivateRandomRuntime in componentsInChildren) { if (componentActivateRandomRuntime.Group != 0 && !componentActivateRandomRuntime.rollResolved) { if (!dictionary.TryGetValue(componentActivateRandomRuntime.Group, out var value)) { value = Random.value; dictionary[componentActivateRandomRuntime.Group] = value; } componentActivateRandomRuntime.sharedRoll = value; componentActivateRandomRuntime.rollResolved = true; } } } } public class CooldownSound : MonoBehaviour { public ClosedBoltWeapon weapon; public AudioClip[] audioClips; public float volume = 1f; public int minShots = 5; public int maxShots = 10; public float minDelay = 0.5f; public float maxDelay = 2f; public float resetTime = 1.5f; private AudioSource audioSource; private int shotCounter = 0; private float lastShotTime; private bool lastRoundSpent; private int nextShotThreshold; private bool isPlayingSound = false; private void Start() { if ((Object)(object)weapon == (Object)null) { weapon = ((Component)this).GetComponent<ClosedBoltWeapon>(); } if ((Object)(object)weapon == (Object)null) { Debug.LogError((object)"CooldownSound: Weapon reference is missing. Attach this script to a ClosedBoltWeapon."); return; } audioSource = ((Component)weapon).gameObject.GetComponent<AudioSource>(); if ((Object)(object)audioSource == (Object)null) { audioSource = ((Component)weapon).gameObject.AddComponent<AudioSource>(); } audioSource.spatialBlend = 1f; audioSource.playOnAwake = false; audioSource.rolloffMode = (AudioRolloffMode)0; lastRoundSpent = weapon.Chamber.IsSpent; SetNewShotThreshold(); } private void Update() { DetectFiring(); } private void DetectFiring() { if (weapon.Chamber.IsFull && weapon.Chamber.IsSpent && !lastRoundSpent) { OnWeaponFired(); } lastRoundSpent = weapon.Chamber.IsSpent; } private void OnWeaponFired() { float num = Time.time - lastShotTime; if (num > resetTime) { shotCounter = 0; SetNewShotThreshold(); } shotCounter++; lastShotTime = Time.time; if (shotCounter >= nextShotThreshold) { ((MonoBehaviour)this).StartCoroutine(PlaySoundWithDelay()); shotCounter = 0; SetNewShotThreshold(); } } private IEnumerator PlaySoundWithDelay() { if (!isPlayingSound) { isPlayingSound = true; float delay = Random.Range(minDelay, maxDelay); yield return (object)new WaitForSeconds(delay); if (audioClips.Length > 0) { int index = Random.Range(0, audioClips.Length); audioSource.clip = audioClips[index]; audioSource.PlayOneShot(audioSource.clip, volume); yield return (object)new WaitForSeconds(audioSource.clip.length); } isPlayingSound = false; } } private void SetNewShotThreshold() { nextShotThreshold = Random.Range(minShots, maxShots + 1); } } [ExecuteInEditMode] public class CryErosionDriver : MonoBehaviour { private static readonly int ErosionValueId = Shader.PropertyToID("_ErosionValue"); [Range(0f, 1f)] public float Burn = 0f; public Renderer[] Renderers; public bool HideWhenGone = true; private MaterialPropertyBlock _block; private float _burnRate; private float _lastApplied = -1f; public void BurnOver(float seconds) { _burnRate = ((!(seconds > 0.0001f)) ? 0f : ((1f - Burn) / seconds)); if (_burnRate <= 0f) { Burn = 1f; } } public void Restore() { _burnRate = 0f; Burn = 0f; Apply(force: true); } private void LateUpdate() { if (_burnRate > 0f && Application.isPlaying) { Burn = Mathf.Min(1f, Burn + _burnRate * Time.deltaTime); if (Burn >= 1f) { _burnRate = 0f; } } Apply(force: false); } private void OnValidate() { Apply(force: true); } private void Apply(bool force) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown float num = Mathf.Clamp01(Burn); if (!force && Mathf.Approximately(num, _lastApplied)) { return; } _lastApplied = num; if (Renderers == null || Renderers.Length == 0) { Renderers = ((Component)this).GetComponentsInChildren<Renderer>(true); } if (_block == null) { _block = new MaterialPropertyBlock(); } bool flag = HideWhenGone && num >= 1f; for (int i = 0; i < Renderers.Length; i++) { Renderer val = Renderers[i]; if (!((Object)(object)val == (Object)null)) { val.GetPropertyBlock(_block); _block.SetFloat(ErosionValueId, 1f - num); val.SetPropertyBlock(_block); if (HideWhenGone) { val.enabled = !flag; } } } } } [ExecuteInEditMode] public class CryRibbon : MonoBehaviour { private class ParentSlot { public uint Seed; public Vector3 Pos; public Vector3 Vel; public float Age01 = 1f; public bool Dead; } private struct SeedInfo { public int Slot; public float Fraction; } private sealed class AgeComparer : IComparer<int> { private readonly Particle[] m_buf; public AgeComparer(Particle[] buf) { m_buf = buf; } public int Compare(int a, int b) { float num = ((Particle)(ref m_buf[a])).startLifetime - ((Particle)(ref m_buf[a])).remainingLifetime; float num2 = ((Particle)(ref m_buf[b])).startLifetime - ((Particle)(ref m_buf[b])).remainingLifetime; if (num > num2) { return -1; } if (num < num2) { return 1; } return 0; } } public ParticleSystem OwnPs; public ParticleSystem ParentSystem; public Transform EffectRoot; public Material RibbonMaterial; public float SizeConstant = 1f; public AnimationCurve SizeOverLife = new AnimationCurve(); public AnimationCurve SizeBySpawnFraction = new AnimationCurve(); public float OpacityConstant = 1f; public AnimationCurve OpacityOverLife = new AnimationCurve(); public AnimationCurve OpacityBySpawnFraction = new AnimationCurve(); public Gradient ColorOverLife = new Gradient(); public bool StreamFromAge; public float TextureFrequency = 1f; public bool FlipU; public bool FlipV; public bool ConnectToParent; public bool SampleParentAlpha; public AnimationCurve ParentOpacityOverLife = null; public AnimationCurve FacingOpacity = null; public int PerParentTotal = 1; public float SpawnDelay; public float SpawnDuration; public bool RateMode; public float SpawnRate; public float CountMin = 1f; public float CountMax = 1f; public float RestartPeriod; public float LifetimeMin = 1f; public float LifetimeMax = 1f; public int VelocityMode; public Vector3 AxisLocal = Vector3.up; public float ConeAngle; public float SpeedMin; public float SpeedMax; public AnimationCurve SpeedBySpawnFraction = new AnimationCurve(); public float Drag; public float GravityScale; public bool LifetimePerInstance; public AnimationCurve DragParentAge = null; public AnimationCurve DragSpawnFraction = null; private readonly List<ParentSlot> m_parents = new List<ParentSlot>(); private readonly Dictionary<uint, int> m_parentIndex = new Dictionary<uint, int>(); private readonly Dictionary<uint, SeedInfo> m_vertSlot = new Dictionary<uint, SeedInfo>(); private readonly Dictionary<uint, int> m_seedFirstFrame = new Dictionary<uint, int>(); private readonly List<uint> m_prune = new List<uint>(); private readonly Dictionary<int, int> m_slotBirthCount = new Dictionary<int, int>(); private Particle[] m_ownBuf = (Particle[])(object)new Particle[0]; private Particle[] m_parentBuf = (Particle[])(object)new Particle[0]; private readonly HashSet<uint> m_liveSeeds = new HashSet<uint>(); private Mesh m_mesh; private readonly List<Vector3> m_verts = new List<Vector3>(); private readonly List<Vector2> m_uvs = new List<Vector2>(); private readonly List<Color32> m_cols = new List<Color32>(); private readonly List<Vector3> m_norms = new List<Vector3>(); private readonly List<Vector4> m_tans = new List<Vector4>(); private readonly List<int> m_tris = new List<int>(); private readonly Vector3[] m_posBuf = (Vector3[])(object)new Vector3[256]; private readonly float[] m_fracBuf = new float[256]; private readonly float[] m_ageBuf = new float[256]; public static readonly List<CryRibbon> EditInstances = new List<CryRibbon>(); private int m_lastFrame = -1; private static Camera s_viewerCamera; public bool IsBusy { get { if (!((Behaviour)this).isActiveAndEnabled) { return false; } if ((Object)(object)OwnPs == (Object)null) { OwnPs = ((Component)this).GetComponent<ParticleSystem>(); } if ((Object)(object)OwnPs != (Object)null && OwnPs.particleCount > 0) { return true; } if ((Object)(object)ParentSystem != (Object)null && ParentSystem.IsAlive(true)) { return true; } return false; } } public int InstanceCount => m_parents.Count; public int TrackCount => m_parents.Count; private void OnEnable() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown if (!Application.isPlaying && !EditInstances.Contains(this)) { EditInstances.Add(this); } m_parents.Clear(); m_parentIndex.Clear(); m_vertSlot.Clear(); m_seedFirstFrame.Clear(); m_slotBirthCount.Clear(); if ((Object)(object)OwnPs == (Object)null) { OwnPs = ((Component)this).GetComponent<ParticleSystem>(); } if ((Object)(object)m_mesh == (Object)null) { m_mesh = new Mesh(); ((Object)m_mesh).hideFlags = (HideFlags)61; ((Object)m_mesh).name = "CryRibbon"; m_mesh.MarkDynamic(); } } private void OnDisable() { EditInstances.Remove(this); } public void EditorTick() { if (!Application.isPlaying && !((Object)(object)this == (Object)null)) { LateUpdate(); } } private void OnDestroy() { if (!((Object)(object)m_mesh == (Object)null)) { if (Application.isPlaying) { Object.Destroy((Object)(object)m_mesh); } else { Object.DestroyImmediate((Object)(object)m_mesh); } } } private void LateUpdate() { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)RibbonMaterial == (Object)null) { return; } int frame = CryEditClock.Frame; if (m_lastFrame == frame) { return; } m_lastFrame = frame; if ((Object)(object)OwnPs == (Object)null) { OwnPs = ((Component)this).GetComponent<ParticleSystem>(); } if (!((Object)(object)OwnPs == (Object)null)) { UpdateParents(); Camera val = ResolveViewerCamera(); if (!((Object)(object)val == (Object)null)) { BuildAndDraw(((Component)val).transform.position); } } } private void UpdateParents() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ParentSystem == (Object)null) { return; } MainModule main = ParentSystem.main; int maxParticles = ((MainModule)(ref main)).maxParticles; if (m_parentBuf.Length < maxParticles) { m_parentBuf = (Particle[])(object)new Particle[maxParticles]; } int particles = ParentSystem.GetParticles(m_parentBuf); bool[] array = new bool[m_parents.Count]; for (int i = 0; i < particles; i++) { uint randomSeed = ((Particle)(ref m_parentBuf[i])).randomSeed; if (!m_parentIndex.TryGetValue(randomSeed, out var value)) { ParentSlot parentSlot = new ParentSlot(); parentSlot.Seed = randomSeed; value = m_parents.Count; m_parents.Add(parentSlot); m_parentIndex[randomSeed] = value; } ParentSlot parentSlot2 = m_parents[value]; parentSlot2.Pos = ToWorldPoint(ParentSystem, ((Particle)(ref m_parentBuf[i])).position); parentSlot2.Vel = ToWorldVector(ParentSystem, ((Particle)(ref m_parentBuf[i])).velocity); float startLifetime = ((Particle)(ref m_parentBuf[i])).startLifetime; float num = startLifetime - ((Particle)(ref m_parentBuf[i])).remainingLifetime; parentSlot2.Age01 = ((!(startLifetime > 1E-06f)) ? 1f : Mathf.Clamp01(num / startLifetime)); parentSlot2.Dead = false; if (value < array.Length) { array[value] = true; } } for (int j = 0; j < m_parents.Count; j++) { if (j >= array.Length || !array[j]) { m_parents[j].Dead = true; } } } private float ParentAge01(int slot) { if (slot < 0 || slot >= m_parents.Count) { return 1f; } return m_parents[slot].Age01; } private void BuildAndDraw(Vector3 camPos) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) m_verts.Clear(); m_uvs.Clear(); m_cols.Clear(); m_norms.Clear(); m_tans.Clear(); m_tris.Clear(); MainModule main = OwnPs.main; int maxParticles = ((MainModule)(ref main)).maxParticles; if (m_ownBuf.Length < maxParticles) { m_ownBuf = (Particle[])(object)new Particle[maxParticles]; } int particles = OwnPs.GetParticles(m_ownBuf); bool flag = m_parents.Count > 0; int frame = CryEditClock.Frame; for (int i = 0; i < particles; i++) { uint randomSeed = ((Particle)(ref m_ownBuf[i])).randomSeed; if (m_vertSlot.ContainsKey(randomSeed)) { continue; } if (!m_seedFirstFrame.ContainsKey(randomSeed)) { m_seedFirstFrame[randomSeed] = frame; } Vector3 val = ToWorldVector(OwnPs, ((Particle)(ref m_ownBuf[i])).velocity); bool flag2 = ((Vector3)(ref val)).sqrMagnitude > 1E-08f; bool flag3 = frame - m_seedFirstFrame[randomSeed] >= 3; if (!flag2 && !flag3 && flag) { continue; } SeedInfo value = new SeedInfo { Slot = 0, Fraction = 0f }; if (flag) { int slot = 0; Vector3 val2 = ToWorldPoint(OwnPs, ((Particle)(ref m_ownBuf[i])).position); float num = float.MaxValue; float num2 = float.MaxValue; for (int j = 0; j < m_parents.Count; j++) { if (!m_parents[j].Dead) { Vector3 val3 = val2 - m_parents[j].Pos; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num2 = num; num = sqrMagnitude; slot = j; } else if (sqrMagnitude < num2) { num2 = sqrMagnitude; } } } bool flag4 = num2 > 1E-12f && num <= num2 * 0.25f; if (!flag4 && flag2) { float num3 = -2f; Vector3 normalized = ((Vector3)(ref val)).normalized; for (int k = 0; k < m_parents.Count; k++) { if (m_parents[k].Dead) { continue; } Vector3 vel = m_parents[k].Vel; if (!(((Vector3)(ref vel)).sqrMagnitude < 1E-08f)) { float num4 = Vector3.Dot(normalized, ((Vector3)(ref vel)).normalized); if (num4 > num3) { num3 = num4; slot = k; } } } flag4 = true; } if (!flag4) { continue; } value.Slot = slot; } int value2 = 0; m_slotBirthCount.TryGetValue(value.Slot, out value2); int num5 = Mathf.Max(2, PerParentTotal); value.Fraction = Mathf.Clamp01((float)value2 / (float)(num5 - 1)); m_slotBirthCount[value.Slot] = value2 + 1; m_vertSlot[randomSeed] = value; } m_liveSeeds.Clear(); for (int l = 0; l < particles; l++) { m_liveSeeds.Add(((Particle)(ref m_ownBuf[l])).randomSeed); } m_prune.Clear(); foreach (KeyValuePair<uint, SeedInfo> item in m_vertSlot) { if (!m_liveSeeds.Contains(item.Key)) { m_prune.Add(item.Key); } } for (int m = 0; m < m_prune.Count; m++) { m_vertSlot.Remove(m_prune[m]); m_seedFirstFrame.Remove(m_prune[m]); } Dictionary<int, List<int>> dictionary = new Dictionary<int, List<int>>(); for (int n = 0; n < particles; n++) { if (m_vertSlot.TryGetValue(((Particle)(ref m_ownBuf[n])).randomSeed, out var value3)) { if (!dictionary.TryGetValue(value3.Slot, out var value4)) { value4 = new List<int>(); dictionary[value3.Slot] = value4; } value4.Add(n); } } foreach (KeyValuePair<int, List<int>> item2 in dictionary) { List<int> value5 = item2.Value; value5.Sort(new AgeComparer(m_ownBuf)); BuildStrip(value5, item2.Key, camPos); if (m_verts.Count >= 500) { break; } } m_mesh.Clear(); if (m_verts.Count >= 4) { m_mesh.SetVertices(m_verts); m_mesh.SetUVs(0, m_uvs); m_mesh.SetColors(m_cols); m_mesh.SetNormals(m_norms); m_mesh.SetTangents(m_tans); m_mesh.SetTriangles(m_tris, 0); m_mesh.RecalculateBounds(); Graphics.DrawMesh(m_mesh, Matrix4x4.identity, RibbonMaterial, ((Component)this).gameObject.layer, (Camera)null, 0, (MaterialPropertyBlock)null, false, false); } } private void BuildStrip(List<int> order, int slot, Vector3 camPos) { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05cd: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_05e8: Unknown result type (might be due to invalid IL or missing references) //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_069a: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06f0: Unknown result type (might be due to invalid IL or missing references) //IL_06fd: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_049b: Unknown result type (might be due to invalid IL or missing references) //IL_04a0: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) int num = order.Count; bool flag = ConnectToParent && (Object)(object)ParentSystem != (Object)null && slot >= 0 && slot < m_parents.Count && !m_parents[slot].Dead; if (num + (flag ? 1 : 0) < 2) { return; } if (num > m_posBuf.Length) { num = m_posBuf.Length; } int count = m_verts.Count; for (int i = 0; i < num; i++) { int num2 = order[i]; ref Vector3 reference = ref m_posBuf[i]; reference = ToWorldPoint(OwnPs, ((Particle)(ref m_ownBuf[num2])).position); float num3 = 0f; if (m_vertSlot.TryGetValue(((Particle)(ref m_ownBuf[num2])).randomSeed, out var value)) { num3 = value.Fraction; } m_fracBuf[i] = num3; float startLifetime = ((Particle)(ref m_ownBuf[num2])).startLifetime; float num4 = startLifetime - ((Particle)(ref m_ownBuf[num2])).remainingLifetime; m_ageBuf[i] = ((!(startLifetime > 1E-06f)) ? 1f : Mathf.Clamp01(num4 / startLifetime)); } bool flag2 = FacingOpacity != null && FacingOpacity.length > 0; Vector3 val = Vector3.right; float num5 = 0f; Color32 item = default(Color32); ((Color32)(ref item))..ctor(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)0); float num6 = 0f; Vector3 val2 = Vector3.forward; Vector4 item2 = default(Vector4); for (int j = 0; j < num; j++) { float num7 = m_ageBuf[j]; Vector3 val3 = m_posBuf[Mathf.Min(j + 1, num - 1)] - m_posBuf[Mathf.Max(j - 1, 0)]; Vector3 val4 = m_posBuf[j] - camPos; Vector3 val5 = Vector3.Cross(val3, val4); if (((Vector3)(ref val5)).sqrMagnitude < 1E-12f) { val5 = val; } else { ((Vector3)(ref val5)).Normalize(); } val = val5; float num8 = ((SizeOverLife == null || SizeOverLife.length <= 0) ? SizeConstant : SizeOverLife.Evaluate(num7)); if (SizeBySpawnFraction != null && SizeBySpawnFraction.length > 0) { num8 *= SizeBySpawnFraction.Evaluate(m_fracBuf[j]); } float num9 = Mathf.Max(num8, 0f); float num10 = ((OpacityOverLife == null || OpacityOverLife.length <= 0) ? OpacityConstant : OpacityOverLife.Evaluate(num7)); if (OpacityBySpawnFraction != null && OpacityBySpawnFraction.length > 0) { num10 *= OpacityBySpawnFraction.Evaluate(m_fracBuf[j]); } if (SampleParentAlpha) { num10 *= EvaluateParentAlpha(ParentAge01(slot)); } if (flag2) { float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude > 1E-06f) { num10 *= FacingOpacity.Evaluate(Mathf.Clamp01(Mathf.Abs(Vector3.Dot(val3 / magnitude, ((Vector3)(ref val4)).normalized)))); } } Color val6 = ((ColorOverLife == null) ? Color.white : ColorOverLife.Evaluate(num7)); num10 *= 1f - Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num7 - 0.85f) / 0.15f)); val6.a = Mathf.Clamp01(num10); Color32 val7 = Color32.op_Implicit(val6); float num11 = 1f - ((!StreamFromAge) ? m_fracBuf[j] : num7) * TextureFrequency; num11 -= Mathf.Floor(num11); if (FlipV) { num11 = 1f - num11; } float num12 = ((!FlipU) ? 0f : 1f); float num13 = ((!FlipU) ? 1f : 0f); Vector3 val8 = -((Vector3)(ref val4)).normalized; ((Vector4)(ref item2))..ctor(val5.x, val5.y, val5.z, -1f); m_verts.Add(m_posBuf[j] - val5 * num9); m_uvs.Add(new Vector2(num12, num11)); m_cols.Add(val7); m_norms.Add(val8); m_tans.Add(item2); m_verts.Add(m_posBuf[j] + val5 * num9); m_uvs.Add(new Vector2(num13, num11)); m_cols.Add(val7); m_norms.Add(val8); m_tans.Add(item2); num5 = num9; item = val7; num6 = num11; val2 = val8; } int num14 = num - 1; if (flag) { Vector3 pos = m_parents[slot].Pos; Vector3 item3 = pos - camPos; item3 = ((!(((Vector3)(ref item3)).sqrMagnitude < 1E-12f)) ? (-((Vector3)(ref item3)).normalized) : val2); Vector4 item4 = default(Vector4); ((Vector4)(ref item4))..ctor(val.x, val.y, val.z, -1f); float num15 = ((!FlipU) ? 0f : 1f); float num16 = ((!FlipU) ? 1f : 0f); m_verts.Add(pos - val * num5); m_uvs.Add(new Vector2(num15, num6)); m_cols.Add(item); m_norms.Add(item3); m_tans.Add(item4); m_verts.Add(pos + val * num5); m_uvs.Add(new Vector2(num16, num6)); m_cols.Add(item); m_norms.Add(item3); m_tans.Add(item4); num14 = num; } for (int k = 0; k < num14; k++) { int num17 = count + k * 2; m_tris.Add(num17); m_tris.Add(num17 + 2); m_tris.Add(num17 + 1); m_tris.Add(num17 + 1); m_tris.Add(num17 + 2); m_tris.Add(num17 + 3); m_tris.Add(num17); m_tris.Add(num17 + 1); m_tris.Add(num17 + 2); m_tris.Add(num17 + 1); m_tris.Add(num17 + 3); m_tris.Add(num17 + 2); } } private float EvaluateParentAlpha(float parentAge01) { if (ParentOpacityOverLife == null || ParentOpacityOverLife.length == 0) { return 1f; } return Mathf.Clamp01(ParentOpacityOverLife.Evaluate(Mathf.Clamp01(parentAge01))); } private static Vector3 ToWorldPoint(ParticleSystem ps, Vector3 p) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_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) MainModule main = ps.main; return ((int)((MainModule)(ref main)).simulationSpace != 1) ? ((Component)ps).transform.TransformPoint(p) : p; } private static Vector3 ToWorldVector(ParticleSystem ps, Vector3 v) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_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) MainModule main = ps.main; return ((int)((MainModule)(ref main)).simulationSpace != 1) ? ((Component)ps).transform.TransformVector(v) : v; } private static Camera ResolveViewerCamera() { if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.main; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } s_viewerCamera = Camera.current; if ((Object)(object)s_viewerCamera != (Object)null && ((Behaviour)s_viewerCamera).isActiveAndEnabled) { return s_viewerCamera; } Camera[] allCameras = Camera.allCameras; s_viewerCamera = ((allCameras == null || allCameras.Length <= 0) ? null : allCameras[0]); return s_viewerCamera; } } public class CustomWaggleJoint : MonoBehaviour { public float distanceLimit = 0.25f; public float angleLimitLeft = 45f; public float angleLimitRight = 45f; public float gravityScale = 1f; public bool useSpring; public float springApproachRate = 0.95f; public float damping; public Transform hingeGraphic; public Vector3 hingeGraphicRotationOffset; public bool invertWaggleAxis; public bool ManualExecution; public float onHitLimitCooldown = 0.05f; public Vector3 waggleAxis = Vector3.up; public Vector3 rotationAxis = Vector3.up; [Header("Gizmo Options")] public bool debugGizmos = false; public bool showRotationExtremes = false; public bool showRotationDirectionArrows = false; private Vector3 particlePos; private Vector3 particleVel; private bool leftCatchState; private bool rightCatchState; private float lastTouchTime = float.MinValue; private Vector3 EffectiveWaggleDir() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //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_0028: 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_0033: Unknown result type (might be due to invalid IL or missing references) return ((Component)this).transform.TransformDirection((!invertWaggleAxis) ? waggleAxis : (-waggleAxis)); } private void GetEffectiveAngleLimits(out float effectiveAngleMin, out float effectiveAngleMax) { if (invertWaggleAxis) { effectiveAngleMin = 0f - angleLimitLeft; effectiveAngleMax = angleLimitRight; } else { effectiveAngleMin = 0f - angleLimitRight; effectiveAngleMax = angleLimitLeft; } } public void ResetParticlePos() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) //IL_002e: Unknown result type (might be due to invalid IL or missing references) particlePos = ((Component)this).transform.position + EffectiveWaggleDir() * distanceLimit; particleVel = Vector3.zero; } private void OnHitLimit(float angularVelocity) { } public void Execute() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0025: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0051: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007d: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) float deltaTime = Time.deltaTime; Transform transform = ((Component)this).transform; Vector3 val = Physics.gravity * gravityScale; Vector3 val2 = particlePos; Vector3 val3 = particleVel * Mathf.Pow(1f - damping, deltaTime) + val * deltaTime; Vector3 val4 = val2 + val3 * deltaTime; Vector3 val5 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized); Vector3 val6 = EffectiveWaggleDir(); Vector3 position = transform.position; if (useSpring) { val4 = Vector3.Lerp(val4, position + val6 * distanceLimit, 1f - Mathf.Pow(1f - springApproachRate, deltaTime)); } GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax); particlePos = ProjectOnHinge(val4, position, val5, val6, distanceLimit, effectiveAngleMin, effectiveAngleMax); particleVel = (particlePos - val2) / deltaTime; if ((Object)(object)hingeGraphic != (Object)null) { hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val5) * Quaternion.Euler(hingeGraphicRotationOffset); } } private Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0019: Unknown result type (might be due to invalid IL or missing references) //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: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_0030: 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_003b: Unknown result type (might be due to invalid IL or missing references) float num = ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection); num = Mathf.Clamp(num, angleMin, angleMax); Vector3 val = Quaternion.AngleAxis(num, hingeAxis) * hingeDirection; return val * distanceLimit + hingePivot; } private float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = point - hingePivot; Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxis); Vector3 normalized = ((Vector3)(ref val2)).normalized; return SignedAngle(hingeDirection, normalized, hingeAxis); } private float SignedAngle(Vector3 from, Vector3 to, Vector3 axis) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) float num = Vector3.Angle(from, to); return num * Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to))); } private void Start() { ResetParticlePos(); } private void Update() { if (!ManualExecution) { Execute(); } } } public class DecalLayFlat : MonoBehaviour { private void Awake() { Flatten(); } private void OnEnable() { if (Application.isPlaying) { Flatten(); } } private void Flatten() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = ((Component)this).transform.rotation; float y = ((Quaternion)(ref rotation)).eulerAngles.y; ((Component)this).transform.rotation = Quaternion.Euler(90f, y, 0f); } } namespace BitWizrd.Explosives { [Serializable] public class DynamiteSensitivity { [Tooltip("Master switch. Off: hits behave as vanilla (kinetic over 100 or any heat lights the fuse).")] public bool DetonateOnDamage = false; [Tooltip("Damage the dynamite soaks up before it goes off. 100 = one hit that would have lit the vanilla fuse.")] public float Toughness = 100f; [Tooltip("x = flat amount ignored from each hit, y = multiplier on the rest. Same as FVRDestroyableObject.")] public Vector2 ResistBlunt = new Vector2(0f, 1f); public Vector2 ResistPiercing = new Vector2(0f, 1f); public Vector2 ResistCutting = new Vector2(0f, 1f); [Header("What counts")] public bool FromBullets = true; public bool FromExplosions = true; public bool FromMelee = false; [Tooltip("Hard knocks: dropped or thrown fast enough. Uses the barrel's collision formula.")] public bool FromImpact = false; [Tooltip("Minimum collision speed (m/s) before an impact counts. The barrel uses 2.5; a throw is faster than that.")] public float ImpactMinSpeed = 12f; [Header("Behaviour")] [Tooltip("A hit that carries heat (an incendiary round) still lights the fuse as vanilla does, when it did not set the dynamite off.")] public bool ThermalLightsFuse = true; [Tooltip("Seconds between the killing hit and the explosion. 0 = instant.")] public float DelaySeconds = 0f; [Tooltip("Dynamite hit by something while in a quickbelt slot (vanilla never lights a fuse there).")] public bool WorksInQuickbelt = false; [Header("Cook-off")] [Tooltip("Once damaged past CookOffAfter, toughness drains by itself and it goes off on its own (the barrel's decay).")] public bool CookOff = false; [Tooltip("Fraction of toughness already lost before the cook-off begins (0..1).")] public float CookOffAfter = 0.5f; [Tooltip("Seconds from the start of the cook-off to the explosion.")] public float CookOffSeconds = 3f; public DynamiteSensitivity Clone() { return (DynamiteSensitivity)MemberwiseClone(); } } public class Dynamite : FVRFuse, IFVRDamageable { [Tooltip("Seconds from lighting the tip to the explosion. Vanilla FVRFuse is fixed at 10.")] public float BurnSeconds = 10f; [Tooltip("How far along the fuse a lighter, flame or hot hit on the item starts it, 0 = the tip (full burn time). Touching a fuse segment still starts at that segment's own position.")] [Range(0f, 0.9f)] public float HeatStartF = 0f; public DynamiteSensitivity Sensitivity = new DynamiteSensitivity(); [Header("Fast Throw Sound")] public AudioSource fastThrowAudioSource; public AudioClip[] fastThrowClips; public float fastThrowVelocityThreshold = 10f; public float releaseWindow = 0.5f; private bool hasPlayedFastThrowSound = false; private bool shouldCheckVelocity = false; private float timeSinceRelease = 0f; private bool wasHeld = false; private static readonly FieldInfo s_tickField = typeof(FVRFuse).GetField("m_igniteTick", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static bool s_warned; private float m_fallbackTick; private Dynamite m_primary; private bool m_toughnessReady; private float m_toughness; private bool m_detonationPending; private FVRPhysicalObject m_physicalObject; public float BurnProgress => GetTick(); public bool HasExploded => base.hasBoomed; public bool DetonationPending => Primary.m_detonationPending; public float SecondsRemaining => (!((FVRFuse)this).IsIgnited()) ? BurnSeconds : Mathf.Max(0f, (1f - GetTick()) * BurnSeconds); public float ToughnessRemaining { get { Dynamite primary = Primary; primary.EnsureToughness(); return primary.m_toughness; } } private Dynamite Primary { get { if ((Object)(object)m_primary == (Object)null) { Dynamite dynamite = ((!((Object)(object)base.DynamiteCenter != (Object)null)) ? null : ((Component)base.DynamiteCenter).GetComponentInChildren<Dynamite>(true)); m_primary = ((!((Object)(object)dynamite != (Object)null)) ? this : dynamite); } return m_primary; } } private void Awake() { m_physicalObject = ((!((Object)(object)base.Dynamite != (Object)null)) ? ((Component)this).GetComponentInParent<FVRPhysicalObject>() : base.Dynamite); if ((Object)(object)fastThrowAudioSource == (Object)null) { fastThrowAudioSource = ((Component)this).GetComponent<AudioSource>(); if ((Object)(object)fastThrowAudioSource == (Object)null) { fastThrowAudioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); fastThrowAudioSource.playOnAwake = false; fastThrowAudioSource.spatialBlend = 1f; fastThrowAudioSource.volume = 1f; } } } private float GetTick() { if ((object)s_tickField != null) { return (float)s_tickField.GetValue(this); } return m_fallbackTick; } private void SetTick(float value) { if ((object)s_tickField != null) { s_tickField.SetValue(this, value); } else { m_fallbackTick = value; } } private void EnsureToughness() { if (!m_toughnessReady) { m_toughnessReady = true; m_toughness = ((Sensitivity == null) ? 100f : Mathf.Max(1f, Sensitivity.Toughness)); } } public bool ReceiveDamage(Damage d) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected I4, but got Unknown //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) Dynamite primary = Primary; if ((Object)(object)primary != (Object)(object)this) { return primary.ReceiveDamage(d); } DynamiteSensitivity sensitivity = Sensitivity; if (sensitivity == null || !sensitivity.DetonateOnDamage || d == null) { return false; } if (base.hasBoomed || m_detonationPending) { return true; } if (!sensitivity.WorksInQuickbelt && (Object)(object)base.Dynamite != (Object)null && (Object)(object)base.Dynamite.QuickbeltSlot != (Object)null) { return false; } DamageClass val = d.Class; if ((val - 1) switch { 0 => sensitivity.FromBullets ? 1 : 0, 1 => sensitivity.FromExplosions ? 1 : 0, 2 => sensitivity.FromMelee ? 1 : 0, 3 => sensitivity.FromImpact ? 1 : 0, _ => 0, } == 0) { return false; } EnsureToughness(); float num = Resisted(d.Dam_Blunt, sensitivity.ResistBlunt) + Resisted(d.Dam_Cutting, sensitivity.ResistCutting) + Resisted(d.Dam_Piercing, sensitivity.ResistPiercing); m_toughness -= num; if (m_toughness <= 0f) { Detonate(sensitivity); return true; } return !sensitivity.ThermalLightsFuse || !(d.Dam_Thermal > 0f); } private static float Resisted(float dam, Vector2 resist) { return Mathf.Clamp((dam - resist.x) * resist.y, 0f, Mathf.Max(0f, dam)); } private void Detonate(DynamiteSensitivity s) { m_detonationPending = true; if (s.DelaySeconds <= 0.001f) { ((FVRFuse)this).Boom(); } else { ((MonoBehaviour)this).Invoke("DetonateNow", s.DelaySeconds); } } private void DetonateNow() { ((FVRFuse)this).Boom(); } void IFVRDamageable.Damage(Damage dam) { if (!ReceiveDamage(dam) && dam != null && (dam.Dam_Thermal > 0f || dam.Dam_TotalKinetic > 100f)) { IgniteFromHeat(HeatStartF); } } public void IgniteFromHeat(float startF) { if (!base.hasBoomed && !((FVRFuse)this).IsIgnited()) { ((FVRFuse)this).Ignite(Mathf.Clamp01(startF)); } } public void Damage(Damage dam) { ((IFVRDamageable)this).Damage(dam); } private void Update() { //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) if (base.hasBoomed) { return; } if ((Object)(object)m_physicalObject == (Object)null) { m_physicalObject = ((!((Object)(object)base.Dynamite != (Object)null)) ? ((Component)this).GetComponentInParent<FVRPhysicalObject>() : base.Dynamite); } bool flag = (Object)(object)m_physicalObject != (Object)null && ((FVRInteractiveObject)m_physicalObject).IsHeld; if (flag && !wasHeld) { hasPlayedFastThrowSound = false; shouldCheckVelocity = false; timeSinceRelease = 0f; wasHeld = true; } else if (!flag && wasHeld) { shouldCheckVelocity = ((FVRFuse)this).IsIgnited(); timeSinceRelease = 0f; wasHeld = false; } TickCookOff(); if (((FVRFuse)this).IsIgnited()) { if ((object)s_tickField == null && !s_warned) { s_warned = true; Debug.LogWarning((object)"[Dynamite] FVRFuse.m_igniteTick was not found (the game changed). Burn time still works, but touching a fuse segment no longer skips ahead."); } base.FuseFire.SetActive(true); float num = GetTick() + Time.deltaTime / Mathf.Max(0.05f, BurnSeconds); SetTick(num); if (num >= 1f) { ((FVRFuse)this).Boom(); } int num2 = base.JointPos.Length; int num3 = Mathf.Clamp(Mathf.FloorToInt(num * (float)num2), 0, num2 - 1); int num4 = Mathf.Clamp(Mathf.RoundToInt(num * (float)num2), 0, num2 - 1); base.FuseFire.transform.position = Vector3.Lerp(base.JointPos[num3].position, base.JointPos[num4].position, num); base.FuseRend.material.SetFloat("_DissolveCutoff", num); } } private void FixedUpdate() { //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) if (base.hasBoomed) { return; } if ((Object)(object)m_physicalObject == (Object)null) { m_physicalObject = ((!((Object)(object)base.Dynamite != (Object)null)) ? ((Component)this).GetComponentInParent<FVRPhysicalObject>() : base.Dynamite); } if (!shouldCheckVelocity || !((FVRFuse)this).IsIgnited() || !((Object)(object)m_physicalObject != (Object)null) || ((FVRInteractiveObject)m_physicalObject).IsHeld) { return; } timeSinceRelease += Time.fixedDeltaTime; if (timeSinceRelease <= releaseWindow) { Rigidbody rootRigidbody = m_physicalObject.RootRigidbody; if ((Object)(object)rootRigidbody != (Object)null) { Vector3 velocity = rootRigidbody.velocity; if (((Vector3)(ref velocity)).magnitude > fastThrowVelocityThreshold && !hasPlayedFastThrowSound) { PlayFastThrowSound(); } } } else { shouldCheckVelocity = false; } } private void PlayFastThrowSound() { if (fastThrowClips != null && fastThrowClips.Length > 0 && (Object)(object)fastThrowAudioSource != (Object)null) { AudioClip val = fastThrowClips[Random.Range(0, fastThrowClips.Length)]; fastThrowAudioSource.PlayOneShot(val); } hasPlayedFastThrowSound = true; } private void TickCookOff() { if ((Object)(object)Primary != (Object)(object)this) { return; } DynamiteSensitivity sensitivity = Sensitivity; if (sensitivity == null || !sensitivity.DetonateOnDamage || !sensitivity.CookOff || m_detonationPending) { return; } EnsureToughness(); float num = Mathf.Max(1f, sensitivity.Toughness); if (!(m_toughness >= num) && !(1f - m_toughness / num < Mathf.Clamp01(sensitivity.CookOffAfter))) { float num2 = num * (1f - Mathf.Clamp01(sensitivity.CookOffAfter)) / Mathf.Max(0.1f, sensitivity.CookOffSeconds); m_toughness -= num2 * Time.deltaTime; if (m_toughness <= 0f) { Detonate(sensitivity); } } } } public class DynamiteFuseContact : FVRFuseContact, IFVRDamageable { void IFVRDamageable.Damage(Damage dam) { Dynamite dynamite = base.Fuse as Dynamite; if ((Object)(object)dynamite == (Object)null) { ((FVRFuseContact)this).Damage(dam); } else if (!dynamite.ReceiveDamage(dam)) { dynamite.IgniteFromHeat(base.StartF); } } public void Damage(Damage dam) { ((IFVRDamageable)this).Damage(dam); } } public class DynamiteImpactSensor : MonoBehaviour { private Dynamite m_fuse; private Rigidbody m_rb; private void OnCollisionEnter(Collision col) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_fuse == (Object)null) { m_fuse = ((Component)this).GetComponentInChildren<Dynamite>(true); } if ((Object)(object)m_fuse == (Object)null) { return; } DynamiteSensitivity sensitivity = m_fuse.Sensitivity; if (sensitivity == null || !sensitivity.DetonateOnDamage || !sensitivity.FromImpact) { return; } Vector3 relativeVelocity = col.relativeVelocity; float magnitude = ((Vector3)(ref relativeVelocity)).magnitude; if (!(magnitude < Mathf.Max(0f, sensitivity.ImpactMinSpeed))) { if ((Object)(object)m_rb == (Object)null) { m_rb = ((Component)this).GetComponent<Rigidbody>(); } float num = ((!((Object)(object)m_rb != (Object)null)) ? 100f : m_rb.mass); float num2 = ((!((Object)(object)col.rigidbody != (Object)null)) ? num : col.rigidbody.mass); float num3 = magnitude * (num2 / Mathf.Max(0.0001f, num)); Damage val = new Damage(); val.Class = (DamageClass)4; val.Dam_Blunt = num3 * magnitude * 50f; if (col.contacts.Length > 0) { val.hitNormal = ((ContactPoint)(ref col.contacts[0])).normal; val.point = ((ContactPoint)(ref col.contacts[0])).point; } Vector3 relativeVelocity2 = col.relativeVelocity; val.strikeDir = ((Vector3)(ref relativeVelocity2)).normalized; m_fuse.ReceiveDamage(val); } } } public class DynamiteItem : FVRFusedThrowable, IFVRDamageable { void IFVRDamageable.Damage(Damage dam) { Dynamite dynamite = base.Fuse as Dynamite; if ((Object)(object)dynamite == (Object)null) { ((FVRFusedThrowable)this).Damage(dam); } else if (!dynamite.ReceiveDamage(dam) && dam != null && (Object)(object)((FVRPhysicalObject)this).QuickbeltSlot == (Object)null && (dam.Dam_Thermal > 0f || dam.Dam_TotalKinetic > 100f)) { dynamite.IgniteFromHeat(dynamite.HeatStartF); } } public void Damage(Damage dam) { ((IFVRDamageable)this).Damage(dam); } } } public class ExplosionLightFade : MonoBehaviour { public Light Light; public float BaseIntensity = 1f; public float Delay; public float Lifetime = 1f; public AnimationCurve IntensityOverLife; public float FlickerMin; public float FlickerMax; public float FlickerSpeed = 1f; private float startTime; private float noiseOffset; private void Awake() { if ((Object)(object)Light == (Object)null) { Light = ((Component)this).GetComponent<Light>(); } noiseOffset = Random.value * 1000f; } private void OnEnable() { startTime = Time.time; } private void Update() { if ((Object)(object)Light == (Object)null || Lifetime <= 0f) { return; } float num = (Time.time - startTime - Delay) / Lifetime; if (num < 0f) { Light.intensity = 0f; return; } if (num >= 1f) { ((Behaviour)Light).enabled = false; ((Behaviour)this).enabled = false; return; } float num2 = ((IntensityOverLife == null) ? 1f : Mathf.Max(0f, IntensityOverLife.Evaluate(num))); float num3 = 1f; if (FlickerMax > FlickerMin) { num3 = Mathf.Lerp(FlickerMin, FlickerMax, Mathf.PerlinNoise(Time.time * FlickerSpeed + noiseOffset, 0f)); } Light.intensity = BaseIntensity * num2 * num3; } } public class FireLightFlicker : MonoBehaviour { public Light Light; public float BaseIntensity = 1f; public float FlickerMin = 1f; public float FlickerMax = 1f; public float FlickerSpeed = 1f; private float noiseOffset; private void Awake() { if ((Object)(object)Light == (Object)null) { Light = ((Component)this).GetComponent<Light>(); } noiseOffset = Random.value * 1000f; } private void Update() { if (!((Object)(object)Light == (Object)null)) { float num = Mathf.PerlinNoise(Time.time * FlickerSpeed + noiseOffset, 0f); Light.intensity = BaseIntensity * Mathf.Lerp(FlickerMin, FlickerMax, num); } } } namespace BitWizrd.Explosives { public class FuseFlameIgnitor : MonoBehaviour { public FVRFuse Owner; [Tooltip("How far from the flame a fuse contact is lit (metres).")] public float Radius = 0.02f; [Tooltip("Seconds between pulses.")] public float Interval = 0.2f; [Tooltip("Thermal damage in each pulse. FVRFuseContact ignores the amount; it only needs to be above zero.")] public float ThermalDamage = 1f; [Tooltip("Layers searched for fuse contacts (the contact joints sit on Flammable).")] public LayerMask Mask; private float m_tick; private Damage m_damage; private static readonly Collider[] s_buffer = (Collider[])(object)new Collider[48]; private void OnEnable() { m_tick = Interval; } private void Update() { if (!((Object)(object)Owner == (Object)null) && Owner.IsIgnited()) { m_tick -= Time.deltaTime; if (!(m_tick > 0f)) { m_tick = Interval; Pulse(); } } } public int Pulse() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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) //IL_0167: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Owner == (Object)null) { return 0; } if (m_damage == null) { m_damage = new Damage(); } Vector3 position = ((Component)this).transform.position; int num = Physics.OverlapSphereNonAlloc(position, Radius, s_buffer, ((LayerMask)(ref Mask)).value, (QueryTriggerInteraction)2); int num2 = 0; for (int i = 0; i < num; i++) { Collider val = s_buffer[i]; if (!((Object)(object)val == (Object)null)) { FVRFuseContact component = ((Component)val).GetComponent<FVRFuseContact>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.Fuse == (Object)null) && !((Object)(object)component.Fuse == (Object)(object)Owner) && !component.Fuse.IsIgnited()) { Vector3 val2 = val.ClosestPointOnBounds(position); Vector3 val3 = position - val2; val3 = ((!(((Vector3)(ref val3)).sqrMagnitude > 1E-10f)) ? Vector3.up : ((Vector3)(ref val3)).normalized); m_damage.Class = (DamageClass)0; m_damage.Dam_Thermal = ThermalDamage; m_damage.Dam_TotalEnergetic = ThermalDamage; m_damage.point = val2; m_damage.hitNormal = val3; m_damage.strikeDir = -val3; component.Damage(m_damage); num2++; } } } return num2; } } } public class GunStockLace : MonoBehaviour { public float length = 0.5f; public float gravity = 9.81f; public float damping = 0.05f; public float maxDeviationAngle = 45f; public LayerMask collisionMask; public bool showGizmos = false; private Vector3 pendulumDirection; private Vector3 angularVelocity; private Quaternion baseRotation; private Vector3 restDirection; private Vector3 previousPosition; private void Start() { //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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) baseRotation = ((Component)this).transform.rotation; restDirection = baseRotation * -Vector3.up; pendulumDirection = restDirection; previousPosition = ((Component)this).transform.position; } private void FixedUpdate() { //IL_0007: 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) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_0024: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_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) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00b6: 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_00ca: 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_00d0: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: 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_0101: 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_010c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)this).transform.position - previousPosition; previousPosition = ((Component)this).transform.position; float fixedDeltaTime = Time.fixedDeltaTime; Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length; Vector3 val3 = val * 10f / fixedDeltaTime; angularVelocity += (val2 + val3) * fixedDeltaTime; angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime); Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f); pendulumDirection = val4 * pendulumDirection; HandleCollisionLimits(); ClampToMaxAngle(); ((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation; } private void HandleCollisionLimits() { //IL_0007: 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) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0070: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0087: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask))) { Vector3 normal = ((RaycastHit)(ref val)).normal; Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Vector3.Angle(pendulumDirection, normalized); pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f); angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal); } } private void ClampToMaxAngle() { //IL_0002: 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_0022: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_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) float num = Vector3.Angle(restDirection, pendulumDirection); if (num > maxDeviationAngle) { pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f); angularVelocity *= 0.5f; } } private void OnDrawGizmos() { //IL_0011: 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) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_005c: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if (showGizmos) { Gizmos.color = Color.yellow; Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length); Gizmos.color = Color.red; Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f); } } } public class HuntDollarSR : MonoBehaviour { private IEnumerator Start() { yield return (object)new WaitForSeconds(3f); string str = "CharcoalBriquette(Clone)"; ((Object)((Component)this).gameObject).name = str; Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Component val = (Component)(object)componentsInChildren[i]; ((Object)val.gameObject).name = str; } } } [ExecuteInEditMode] public class ParticleAffectorCoordinator : MonoBehaviour { [Serializable] public struct BeamConfig { public Transform SourceTransform; public Vector3 SourceOffset; public Transform DestTransform; public Vector3 DestOffset; public bool HasLine; } [Serializable] public struct LocationOffsetEntry { public Vector3 Direction; public float ScaleMin; public float ScaleMax; } [Serializable] public struct VelocityExtraEntry { public Vector3 Direction; public float ConeAngleDeg; public float SpeedMin; public float SpeedMax; } [Serializable] public struct ConeParams { public float AngleMin; public float AngleMax; public float Inner; public string SFCurve; public string RandCurve; } [Serializable] public struct CompassEntry { public float PolarBaseDeg; public string PolarCurve; public float AzimuthBaseDeg; public string AzimuthCurve; public float AzimuthOriginDeg; public ConeParams Cone; public float SpeedMin; public float SpeedMax; public string SpeedCurve; public string SpeedRandomCurve; } [Serializable] public struct ConeEntry { public Vector3 Axis; public ConeParams Cone; public float SpeedMin; public float SpeedMax; public string SpeedCurve; public string SpeedRandomCurve; } [Serializable] public struct RadialVelocityEntry { public bool Sphere; public Vector3 Axis; public Vector3 Scale; public float InnerFraction; public float SpeedMin; public float SpeedMax; public string SpeedCurve; } [Serializable] public struct GravityEntry { public bool UseAxis; public float Accel; public float Decay; public Vector3 Axis; public Transform Target; } [Serializable] public struct VortexEntry { public float Speed; public float Decay; public Vector3 Axis; public Transform Target; public float Drag; } private sealed class LinearCurve { private readonly float[] t; private readonly float[] v; public LinearCurve(string keys) { string[] array = keys.Split(new char[1] { ';' }); t = new float[array.Length]; v = new float[array.Length]; for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { ',' }); t[i] = float.Parse(array2[0], CultureInfo.InvariantCulture); v[i] = float.Parse(array2[1], CultureInfo.InvariantCulture); } } public float Evaluate(float x) { if (x <= t[0]) { return v[0]; } for (int i = 1; i < t.Length; i++) { if (x <= t[i]) { float num = t[i] - t[i - 1]; float num2 = ((!(num > 1E-06f)) ? 1f : ((x - t[i - 1]) / num)); return Mathf.Lerp(v[i - 1], v[i], num2); } } return v[v.Length - 1]; } } public ParticleSystem Ps; public bool HasBeam; public BeamConfig Beam; public LocationOffsetEntry[] LocationOffsets; public string[] LocationOffsetScaleCurveKeysStrs; [NonSerialized] private AnimationCurve[] _locationOffsetScaleCurves; public VelocityExtraEntry[] VelocityExtras; public CompassEntry[] CompassEntries; public RadialVelocityEntry[] RadialVelocities; public ConeEntry[] ConeEntries; public int SpawnCountHint = 1; public GravityEntry[] GravityEntries; public VortexEntry[] VortexEntries; public bool HasGravityDrag; public float GravityDrag; public bool HasUniformAccel; public Vector3 UniformAccel; public AnimationCurve UniformAccelCurve; private static readonly bool UnityUsesNewVelocityForPosition = true; public bool HasDragCurve; public AnimationCurve DragCurve; public Vector3 DragWind; public bool HasDragRandom; public float DragRandomMin; public float DragRandomMax; public bool HasFacingFade; public AnimationCurve FacingSizeCurve; public AnimationCurve FacingOpacityCurve; private readonly Dictionary<uint, Vector2> _facingBase = new Dictionary<uint, Vector2>(); private readonly List<uint> _facingPrune = new List<uint>(); public bool HasPixelClamp; public float PixelSizeMin; public float PixelSizeMax; public bool PixelSizeMaxInfinite; public bool PixelSizeAffectOpacity; public float MaxCameraDistance; [NonSerialized] private ParticleSystemRenderer _cullRenderer; public bool HasMoveRelativeToEmitter; public Transform MoveRelEmitter; public float MoveRelPositionInherit; public float MoveRelVelocityInherit; public bool HasAlignRotation; public Transform AlignParentTransform; public Vector3 AlignAxisLocal; [NonSerialized] private Vector3 _alignTargetWorldDir; public Quaternion ShapeAimRotation = Quaternion.identity; [NonSerialized] private Quaternion _inverseShapeAim = Quaternion.identity; private Particle[] buffer; private Vector3 beamSourceWorld; private Vector3 beamDestWorld; private Vector3 lastEmitterPos; private Quaternion lastEmitterRot; private HashSet<uint> lastFrameSeeds = new HashSet<uint>(); private HashSet<uint> currentFrameSeeds = new HashSet<uint>(); public static readonly List<ParticleAffectorCoordinator> EditInstances = new List<ParticleAffectorCoordinator>(); public ParticleSystem ParentFramePs; public ParticleAffectorCoordinator ParentFrameCoord; public Vector3 ParentAlignAxis; public bool ParentFrameUnique; public bool ParentCollides; public float ParentFrameScatterDeg; [NonSerialized] private int _processedFrame = -1; [NonSerialized] private int _parentLoadFrame = -1; [NonSerialized] private int _parentCount; [NonSerialized] private Particle[] _parentBuf; [NonSerialized] private bool[] _parentTaken; private static Camera s_viewerCamera; [NonSerialized] private int _spawnRank; [NonSerialized] private LinearCurve[] _compassPolar; [NonSerialized] private LinearCurve[] _compassAzimuth; [NonSerialized] private LinearCurve[] _compassSpeed; [NonSerialized] private LinearCurve[] _compassSpeedRand; [NonSerialized] private LinearCurve[] _radialSpeed; [NonSerialized] private LinearCurve[] _compassConeSF; [NonSerialized] private LinearCurve[] _compassConeRand; [NonSerialized] private LinearCurve[] _coneSF; [NonSerialized] private LinearCurve[] _coneRand; [NonSerialized] private LinearCurve[] _coneSpeed; [NonSerialized] private LinearCurve[] _coneSpeedRand; private void OnEnable() { _spawnRank = 0; _processedFrame = -1; _parentLoadFrame = -1; if (!Application.isPlaying && !EditInstances.Contains(this)) { EditInstances.Add(this); } } private void OnDisable() { EditInstances.Remove(this); } public void EditorTick() { if (!Application.isPlaying && !((Object)(object)this == (Object)null)) { Process(); } } private bool TryParentFrame(Vector3 pos, float childAge, out Quaternion q) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) q = Quaternion.identity; if ((Object)(object)ParentFramePs == (Object)null || ((Vector3)(ref ParentAlignAxis)).sqrMagnitude < 1E-06f) { return false; } if (_parentLoadFrame != CryEditClock.Frame) { _parentLoadFrame = CryEditClock.Frame; MainModule main = ParentFramePs.main; int maxParticles = ((MainModule)(ref main)).maxParticles; if (_parentBuf == null || _parentBuf.Length < maxParticles) { _parentBuf = (Particle[])(object)new Particle[maxParticles]; _parentTaken = new bool[maxParticles]; } _parentCount = ParentFramePs.GetParticles(_parentBuf); Array.Clear(_parentTaken, 0, _parentTaken.Length); } float num = 0.05f + CryEditClock.Dt * 2f; int num2 = -1; float num3 = float.MaxValue; for (int i = 0; i < _parentCount; i++) { if (ParentFrameUnique && _parentTaken[i]) { continue; } Particle val = _parentBuf[i]; if (Mathf.Abs(((Particle)(ref val)).startLifetime - ((Particle)(ref val)).remainingLifetime - childAge) > num) { continue; } Vector3 velocity = ((Particle)(ref val)).velocity; if (!(((Vector3)(ref velocity)).sqrMagnitude < 1E-06f)) { Vector3 val2 = ((Particle)(ref val)).position - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num3) { num3 = sqrMagnitude; num2 = i; } } } if (num2 < 0) { return false; } if (ParentFrameUnique) { _parentTaken[num2] = true; } Vector3 normalized = ((Vector3)(ref ParentAlignAxis)).normalized; Vector3 val3 = ParentDirection(num2); q = Quaternion.FromToRotation(normalized, ((Vector3)(ref val3)).normalized); if (ParentFrameScatterDeg > 0.01f) { Vector3 val4 = q * ((Vector3)(ref ParentAlignAxis)).normalized; Vector3 val5 = Vector3.Cross(val4, Random.onUnitSphere); if (((Vector3)(ref val5)).sqrMagnitude > 1E-06f) { q = Quaternion.AngleAxis(ParentFrameScatterDeg * Mathf.Sqrt(Random.value), ((Vector3)(ref val5)).normalized) * q; } } return true; } private Vector3 ParentDirection(int i) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Vector3 velocity = ((Particle)(ref _parentBuf[i])).velocity; if (ParentCollides && velocity.y < 0f) { velocity.y = 0f - velocity.y; } return velocity; } private void Awake() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0071: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029c: 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_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Ps == (Object)null) { Ps = ((Component)this).GetComponent<ParticleSystem>(); } Quaternion val = ShapeAimRotation; if (val.x == 0f && val.y == 0f && val.z == 0f && val.w == 0f) { val = Quaternion.identity; } _inverseShapeAim = Quaternion.Inverse(val); BuildSpawnVelocityCurves(); if (LocationOffsetScaleCurveKeysStrs != null && LocationOffsetScaleCurveKeysStrs.Length > 0) { _locationOffsetScaleCurves = (AnimationCurve[])(object)new AnimationCurve[LocationOffsetScaleCurveKeysStrs.Length]; for (int i = 0; i < LocationOffsetScaleCurveKeysStrs.Length; i++) { _locationOffsetScaleCurves[i] = ParseScaleCurveKeysStr(LocationOffsetScaleCurveKeysStrs[i]); } } if (HasBeam) { Vector3 val2 = ((!((Object)(object)Beam.SourceTransform != (Object)null)) ? ((Component)this).transform.position : Beam.SourceTransform.position); Vector3 val3 = ((!((Object)(object)Beam.DestTransform != (Object)null)) ? ((Component)this).transform.position : Beam.DestTransform.position); beamSourceWorld = val2 + Beam.SourceOffset; beamDestWorld = val3 + Beam.DestOffset; if (Beam.HasLine && Application.isPlaying) { LineRenderer val4 = ((Component)this).GetComponent<LineRenderer>(); if ((Object)(object)val4 == (Object)null) { val4 = ((Component)this).gameObject.AddComponent<LineRenderer>(); } ParticleSystemRenderer component = ((Component)this).GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)val4).material = ((Renderer)component).sharedMaterial; } val4.useWorldSpace = true; val4.positionCount = 2; val4.SetPosition(0, beamSourceWorld); val4.SetPosition(1, beamDestWorld); } } if (HasMoveRelativeToEmitter) { if ((Object)(object)MoveRelEmitter == (Object)null) { MoveRelEmitter = ((Component)this).transform; } lastEmitterPos = MoveRelEmitter.position; lastEmitterRot = MoveRelEmitter.rotation; } if (HasAlignRotation) { Quaternion val5 = ((!((Object)(object)AlignParentTransform != (Object)null)) ? Quaternion.identity : AlignParentTransform.rotation); Vector3 val6 = val5 * AlignAxisLocal; _alignTargetWorldDir = ((Vector3)(ref val6)).normalized; } } private void LateUpdate() { Process(); } private void Process() { if (_processedFrame != CryEditClock.Frame) { _processedFrame = CryEditClock.Frame; if ((Object)(object)ParentFrameCoord != (Object)null) { ParentFrameCoord.Process(); } ProcessCore(); } } private void ProcessCore() { //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_12f8: Unknown result type (might be due to invalid IL or missing references) //IL_12fa: Unknown result type