Decompiled source of Beam50BMG v1.0.2
Beam50BMG.dll
Decompiled 9 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; 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; using UnityEngine.Rendering; [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 BeamBMG { public class BeamExplosionFx : MonoBehaviour { private enum Kind { Flash, Halo, Fire, Smoke, RingFlat, RingFacing } private class Puff { public Kind Kind; public Transform T; public Material Mat; public Vector3 Pos; public Vector3 Vel; public float Drag; public float Rise; public float Delay; public float Life; public float Size0; public float Size1; public float Rot; public float RotSpeed; public float Bright; public float Alpha; public bool Active; } private static readonly int ColorId = Shader.PropertyToID("_Color"); private static readonly int EmissionId = Shader.PropertyToID("_EmissionColor"); private static readonly int MainTexId = Shader.PropertyToID("_MainTex"); private static readonly int SrcBlendId = Shader.PropertyToID("_SrcBlend"); private static readonly int DstBlendId = Shader.PropertyToID("_DstBlend"); private static readonly int ZWriteId = Shader.PropertyToID("_ZWrite"); private const int FireTexCount = 4; private const float LightLife = 1.1f; private static Texture2D[] s_fireTex; private static Texture2D s_smokeTex; private static Texture2D s_glowTex; private static Texture2D s_ringTex; private static Texture2D s_sparkTex; private static Mesh s_quad; private static AudioClip s_boom; private readonly List<Puff> m_puffs = new List<Puff>(); private Material m_sparkMat; private Material m_emberMat; private const int LightTiers = 3; private Light[] m_lights; private float[] m_lightPeaks; private float[] m_lightFalloff; private Vector3 m_normal; private Camera m_cam; private float m_age; private float m_endTime; private bool m_gamePending; private Vector3 m_gamePos; private int m_gameIff; private string m_gameItemId; public static void Spawn(Vector3 position, Vector3 normal, VolatileRound s) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: 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_0021: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("BeamExplosionFx"); val.transform.position = position; BeamExplosionFx beamExplosionFx = val.AddComponent<BeamExplosionFx>(); beamExplosionFx.Build(position, normal, s); } private void Build(Vector3 position, Vector3 normal, VolatileRound s) { //IL_000e: 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_004a: 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_004f: 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_00b3: 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_0193: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) m_gamePending = s.UseGameExplosion; m_gamePos = position; m_gameIff = s.SourceIFF; m_gameItemId = s.GameExplosionItemId; m_normal = ((!(((Vector3)(ref normal)).sqrMagnitude < 0.01f)) ? ((Vector3)(ref normal)).normalized : Vector3.up); AudioClip boom = GetBoom(); Object.Destroy((Object)(object)((Component)this).gameObject, Mathf.Max(5f, boom.length + 0.5f)); float num = Mathf.Max(0.2f, s.FireballSize / 5f); if ((Object)(object)s.FxMaterial != (Object)null) { EnsureAssets(); BuildPuffs(position, num, s); BuildSparks(position, num, s.FxMaterial); } float num2 = Mathf.Max(s.ExplosionLightRange, 50f); float num3 = Mathf.Max(s.ExplosionLightIntensity, 0f); float[] array = new float[3] { Mathf.Max(s.BlastRadius * 3.5f, 25f), num2 * 0.3f, num2 }; float[] lightPeaks = new float[3] { 30f, num3 * 1.4f, num3 }; m_lightFalloff = new float[3] { 2.6f, 2.2f, 1.8f }; m_lights = (Light[])(object)new Light[3]; m_lightPeaks = lightPeaks; for (int i = 0; i < 3; i++) { GameObject val = new GameObject(i switch { 0 => "Flash", 1 => "FlashMid", _ => "FlashFar", }); val.transform.SetParent(((Component)this).transform, false); val.transform.position = position + m_normal * (0.6f * num); Light val2 = val.AddComponent<Light>(); val2.type = (LightType)2; val2.color = new Color(1f, 0.25f, 0.2f, 1f); val2.range = array[i]; val2.intensity = 0f; val2.shadows = (LightShadows)0; val2.renderMode = (LightRenderMode)1; m_lights[i] = val2; } AudioSource val3 = ((Component)this).gameObject.AddComponent<AudioSource>(); val3.clip = boom; val3.volume = Mathf.Clamp01(s.BoomVolume); val3.spatialBlend = 1f; val3.dopplerLevel = 0f; val3.rolloffMode = (AudioRolloffMode)1; val3.minDistance = s.BoomMinDistance; val3.maxDistance = s.BoomMaxDistance; val3.playOnAwake = false; if (s.UseGameExplosion && !s.KeepGeneratedBoom && GameExplosion.IsReady) { val3.volume = 0f; } val3.Play(); } private void BuildPuffs(Vector3 pos, float k, VolatileRound s) { //IL_0009: 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_0017: 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_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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_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_00d1: 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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_0141: 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_0147: 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_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0309: 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_0161: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_01e7: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015a: 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_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: 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_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) Material fxMaterial = s.FxMaterial; Vector3 normal = m_normal; AddPuff(Kind.Flash, fxMaterial, s_glowTex, pos + normal * (0.3f * k), Vector3.zero, 0f, 0f, 0f, 0.22f, 1.5f * k, 11f * k, 0f, 0f, 70f, 1f, 4); AddPuff(Kind.Halo, fxMaterial, s_glowTex, pos + normal * (0.5f * k), Vector3.zero, 0f, 0f, 0f, 0.55f, 3f * k, 22f * k, 0f, 0f, 9f, 0.55f, 3); AddPuff(Kind.Fire, fxMaterial, s_fireTex[0], pos + normal * (0.8f * k), Vector3.zero, 2f, 0.8f, 0f, 0.95f, 1.5f * k, 6.5f * k, Random.Range(0f, 360f), Random.Range(-25f, 25f), 26f, 1f, 2); for (int i = 0; i < 20; i++) { Vector3 val = Random.onUnitSphere; if (Vector3.Dot(val, normal) < -0.15f) { val = Vector3.Reflect(val, normal); } Vector3 val2 = val + normal * 0.35f; val = ((Vector3)(ref val2)).normalized; float num = Random.Range(5f, 15f) * k; float num2 = Random.Range(2.6f, 4.8f) * k; AddPuff(Kind.Fire, fxMaterial, s_fireTex[Random.Range(0, 4)], pos + normal * (0.25f * k) + val * Random.Range(0.05f, 0.4f) * k, val * num, Random.Range(2.6f, 4.2f), Random.Range(0.5f, 2.5f), Random.Range(0f, 0.07f), Random.Range(0.55f, 1f), num2 * 0.35f, num2, Random.Range(0f, 360f), Random.Range(-70f, 70f), Random.Range(14f, 24f), Random.Range(0.8f, 1f), 2); } float num3 = Mathf.Max(s.BlastRadius * 2.2f, 6f); AddPuff(Kind.RingFlat, fxMaterial, s_ringTex, pos + normal * 0.08f, Vector3.zero, 0f, 0f, 0f, 0.5f, 0.5f * k, num3, 0f, 0f, 5f, 0.9f, 3); AddPuff(Kind.RingFacing, fxMaterial, s_ringTex, pos + normal * (0.5f * k), Vector3.zero, 0f, 0f, 0f, 0.38f, 0.5f * k, num3 * 0.8f, Random.Range(0f, 360f), 0f, 7f, 0.8f, 3); for (int j = 0; j < 14; j++) { Vector3 val3 = Random.onUnitSphere; if (Vector3.Dot(val3, normal) < 0f) { val3 = Vector3.Reflect(val3, normal); } float num4 = Random.Range(4f, 7.5f) * k; AddPuff(Kind.Smoke, fxMaterial, s_smokeTex, pos + normal * (0.5f * k) + val3 * Random.Range(0.3f, 1.8f) * k, val3 * Random.Range(1.5f, 5f) * k, Random.Range(1.2f, 2.2f), Random.Range(0.4f, 1.4f), Random.Range(0.08f, 0.35f), Random.Range(2.2f, 3.6f), num4 * 0.35f, num4, Random.Range(0f, 360f), Random.Range(-18f, 18f), 1f, Random.Range(0.55f, 0.8f), 0); } } private void AddPuff(Kind kind, Material baseMat, Texture2D tex, Vector3 pos, Vector3 vel, float drag, float rise, float delay, float life, float size0, float size1, float rot, float rotSpeed, float bright, float alpha, int queueOffset) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_0099: 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) //IL_00cc: Expected O, but got Unknown Puff puff = new Puff(); puff.Kind = kind; puff.Pos = pos; puff.Vel = vel; puff.Drag = drag; puff.Rise = rise; puff.Delay = delay; puff.Life = life; puff.Size0 = size0; puff.Size1 = size1; puff.Rot = rot; puff.RotSpeed = rotSpeed; puff.Bright = bright; puff.Alpha = alpha; GameObject val = new GameObject(kind.ToString()); val.transform.SetParent(((Component)this).transform, false); val.transform.position = pos; val.AddComponent<MeshFilter>().sharedMesh = s_quad; MeshRenderer val2 = val.AddComponent<MeshRenderer>(); ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; Material val3 = new Material(baseMat); bool flag = kind != Kind.Smoke; val3.SetFloat(SrcBlendId, 5f); val3.SetFloat(DstBlendId, (!flag) ? 10f : 1f); val3.SetFloat(ZWriteId, 0f); val3.SetTexture(MainTexId, (Texture)(object)tex); val3.renderQueue = 3000 + queueOffset; ((Renderer)val2).sharedMaterial = val3; puff.T = val.transform; puff.Mat = val3; val.SetActive(false); m_puffs.Add(puff); m_endTime = Mathf.Max(m_endTime, delay + life); } private void BuildSparks(Vector3 position, float k, Material fxMaterial) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0194: 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_01e3: Unknown result type (might be due to invalid IL or missing references) m_sparkMat = new Material(fxMaterial); m_sparkMat.SetFloat(SrcBlendId, 5f); m_sparkMat.SetFloat(DstBlendId, 1f); m_sparkMat.SetFloat(ZWriteId, 0f); m_sparkMat.SetTexture(MainTexId, (Texture)(object)s_sparkTex); m_sparkMat.SetColor(ColorId, new Color(0f, 0f, 0f, 1f)); m_sparkMat.SetColor(EmissionId, new Color(14f, 10.92f, 5.6f, 1f)); m_sparkMat.renderQueue = 3005; MakeSparkSystem("Sparks", m_sparkMat, position, 160, 0.35f, 1.1f, 14f * k, 42f * k, 0.07f * k, 0.16f * k, 0.6f, 0.6f, (ParticleSystemRenderMode)1, 0.05f, 1.4f); m_emberMat = new Material(fxMaterial); m_emberMat.SetFloat(SrcBlendId, 5f); m_emberMat.SetFloat(DstBlendId, 1f); m_emberMat.SetFloat(ZWriteId, 0f); m_emberMat.SetTexture(MainTexId, (Texture)(object)s_glowTex); m_emberMat.SetColor(ColorId, new Color(0f, 0f, 0f, 1f)); m_emberMat.SetColor(EmissionId, new Color(8f, 3.2f, 0.64f, 1f)); m_emberMat.renderQueue = 3004; MakeSparkSystem("Embers", m_emberMat, position, 70, 1.2f, 2.6f, 3f * k, 13f * k, 0.05f * k, 0.12f * k, 0.35f, 0.5f, (ParticleSystemRenderMode)0, 0f, 1f); } private void MakeSparkSystem(string name, Material mat, Vector3 position, int count, float lifeMin, float lifeMax, float speedMin, float speedMax, float sizeMin, float sizeMax, float gravity, float dampen, ParticleSystemRenderMode mode, float velScale, float lenScale) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0020: 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_0032: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: 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_01c9: Invalid comparison between Unknown and I4 GameObject val = new GameObject(name); val.transform.SetParent(((Component)this).transform, false); val.transform.position = position; val.transform.rotation = Quaternion.LookRotation(m_normal); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(); MainModule main = val2.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).maxParticles = count + 20; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(lifeMin, lifeMax); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(speedMin, speedMax); ((MainModule)(ref main)).startSize = new MinMaxCurve(sizeMin, sizeMax); ((MainModule)(ref main)).gravityModifier = new MinMaxCurve(gravity); EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).rateOverTime = new MinMaxCurve(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)count) }); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)2; ((ShapeModule)(ref shape)).radius = 0.15f; LimitVelocityOverLifetimeModule limitVelocityOverLifetime = val2.limitVelocityOverLifetime; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).enabled = true; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = 0.08f + dampen * 0.1f; ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limit = new MinMaxCurve(speedMin * 0.4f); SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; AnimationCurve val3 = new AnimationCurve(); val3.AddKey(0f, 1f); val3.AddKey(0.55f, 0.85f); val3.AddKey(1f, 0f); ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, val3); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); component.renderMode = mode; if ((int)mode == 1) { component.velocityScale = velScale; component.lengthScale = lenScale; } ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; ((Renderer)component).sharedMaterial = mat; val2.Play(); } private void Update() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) if (m_gamePending) { m_gamePending = false; GameExplosion.Spawn(m_gamePos, m_gameIff, m_gameItemId); } float deltaTime = Time.deltaTime; m_age += deltaTime; if ((Object)(object)m_cam == (Object)null) { m_cam = Camera.main; } if ((Object)(object)m_cam == (Object)null && Camera.allCamerasCount > 0) { m_cam = Camera.allCameras[0]; } Vector3 camPos = ((!((Object)(object)m_cam != (Object)null)) ? (((Component)this).transform.position - Vector3.forward * 10f) : ((Component)m_cam).transform.position); for (int i = 0; i < m_puffs.Count; i++) { UpdatePuff(m_puffs[i], deltaTime, camPos); } UpdateLight(); } private void UpdatePuff(Puff p, float dt, Vector3 camPos) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //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) //IL_00d3: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) float num = m_age - p.Delay; if (num < 0f) { return; } float num2 = num / p.Life; if (num2 >= 1f) { if (p.Active) { ((Component)p.T).gameObject.SetActive(false); p.Active = false; } return; } if (!p.Active) { ((Component)p.T).gameObject.SetActive(true); p.Active = true; } p.Pos += p.Vel * dt; p.Vel *= Mathf.Exp((0f - p.Drag) * dt); p.Vel += Vector3.up * (p.Rise * dt); p.Rot += p.RotSpeed * dt; float num3 = 1f - (1f - num2) * (1f - num2) * (1f - num2); float num4 = Mathf.Lerp(p.Size0, p.Size1, (p.Kind != Kind.Smoke) ? num3 : Mathf.Sqrt(num2)); Transform t = p.T; t.position = p.Pos; if (p.Kind == Kind.RingFlat) { t.rotation = Quaternion.LookRotation(-m_normal); t.localScale = Vector3.one * Mathf.Lerp(p.Size0, p.Size1, 1f - (1f - num2) * (1f - num2) * (1f - num2) * (1f - num2)); } else { Vector3 val = p.Pos - camPos; Quaternion val2 = ((!(((Vector3)(ref val)).sqrMagnitude > 0.0001f)) ? Quaternion.identity : Quaternion.LookRotation(val)); t.rotation = val2 * Quaternion.Euler(0f, 0f, p.Rot); t.localScale = Vector3.one * ((p.Kind != Kind.RingFacing) ? num4 : Mathf.Lerp(p.Size0, p.Size1, 1f - (1f - num2) * (1f - num2) * (1f - num2) * (1f - num2))); } ColorFor(p, num2, out var emission, out var alpha); if (p.Kind == Kind.Smoke) { float num5 = Mathf.Clamp01(1f - num2 * 3.5f); float num6 = Mathf.Lerp(0.09f, 0.03f, num2); p.Mat.SetColor(ColorId, new Color(num6, num6 * 0.92f, num6 * 0.85f, alpha)); p.Mat.SetColor(EmissionId, new Color(1f, 0.38f, 0.08f, 1f) * (num5 * num5 * 3.5f)); } else { p.Mat.SetColor(ColorId, new Color(0f, 0f, 0f, alpha)); p.Mat.SetColor(EmissionId, emission); } } private static void ColorFor(Puff p, float u, out Color emission, out float alpha) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) switch (p.Kind) { case Kind.Flash: alpha = p.Alpha * (1f - u) * (1f - u); emission = new Color(1f, 0.95f, 0.85f) * p.Bright; return; case Kind.Halo: alpha = p.Alpha * Mathf.Pow(1f - u, 1.8f); emission = Color.Lerp(new Color(1f, 0.75f, 0.4f), new Color(1f, 0.3f, 0.06f), u) * p.Bright; return; case Kind.RingFlat: case Kind.RingFacing: alpha = p.Alpha * Mathf.Pow(1f - u, 1.5f); emission = Color.Lerp(new Color(1f, 0.92f, 0.8f), new Color(1f, 0.35f, 0.1f), u) * p.Bright; return; case Kind.Smoke: emission = Color.black; alpha = p.Alpha * Mathf.Clamp01(u * 8f) * Mathf.Pow(1f - u, 1.3f); return; } Color val = default(Color); ((Color)(ref val))..ctor(1f, 0.96f, 0.82f); Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.72f, 0.25f); Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.36f, 0.06f); Color val4 = default(Color); ((Color)(ref val4))..ctor(0.55f, 0.07f, 0.02f); Color val5 = ((u < 0.12f) ? Color.Lerp(val, val2, u / 0.12f) : ((!(u < 0.4f)) ? Color.Lerp(val3, val4, (u - 0.4f) / 0.6f) : Color.Lerp(val2, val3, (u - 0.12f) / 0.28f))); float num = 1f - u; emission = val5 * (p.Bright * (0.25f + 0.75f * num * num)); alpha = p.Alpha * Mathf.Clamp01(u * 25f) * Mathf.Pow(num, 1.1f); } private void UpdateLight() { //IL_005d: 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_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) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if (m_lights == null) { return; } float num = m_age / 1.1f; bool flag = num >= 1f; float num2 = Mathf.Clamp01(m_age / 0.03f); float num3 = 0.8f + 0.4f * Random.value; Color color = Color.Lerp(new Color(1f, 0.3f, 0.25f), new Color(1f, 0.02f, 0.02f), Mathf.Clamp01(num * 2.5f)); for (int i = 0; i < m_lights.Length; i++) { Light val = m_lights[i]; if (!((Object)(object)val == (Object)null)) { if (flag) { ((Behaviour)val).enabled = false; continue; } val.intensity = m_lightPeaks[i] * num2 * Mathf.Pow(1f - num, m_lightFalloff[i]) * num3; val.color = color; } } } private void OnDestroy() { for (int i = 0; i < m_puffs.Count; i++) { if ((Object)(object)m_puffs[i].Mat != (Object)null) { Object.Destroy((Object)(object)m_puffs[i].Mat); } } if ((Object)(object)m_sparkMat != (Object)null) { Object.Destroy((Object)(object)m_sparkMat); } if ((Object)(object)m_emberMat != (Object)null) { Object.Destroy((Object)(object)m_emberMat); } } private static void EnsureAssets() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //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) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00e7: 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_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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01a9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)s_quad == (Object)null) { Mesh val = new Mesh(); ((Object)val).name = "BeamFxQuad"; val.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.5f, -0.5f, 0f), new Vector3(0.5f, -0.5f, 0f), new Vector3(0.5f, 0.5f, 0f), new Vector3(-0.5f, 0.5f, 0f) }; val.uv = (Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(0f, 1f) }; val.normals = (Vector3[])(object)new Vector3[4] { Vector3.back, Vector3.back, Vector3.back, Vector3.back }; val.triangles = new int[12] { 0, 2, 1, 0, 3, 2, 0, 1, 2, 0, 2, 3 }; val.bounds = new Bounds(Vector3.zero, new Vector3(1f, 1f, 1f)); s_quad = val; } if (s_fireTex == null) { s_fireTex = (Texture2D[])(object)new Texture2D[4]; for (int i = 0; i < 4; i++) { s_fireTex[i] = MakeCloud(128, 11 + i * 37, 0.5f, 3.2f, fire: true); } } if ((Object)(object)s_smokeTex == (Object)null) { s_smokeTex = MakeCloud(128, 901, 0.62f, 2.4f, fire: false); } if ((Object)(object)s_glowTex == (Object)null) { s_glowTex = MakeGlow(128); } if ((Object)(object)s_ringTex == (Object)null) { s_ringTex = MakeRing(128); } if ((Object)(object)s_sparkTex == (Object)null) { s_sparkTex = MakeSpark(64); } } private static Texture2D NewTex(int size, string name) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); ((Object)val).name = name; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; return val; } private static Texture2D MakeCloud(int size, int seed, float radiusFrac, float baseFreq, bool fire) { //IL_01cc: 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) Texture2D val = NewTex(size, (!fire) ? "BeamFxSmoke" : "BeamFxFire"); Color32[] array = (Color32[])(object)new Color32[size * size]; float num = (float)seed * 3.17f; float num2 = (float)seed * 1.91f; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num3 = ((float)j + 0.5f) / (float)size * 2f - 1f; float num4 = ((float)i + 0.5f) / (float)size * 2f - 1f; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); float num6 = 0f; float num7 = 0.5f; float num8 = baseFreq; float num9 = 0f; for (int k = 0; k < 5; k++) { num6 += num7 * ValueNoise(num3 * num8 + num, num4 * num8 + num2, seed + k * 17); num9 += num7; num7 *= 0.5f; num8 *= 2.03f; } num6 /= num9; float num10 = 1f - num5 / (radiusFrac * 2f + 0.5f); float num11 = Mathf.Clamp01(num10 * 1.9f - (1f - num6) * ((!fire) ? 0.75f : 0.9f)); num11 = num11 * num11 * (3f - 2f * num11); if (fire) { num11 = Mathf.Clamp01(num11 * (0.65f + 0.7f * num6)); } float num12 = Mathf.Clamp01(num11) * Mathf.Clamp01((1f - num5) * 6f); byte b = (byte)Mathf.RoundToInt(num12 * 255f); ref Color32 reference = ref array[i * size + j]; reference = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, b); } } val.SetPixels32(array); val.Apply(false); return val; } private static Texture2D MakeGlow(int size) { //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) Texture2D val = NewTex(size, "BeamFxGlow"); Color32[] array = (Color32[])(object)new Color32[size * size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = ((float)j + 0.5f) / (float)size * 2f - 1f; float num2 = ((float)i + 0.5f) / (float)size * 2f - 1f; float num3 = Mathf.Sqrt(num * num + num2 * num2); float num4 = 1f / (1f + 22f * num3 * num3); num4 *= Mathf.Clamp01((1f - num3) * 3f); ref Color32 reference = ref array[i * size + j]; reference = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)Mathf.RoundToInt(Mathf.Clamp01(num4) * 255f)); } } val.SetPixels32(array); val.Apply(false); return val; } private static Texture2D MakeRing(int size) { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) Texture2D val = NewTex(size, "BeamFxRing"); Color32[] array = (Color32[])(object)new Color32[size * size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = ((float)j + 0.5f) / (float)size * 2f - 1f; float num2 = ((float)i + 0.5f) / (float)size * 2f - 1f; float num3 = Mathf.Sqrt(num * num + num2 * num2); float num4 = 0.86f; float num5 = num3 - num4; float num6 = ((!(num5 > 0f)) ? (Mathf.Exp(num5 * 9f) * 0.55f) : Mathf.Exp((0f - num5) * num5 * 1400f)); num6 *= Mathf.Clamp01((1f - num3) * 12f); ref Color32 reference = ref array[i * size + j]; reference = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)Mathf.RoundToInt(Mathf.Clamp01(num6) * 255f)); } } val.SetPixels32(array); val.Apply(false); return val; } private static Texture2D MakeSpark(int size) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) Texture2D val = NewTex(size, "BeamFxSpark"); Color32[] array = (Color32[])(object)new Color32[size * size]; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = ((float)j + 0.5f) / (float)size * 2f - 1f; float num2 = ((float)i + 0.5f) / (float)size * 2f - 1f; float num3 = Mathf.Sqrt(num * num + num2 * num2); float num4 = Mathf.Clamp01(1f - num3); num4 = num4 * num4 * (3f - 2f * num4); ref Color32 reference = ref array[i * size + j]; reference = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)Mathf.RoundToInt(num4 * 255f)); } } val.SetPixels32(array); val.Apply(false); return val; } private static float Hash(int x, int y, int seed) { int num = x * 374761393 + y * 668265263 + seed * 1274126177; num = (num ^ (num >> 13)) * 1274126177; num ^= num >> 16; return (float)(num & 0xFFFFFF) / 16777216f; } private static float ValueNoise(float x, float y, int seed) { int num = Mathf.FloorToInt(x); int num2 = Mathf.FloorToInt(y); float num3 = x - (float)num; float num4 = y - (float)num2; num3 = num3 * num3 * (3f - 2f * num3); num4 = num4 * num4 * (3f - 2f * num4); float num5 = Hash(num, num2, seed); float num6 = Hash(num + 1, num2, seed); float num7 = Hash(num, num2 + 1, seed); float num8 = Hash(num + 1, num2 + 1, seed); return Mathf.Lerp(Mathf.Lerp(num5, num6, num3), Mathf.Lerp(num7, num8, num3), num4); } private static AudioClip GetBoom() { if ((Object)(object)s_boom != (Object)null) { return s_boom; } int num = 52920; float[] array = new float[num]; Random random = new Random(1337); float num2 = 0f; float num3 = 0f; for (int i = 0; i < num; i++) { float num4 = (float)i / 22050f; float num5 = (float)(random.NextDouble() * 2.0 - 1.0); float num6 = 0.03f + 0.5f * Mathf.Exp((0f - num4) * 7f); num2 += num6 * (num5 - num2); num3 += num6 * (num2 - num3); float num7 = Mathf.Clamp01(num4 / 0.004f); float num8 = num3 * 3.2f * Mathf.Exp((0f - num4) * 2.2f) * num7; float num9 = (float)Math.PI * 2f * (35f * num4 + 55f * (1f - Mathf.Exp(-6f * num4)) / 6f); float num10 = Mathf.Sin(num9) * 0.9f * Mathf.Exp((0f - num4) * 3.5f) * num7; array[i] = (float)Math.Tanh(num8 + num10); } float num11 = 0f; for (int j = 0; j < num; j++) { num11 = Mathf.Max(num11, Mathf.Abs(array[j])); } int num12 = 1102; for (int k = 0; k < num; k++) { float num13 = ((!(num11 > 0f)) ? 1f : (0.95f / num11)); if (k > num - num12) { num13 *= (float)(num - k) / (float)num12; } array[k] *= num13; } s_boom = AudioClip.Create("BeamBoom", num, 1, 22050, false); s_boom.SetData(array, 0); return s_boom; } } [RequireComponent(typeof(BallisticProjectile))] public class BeamProjectile : MonoBehaviour { [Header("Beam")] [Tooltip("How far the beam reaches (metres)")] public float MaxRange = 1500f; [Tooltip("If on, the beam goes straight through walls and floors too")] public bool PierceWorld = false; [Tooltip("Anything this close to the muzzle is the gun / shooter and is ignored (metres)")] public float IgnoreNearDistance = 0.35f; [Tooltip("Loose rigidbodies lighter than this do not stop the beam (kg)")] public float LooseClutterMass = 2f; [Header("Damage")] [Tooltip("Sosigs hit by the beam are vaporised")] public bool VaporizeSosigs = true; [Tooltip("Damage dealt to every hit AutoMeater hit zone (it is plenty to destroy one)")] public float AutoMeaterDamage = 1000000f; [Tooltip("Damage dealt to everything else that can be damaged (targets, watermelons, props, glass...). The game's own bullet damage is not used because this projectile type carries none")] public float ObjectDamage = 1000000f; [Tooltip("If on, the beam keeps going after damaging a target / prop (like it does for Sosigs). Off = it stops at the first damageable thing")] public bool PierceDamageables = true; [Tooltip("The beam keeps vaporising everything it touches for as long as it exists, so sweeping the gun cuts through enemies. Off = only what the beam hit at the moment of firing")] public bool SweepDamage = true; [Tooltip("When the beam moves fast, extra rays are cast through the arc it swept so enemies in between are not skipped. One ray per this many degrees")] public float SweepStepDegrees = 0.5f; [Tooltip("Most rays cast in a single frame for a sweep (limits the cost of very fast swings)")] public int MaxSweepSteps = 32; [Header("Hurts everyone (used by the volatile explosion beams)")] [Tooltip("Ignore the IFF check, so the beam vaporises friendly Sosigs too")] public bool HurtEveryone = false; [Tooltip("The beam damages the player if it passes through their hitboxes")] public bool HurtPlayer = false; [Tooltip("Damage dealt to the player by one beam (once per beam)")] public float PlayerDamage = 25000f; [Tooltip("A player hitbox this close to the beam's line counts as hit (metres)")] public float PlayerHitRadius = 0.3f; [Tooltip("Set off for the extra beams of an explosion so the volley is not a wall of blaster noise")] public bool PlayBlasterSound = true; public static bool SuppressFollowSearch; [Header("Look")] [Tooltip("The beam stays attached to the gun's muzzle (moving and turning with it) for as long as it exists, instead of hanging in space where it was fired")] public bool FollowBarrel = true; [Tooltip("If this bullet is fired and there is no gun at its spawn point (nothing within 1.5 m to follow), it explodes on the spot instead of firing a beam")] public bool ExplodeWhenNotInGun = true; [Tooltip("The volatile round that supplies the explosion (blast, beams, flash, boom). Drag the VolatileRound component of Ammo_Beam50BMG here")] public VolatileRound ExplosionSource; public Material GlowMaterial; public Material BodyMaterial; public Material CoreMaterial; [Tooltip("Multiplies all the beam widths below (1 = as set, 2 = twice as big). Was 2; now 1, which is half the old width")] public float BeamScale = 1f; [Tooltip("Real bloom: multiplies the brightness of the layers' material colours above 1 so the game's bloom effect picks the beam up. Raise for more bloom, lower if it washes out to white")] public float HDRIntensity = 3f; [Tooltip("No longer used: the flat bloom halo layer was removed when the beam became 3D tubes")] public float BloomWidthMultiplier = 3f; [Tooltip("The beam starts this thin at the muzzle, as a fraction of full width (0 = a point), and widens to full size as it leaves the barrel")] [Range(0f, 1f)] public float MuzzleStartWidth = 0.1f; [Tooltip("Distance from the muzzle (metres) at which the beam reaches full width. Fixed in metres: it does not depend on how long the beam is. Larger = a longer, gentler flare")] public float MuzzleTaperDistance = 1.5f; [Tooltip("How steeply the beam widens just after the muzzle. 1 = straight line, 3 = most of the width within the first third of the taper distance, higher = even quicker")] public float MuzzleTaperSharpness = 3f; [Tooltip("Seconds the beam takes to shrink away")] public float BeamLifetime = 0.55f; [Tooltip("Full width of the red glow / the red beam / the white-hot core (metres)")] public float GlowWidth = 0.2f; public float BodyWidth = 0.085f; public float CoreWidth = 0.024f; [Tooltip("Tint of each layer. Applied as line vertex colour and to the material's colour property (_Color, _TintColor, _BaseColor, _EmissionColor) when it has one. Lower the alpha / brightness if the beam still washes out to white")] public Color BloomColor = new Color(1f, 0.05f, 0.03f, 0.12f); public Color GlowColor = new Color(1f, 0f, 0f, 0.3f); public Color BodyColor = new Color(1f, 0.02f, 0.02f, 0.85f); public Color CoreColor = new Color(1f, 1f, 1f, 1f); public Color LightColor = new Color(1f, 0.08f, 0.05f, 1f); public float LightIntensity = 6f; public float LightRange = 20f; [Header("Red light along the whole beam")] [Tooltip("Most point lights spread along the beam's length. They light everything the beam passes in bright red, not just the muzzle. 0 = off")] public int PathLightCount = 32; [Tooltip("Closest the lights sit to each other (metres), right next to the viewer")] public float PathLightSpacing = 1f; [Tooltip("Spacing grows with distance from the viewer: gap = distance x this. Smaller = tighter, no visible gaps, but more lights. It is raised automatically when the light count would run out")] public float PathLightAngularSpacing = 0.3f; [Tooltip("Smallest reach of each light (metres). Lights further from the viewer reach further, up to the max")] public float PathLightRange = 12f; [Tooltip("Largest reach of a light (metres), used for the far parts of a long beam")] public float PathLightMaxRange = 400f; [Tooltip("How many gaps each light reaches over. Higher = smoother blending between lights")] public float PathLightOverlap = 4f; [Tooltip("Brightness of each light")] public float PathLightIntensity = 6f; [Tooltip("Only lights this close to the viewer (metres) are forced to pixel quality, the rest are left to the engine")] public float PathLightImportantDistance = 40f; public Color PathLightColor = new Color(1f, 0.02f, 0.02f, 1f); [Tooltip("The lights always draw as pixel lights, so they win over the game's other lights. Costs more on a busy scene, so it is off for the explosion beams")] public bool PathLightsImportant = true; [Tooltip("Path lights on each of the explosion's beams (there are many of those beams, so keep this low)")] public int BurstPathLightCount = 4; [Header("Blaster sound (plays on top of the gun's own firing sound)")] [Tooltip("One of these is picked at random every time the beam fires. Leave the list empty for no extra sound")] public AudioClip[] BlasterShots; [Range(0f, 1f)] public float BlasterVolume = 0.9f; [Tooltip("Each shot's pitch is randomised between 1 - this and 1 + this, so repeats do not sound identical")] public float BlasterPitchVariation = 0.04f; [Tooltip("Distance where the blaster is at full volume, metres")] public float BlasterMinDistance = 4f; [Tooltip("Distance where it can no longer be heard, metres")] public float BlasterMaxDistance = 250f; private static int s_lastShot = -1; private readonly List<IFVRDamageable> m_hitDamageables = new List<IFVRDamageable>(); private BallisticProjectile m_projectile; private bool m_done; private bool m_playerHurt; private Vector3 m_spawnPos; private Vector3 m_spawnForward; private Transform m_followAnchor; private Vector3 m_anchorLocalPos; private Quaternion m_anchorRotAtSpawn; private const float FollowSearchRadius = 1.5f; private static bool s_resolved; private static FieldInfo s_forwardField; private static FieldInfo s_velocityField; private const int SosigDead = 3; private const int MeaterDead = 4; private static FieldInfo s_meaterState; private readonly List<Sosig> m_hitSosigs = new List<Sosig>(); private readonly List<AutoMeater> m_hitMeaters = new List<AutoMeater>(); private static FieldInfo[] s_damFields = new FieldInfo[0]; private static FieldInfo[] s_maskFields = new FieldInfo[0]; private static readonly Collider[] s_gunBuffer = (Collider[])(object)new Collider[128]; private static readonly Comparison<RaycastHit> s_hitCompare = (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance); private static readonly Collider[] s_nearBuffer = (Collider[])(object)new Collider[48]; private void Awake() { //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_0025: 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) m_projectile = ((Component)this).GetComponent<BallisticProjectile>(); m_spawnPos = ((Component)this).transform.position; m_spawnForward = ((Component)this).transform.forward; if (FollowBarrel && !SuppressFollowSearch) { FindFollowAnchor(); } if ((Object)(object)m_projectile != (Object)null) { ((Behaviour)m_projectile).enabled = false; } ResolveFields(); ZeroBulletDamage(); } private void ZeroBulletDamage() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)m_projectile == (Object)null)) { for (int i = 0; i < s_damFields.Length; i++) { s_damFields[i].SetValue(m_projectile, 0f); } for (int j = 0; j < s_maskFields.Length; j++) { s_maskFields[j].SetValue(m_projectile, LayerMask.op_Implicit(0)); } } } private static void ResolveFields() { if (s_resolved) { return; } s_resolved = true; BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; List<FieldInfo> list = new List<FieldInfo>(); List<FieldInfo> list2 = new List<FieldInfo>(); FieldInfo[] fields = typeof(BallisticProjectile).GetFields(bindingAttr); for (int i = 0; i < fields.Length; i++) { if ((object)fields[i].FieldType == typeof(float) && fields[i].Name.StartsWith("Dam_")) { list.Add(fields[i]); } else if ((object)fields[i].FieldType == typeof(LayerMask)) { list2.Add(fields[i]); } } s_damFields = list.ToArray(); s_maskFields = list2.ToArray(); s_forwardField = typeof(BallisticProjectile).GetField("m_forward", bindingAttr); s_velocityField = typeof(BallisticProjectile).GetField("m_velocity", bindingAttr); s_meaterState = typeof(AutoMeater).GetField("m_state", bindingAttr); } private void Update() { //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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0116: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00e6: 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_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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (m_done) { return; } m_done = true; if ((Object)(object)m_projectile != (Object)null) { ((Behaviour)m_projectile).enabled = false; } Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } Vector3 spawnPos = m_spawnPos; Vector3 shotDirection = GetShotDirection(); if (FollowBarrel && ExplodeWhenNotInGun && !SuppressFollowSearch && (Object)(object)m_followAnchor == (Object)null && (Object)(object)ExplosionSource != (Object)null) { ExplodeInPlace(spawnPos, shotDirection); return; } RaycastBeam(spawnPos, shotDirection, out var end); if ((Object)(object)m_followAnchor != (Object)null) { Vector3 localDir = Quaternion.Inverse(m_anchorRotAtSpawn) * shotDirection; BeamVisual.Spawn(spawnPos, end, this, m_followAnchor, m_anchorLocalPos, localDir); } else { BeamVisual.Spawn(spawnPos, end, this); } PlayBlasterShot(spawnPos); Object.Destroy((Object)(object)((Component)this).gameObject, Mathf.Max(BeamLifetime, 0.02f) + 1f); } private void ExplodeInPlace(Vector3 origin, Vector3 dir) { //IL_0007: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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) VolatileRound volatileRound = Object.Instantiate<VolatileRound>(ExplosionSource, origin, Quaternion.LookRotation(dir)); volatileRound.Explode(origin, -dir); Object.Destroy((Object)(object)((Component)this).gameObject); } public void ConfigureBurst(Vector3 origin, Vector3 dir, float widthScale, float lifetime, float range, float playerDamage, bool playSound, float soundVolumeScale) { //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_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) m_spawnPos = origin; m_spawnForward = dir; m_followAnchor = null; FollowBarrel = false; SweepDamage = false; IgnoreNearDistance = 0.02f; MaxRange = range; BeamScale *= widthScale; BeamLifetime = lifetime; LightIntensity = 0f; PathLightCount = BurstPathLightCount; PathLightsImportant = false; HurtEveryone = true; HurtPlayer = true; PlayerDamage = playerDamage; PlayBlasterSound = playSound; BlasterVolume = Mathf.Clamp01(BlasterVolume * soundVolumeScale); } public Vector3 SweepBeam(Vector3 prevOrigin, Vector3 prevDir, Vector3 origin, Vector3 dir) { //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_0036: 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_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_0049: 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_005c: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Angle(prevDir, dir); float num2 = Mathf.Max(SweepStepDegrees, 0.05f); int num3 = Mathf.Clamp(Mathf.CeilToInt(num / num2), 1, Mathf.Max(MaxSweepSteps, 1)); Vector3 result = origin + dir * MaxRange; for (int i = 1; i <= num3; i++) { float num4 = (float)i / (float)num3; Vector3 origin2 = Vector3.Lerp(prevOrigin, origin, num4); Vector3 dir2 = Vector3.Slerp(prevDir, dir, num4); RaycastBeam(origin2, dir2, out var end); if (i == num3) { result = end; } } return result; } private void FindFollowAnchor() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_010f: Unknown result type (might be due to invalid IL or missing references) Transform best = null; float bestSqr = 2.25f; int num = Physics.OverlapSphereNonAlloc(m_spawnPos, 1.5f, s_gunBuffer, -1, (QueryTriggerInteraction)2); FVRFireArm val = null; for (int i = 0; i < num; i++) { FVRFireArm val2 = ((!((Object)(object)s_gunBuffer[i] != (Object)null)) ? null : ((Component)s_gunBuffer[i]).GetComponentInParent<FVRFireArm>()); if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2 == (Object)(object)val)) { val = val2; ConsiderGun(val2, ref best, ref bestSqr); } } if ((Object)(object)best == (Object)null) { FVRFireArm[] array = Object.FindObjectsOfType<FVRFireArm>(); for (int j = 0; j < array.Length; j++) { if ((Object)(object)array[j] != (Object)null) { ConsiderGun(array[j], ref best, ref bestSqr); } } } if (!((Object)(object)best == (Object)null)) { m_followAnchor = best; m_anchorLocalPos = best.InverseTransformPoint(m_spawnPos); m_anchorRotAtSpawn = best.rotation; } } private void ConsiderGun(FVRFireArm gun, ref Transform best, ref float bestSqr) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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) Transform val = ((!((Object)(object)gun.MuzzlePos != (Object)null)) ? ((Component)gun).transform : gun.MuzzlePos); Vector3 val2 = val.position - m_spawnPos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < bestSqr) { bestSqr = sqrMagnitude; best = val; } } private void PlayBlasterShot(Vector3 position) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (PlayBlasterSound && BlasterShots != null && BlasterShots.Length != 0) { int num = Random.Range(0, BlasterShots.Length); if (BlasterShots.Length > 1 && num == s_lastShot) { num = (num + 1) % BlasterShots.Length; } s_lastShot = num; AudioClip val = BlasterShots[num]; if (!((Object)(object)val == (Object)null)) { float num2 = 1f + Random.Range(0f - BlasterPitchVariation, BlasterPitchVariation); GameObject val2 = new GameObject("BeamBlasterShot"); val2.transform.position = position; AudioSource val3 = val2.AddComponent<AudioSource>(); val3.clip = val; val3.volume = BlasterVolume; val3.pitch = num2; val3.spatialBlend = 1f; val3.dopplerLevel = 0f; val3.rolloffMode = (AudioRolloffMode)1; val3.minDistance = BlasterMinDistance; val3.maxDistance = BlasterMaxDistance; val3.playOnAwake = false; val3.Play(); Object.Destroy((Object)(object)val2, val.length / num2 + 0.25f); } } } private Vector3 GetShotDirection() { //IL_002c: 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_0031: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_00d2: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((!(((Vector3)(ref m_spawnForward)).sqrMagnitude > 0.01f)) ? ((Component)this).transform.forward : ((Vector3)(ref m_spawnForward)).normalized); Vector3 val2 = Vector3.zero; if ((Object)(object)m_projectile != (Object)null) { if ((object)s_forwardField != null) { val2 = (Vector3)s_forwardField.GetValue(m_projectile); } if (((Vector3)(ref val2)).sqrMagnitude < 0.5f && (object)s_velocityField != null) { val2 = (Vector3)s_velocityField.GetValue(m_projectile); } } if (((Vector3)(ref val2)).sqrMagnitude > 0.01f && Vector3.Angle(val, val2) < 10f) { return ((Vector3)(ref val2)).normalized; } return val; } private void RaycastBeam(Vector3 origin, Vector3 dir, out Vector3 end) { //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_0021: 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_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) RaycastBeamWorld(origin, dir, out end); if (HurtPlayer && !m_playerHurt) { FVRPlayerHitbox val = PlayerHarm.NearestToSegment(origin, end, PlayerHitRadius); if ((Object)(object)val != (Object)null) { m_playerHurt = true; PlayerHarm.Hurt(val, PlayerDamage, ((Component)val).transform.position, dir); } } } private void RaycastBeamWorld(Vector3 origin, Vector3 dir, out Vector3 end) { //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_000a: 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_003d: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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_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) end = origin + dir * MaxRange; int num = (((Object)(object)m_projectile != (Object)null) ? m_projectile.Source_IFF : 0); HitNearMuzzle(origin, dir, num); RaycastHit[] array = Physics.RaycastAll(origin, dir, MaxRange, -1, (QueryTriggerInteraction)1); if (array.Length == 0) { return; } Array.Sort(array, s_hitCompare); for (int i = 0; i < array.Length; i++) { Collider collider = ((RaycastHit)(ref array[i])).collider; if ((Object)(object)collider == (Object)null || HitLivingTarget(collider, ((RaycastHit)(ref array[i])).point, dir, num) || ((RaycastHit)(ref array[i])).distance < IgnoreNearDistance) { continue; } FVRPhysicalObject componentInParent = ((Component)collider).GetComponentInParent<FVRPhysicalObject>(); if (((Object)(object)componentInParent != (Object)null && (componentInParent is FVRFireArm || ((FVRInteractiveObject)componentInParent).IsHeld)) || (Object)(object)((Component)collider).GetComponentInParent<FVRPlayerHitbox>() != (Object)null) { continue; } IFVRDamageable val = FindDamageable(collider); if (val != null) { if (!m_hitDamageables.Contains(val)) { m_hitDamageables.Add(val); val.Damage(MakeObjectDamage(((RaycastHit)(ref array[i])).point, ((RaycastHit)(ref array[i])).normal, dir, num)); } if (PierceDamageables) { continue; } } else if ((Object)(object)collider.attachedRigidbody != (Object)null && !collider.attachedRigidbody.isKinematic && collider.attachedRigidbody.mass < LooseClutterMass) { continue; } if (PierceWorld) { continue; } end = ((RaycastHit)(ref array[i])).point; break; } } private void HitNearMuzzle(Vector3 origin, Vector3 dir, int sourceIFF) { //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_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_0012: 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_0014: 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_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_0031: 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_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) Vector3 val = origin - dir * 0.1f; Vector3 val2 = origin + dir * Mathf.Max(IgnoreNearDistance, 0.15f); int num = Physics.OverlapCapsuleNonAlloc(val, val2, 0.1f, s_nearBuffer, -1, (QueryTriggerInteraction)1); for (int i = 0; i < num; i++) { Collider val3 = s_nearBuffer[i]; if (!((Object)(object)val3 == (Object)null)) { HitLivingTarget(val3, val3.ClosestPointOnBounds(origin), dir, sourceIFF); } } } private bool HitLivingTarget(Collider col, Vector3 point, Vector3 dir, int sourceIFF) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) SosigLink componentInParent = ((Component)col).GetComponentInParent<SosigLink>(); if ((Object)(object)componentInParent != (Object)null) { Sosig s = componentInParent.S; if ((Object)(object)s != (Object)null && !m_hitSosigs.Contains(s)) { m_hitSosigs.Add(s); if ((HurtEveryone || s.GetIFF() != sourceIFF) && VaporizeSosigs) { componentInParent.Vaporize(sourceIFF); } } return true; } AutoMeater componentInParent2 = ((Component)col).GetComponentInParent<AutoMeater>(); if ((Object)(object)componentInParent2 != (Object)null) { if (!m_hitMeaters.Contains(componentInParent2)) { m_hitMeaters.Add(componentInParent2); if (IsMeaterAlive(componentInParent2)) { DestroyMeater(componentInParent2, col, point, dir, sourceIFF); } } return true; } return false; } private static bool IsMeaterAlive(AutoMeater meater) { if ((object)s_meaterState == null) { return true; } object value = s_meaterState.GetValue(meater); return value == null || (int)value != 4; } private void DestroyMeater(AutoMeater meater, Collider struck, Vector3 point, Vector3 dir, int iff) { //IL_0016: 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_004e: 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) AutoMeaterHitZone componentInParent = ((Component)struck).GetComponentInParent<AutoMeaterHitZone>(); if ((Object)(object)componentInParent != (Object)null) { componentInParent.Damage(MakeDamage(point, dir, iff)); } if ((Object)(object)meater.TerminalHitZone != (Object)null && (Object)(object)meater.TerminalHitZone != (Object)(object)componentInParent) { meater.TerminalHitZone.Damage(MakeDamage(point, dir, iff)); } } private static IFVRDamageable FindDamageable(Collider col) { IFVRDamageable val = null; if ((Object)(object)col.attachedRigidbody != (Object)null) { val = ((Component)col.attachedRigidbody).gameObject.GetComponent<IFVRDamageable>(); } if (val == null) { val = ((Component)col).GetComponent<IFVRDamageable>(); } if (val == null) { val = ((Component)col).GetComponentInParent<IFVRDamageable>(); } return val; } private Damage MakeObjectDamage(Vector3 point, Vector3 normal, Vector3 dir, int iff) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) Damage val = new Damage(); val.Class = (DamageClass)1; val.Dam_Blunt = ObjectDamage; val.Dam_Piercing = ObjectDamage; val.Dam_Cutting = ObjectDamage; val.Dam_TotalKinetic = ObjectDamage; val.Dam_Thermal = ObjectDamage; val.Dam_TotalEnergetic = ObjectDamage; val.point = point; val.hitNormal = normal; val.strikeDir = dir; val.damageSize = 0.2f; val.Source_IFF = iff; return val; } private Damage MakeDamage(Vector3 point, Vector3 dir, int iff) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0009: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0052: 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) Damage val = new Damage(); val.Class = (DamageClass)1; val.Dam_Piercing = AutoMeaterDamage; val.Dam_TotalKinetic = AutoMeaterDamage; val.Dam_Thermal = AutoMeaterDamage; val.Dam_TotalEnergetic = AutoMeaterDamage; val.point = point; val.hitNormal = -dir; val.strikeDir = dir; val.damageSize = 0.05f; val.Source_IFF = iff; return val; } } public class BeamVisual : MonoBehaviour { private static readonly string[] ColorProps = new string[4] { "_Color", "_TintColor", "_BaseColor", "_EmissionColor" }; private const int FlareRings = 14; private const int Sides = 12; private const int Layers = 5; private Transform[] m_flareT; private Transform[] m_shaftT; private MeshRenderer[] m_shaftR; private Mesh[] m_flareMeshes; private Mesh[] m_shaftMeshes; private float m_sharp; private float m_flareLen; private float[] m_widths; private readonly Material[] m_instances = (Material[])(object)new Material[5]; private Light m_light; private float m_lightIntensity; private Light[] m_pathLights; private float m_pathMinSpacing; private float m_pathAngular; private float m_pathMinRange; private float m_pathMaxRange; private float m_pathOverlap; private float m_pathIntensity; private float m_pathImportantDist; private bool m_pathImportant; private float[] m_pathT; private float[] m_pathGap; private Camera m_cam; private float m_fade = 1f; private float m_lifetime; private float m_age; private Vector3 m_origin; private Vector3 m_end; private Transform m_follow; private Vector3 m_localOrigin; private Vector3 m_localDir; private float m_length; private BeamProjectile m_owner; private Vector3 m_dir; private Vector3 m_prevOrigin; private Vector3 m_prevDir; private float m_taper; private float m_startWidth; private float m_shrink = 1f; public static BeamVisual Spawn(Vector3 origin, Vector3 end, BeamProjectile s, Transform follow = null, Vector3 localOrigin = default(Vector3), Vector3 localDir = default(Vector3)) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0012: 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) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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) GameObject val = new GameObject("BeamVisual"); val.transform.position = origin; BeamVisual beamVisual = val.AddComponent<BeamVisual>(); beamVisual.m_owner = s; beamVisual.m_follow = follow; beamVisual.m_localOrigin = localOrigin; beamVisual.m_localDir = localDir; beamVisual.Build(origin, end, s); return beamVisual; } private void Build(Vector3 origin, Vector3 end, BeamProjectile s) { //IL_0018: 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_001f: 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_0026: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Expected O, but got Unknown //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Expected O, but got Unknown //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Expected O, but got Unknown //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Expected O, but got Unknown //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Expected O, but got Unknown //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Expected O, but got Unknown //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_062c: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) m_lifetime = Mathf.Max(s.BeamLifetime, 0.02f); m_origin = origin; m_end = end; float num = (m_length = Vector3.Distance(origin, end)); m_taper = Mathf.Max(s.MuzzleTaperDistance, 0.05f); m_startWidth = Mathf.Clamp01(s.MuzzleStartWidth); m_sharp = Mathf.Max(s.MuzzleTaperSharpness, 1f); m_flareLen = Mathf.Min(num, m_taper); if ((Object)(object)m_follow != (Object)null) { Vector3 val = m_follow.TransformDirection(m_localDir); m_dir = ((Vector3)(ref val)).normalized; } else { m_dir = ((!(num > 0.01f)) ? ((Component)s).transform.forward : ((end - origin) / num)); } m_prevOrigin = origin; m_prevDir = m_dir; m_flareT = (Transform[])(object)new Transform[5]; m_shaftT = (Transform[])(object)new Transform[5]; m_shaftR = (MeshRenderer[])(object)new MeshRenderer[5]; m_flareMeshes = (Mesh[])(object)new Mesh[5]; m_shaftMeshes = (Mesh[])(object)new Mesh[5]; float beamScale = s.BeamScale; float num2 = Mathf.Lerp(s.CoreWidth, s.BodyWidth, 0.25f); m_widths = new float[5] { s.GlowWidth * beamScale * 1.8f, s.GlowWidth * beamScale, s.BodyWidth * beamScale, num2 * beamScale, s.CoreWidth * beamScale }; Material[] array = (Material[])(object)new Material[5] { s.GlowMaterial, s.GlowMaterial, s.BodyMaterial, s.BodyMaterial, s.CoreMaterial }; string[] array2 = new string[5] { "Halo", "Glow", "Body", "Inner", "Core" }; Color val2 = Color.Lerp(s.BodyColor, s.CoreColor, 0.25f); val2.a = 0.4f; Color glowColor = s.GlowColor; glowColor.a = s.GlowColor.a * 0.35f; Color[] array3 = (Color[])(object)new Color[5] { glowColor, s.GlowColor, s.BodyColor, val2, s.CoreColor }; Color val4 = default(Color); for (int i = 0; i < 5; i++) { Material val3 = null; if ((Object)(object)array[i] != (Object)null) { val3 = new Material(array[i]); float num3 = s.HDRIntensity * i switch { 4 => 2.2f, 3 => 1.3f, 2 => 1.6f, _ => 1f, }; ((Color)(ref val4))..ctor(array3[i].r * num3, array3[i].g * num3, array3[i].b * num3, array3[i].a); val3.SetOverrideTag("RenderType", "Transparent"); val3.EnableKeyword("_ALPHABLEND_ON"); val3.DisableKeyword("_ALPHATEST_ON"); val3.DisableKeyword("_ALPHAPREMULTIPLY_ON"); if (val3.HasProperty("_Mode")) { val3.SetFloat("_Mode", 2f); } if (val3.HasProperty("_SrcBlend")) { val3.SetInt("_SrcBlend", 5); } if (val3.HasProperty("_DstBlend")) { val3.SetInt("_DstBlend", 1); } if (val3.HasProperty("_ZWrite")) { val3.SetInt("_ZWrite", 0); } for (int j = 0; j < ColorProps.Length; j++) { if (val3.HasProperty(ColorProps[j])) { val3.SetColor(ColorProps[j], val4); } } val3.renderQueue = 3000 + i; m_instances[i] = val3; } GameObject val5 = new GameObject(array2[i] + "Flare"); val5.transform.SetParent(((Component)this).transform, false); m_flareMeshes[i] = new Mesh(); ((Object)m_flareMeshes[i]).name = array2[i] + "FlareMesh"; FillTube(m_flareMeshes[i], 14, GetFlareRadii(i, m_flareLen), 1f); val5.AddComponent<MeshFilter>().sharedMesh = m_flareMeshes[i]; SetupRenderer(val5.AddComponent<MeshRenderer>(), val3); m_flareT[i] = val5.transform; GameObject val6 = new GameObject(array2[i] + "Shaft"); val6.transform.SetParent(((Component)this).transform, false); m_shaftMeshes[i] = new Mesh(); ((Object)m_shaftMeshes[i]).name = array2[i] + "ShaftMesh"; float[] radii = new float[2] { m_widths[i] * 0.5f, m_widths[i] * 0.5f }; FillTube(m_shaftMeshes[i], 2, radii, 1f); val6.AddComponent<MeshFilter>().sharedMesh = m_shaftMeshes[i]; MeshRenderer val7 = val6.AddComponent<MeshRenderer>(); SetupRenderer(val7, val3); m_shaftT[i] = val6.transform; m_shaftR[i] = val7; } if (s.LightIntensity > 0f) { GameObject val8 = new GameObject("BeamLight"); val8.transform.SetParent(((Component)this).transform, false); Transform transform = val8.transform; Vector3 val9 = end - origin; transform.position = origin + ((Vector3)(ref val9)).normalized * Mathf.Min(1f, num); m_light = val8.AddComponent<Light>(); m_light.type = (LightType)2; m_light.color = s.LightColor; m_light.range = s.LightRange; m_light.intensity = s.LightIntensity; m_light.shadows = (LightShadows)0; m_lightIntensity = s.LightIntensity; } BuildPathLights(s); UpdatePathLights(); PlaceTubes(); } private void BuildPathLights(BeamProjectile s) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) if (s.PathLightCount > 0 && !(s.PathLightIntensity <= 0f)) { m_pathMinSpacing = Mathf.Max(s.PathLightSpacing, 0.25f); m_pathAngular = Mathf.Max(s.PathLightAngularSpacing, 0.05f); m_pathMinRange = Mathf.Max(s.PathLightRange, 1f); m_pathMaxRange = Mathf.Max(s.PathLightMaxRange, m_pathMinRange); m_pathOverlap = Mathf.Max(s.PathLightOverlap, 1.5f); m_pathIntensity = s.PathLightIntensity; m_pathImportantDist = Mathf.Max(s.PathLightImportantDistance, 1f); m_pathImportant = s.PathLightsImportant; m_pathLights = (Light[])(object)new Light[s.PathLightCount]; m_pathT = new float[s.PathLightCount]; m_pathGap = new float[s.PathLightCount]; for (int i = 0; i < m_pathLights.Length; i++) { GameObject val = new GameObject("PathLight" + i); val.transform.SetParent(((Component)this).transform, false); Light val2 = val.AddComponent<Light>(); val2.type = (LightType)2; val2.color = s.PathLightColor; val2.range = m_pathMinRange; val2.intensity = m_pathIntensity; val2.shadows = (LightShadows)0; val2.renderMode = (LightRenderMode)0; m_pathLights[i] = val2; } } } private Vector3 ViewerPosition() { //IL_006d: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)m_cam == (Object)null) { m_cam = Camera.main; } if ((Object)(object)m_cam == (Object)null && Camera.allCamerasCount > 0) { m_cam = Camera.allCameras[0]; } return (!((Object)(object)m_cam != (Object)null)) ? m_origin : ((Component)m_cam).transform.position; } private float GapAt(float t, float t0, float h, float angular) { float num = t - t0; float num2 = Mathf.Sqrt(h * h + num * num); return Mathf.Max(m_pathMinSpacing, angular * num2); } private int PlaceLights(float t0, float h, float angular, int max) { int num = 0; float num2 = GapAt(t0, t0, h, angular); m_pathT[num] = t0; m_pathGap[num] = num2; num++; float num3 = t0; float num4 = num2; for (int i = -1; i <= 1; i += 2) { float num5 = t0; float num6 = num2; while (true) { float num7 = num5 + (float)i * num6; if ((i >= 0) ? (num7 >= m_length - 0.05f) : (num7 <= 0.05f)) { break; } if (num >= max) { return -1; } num6 = GapAt(num7, t0, h, angular); m_pathT[num] = num7; m_pathGap[num] = num6; num++; num5 = num7; if (i > 0) { num3 = num5; num4 = num6; } } } if (m_length - num3 > 0.5f * num4) { if (num >= max) { return -1; } float num8 = Mathf.Max(0f, m_length - 0.75f); m_pathT[num] = num8; m_pathGap[num] = GapAt(num8, t0, h, angular); num++; } return num; } private void UpdatePathLights() { //IL_001b: 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_0021: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0057: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) if (m_pathLights == null) { return; } int num = m_pathLights.Length; Vector3 val = ViewerPosition(); float num2 = Mathf.Clamp(Vector3.Dot(val - m_origin, m_dir), 0f, m_length); float num3 = Vector3.Distance(val, m_origin + m_dir * num2); int num4 = -1; float num5 = m_pathAngular; for (int i = 0; i < 16; i++) { if (num4 >= 0) { break; } num4 = PlaceLights(num2, num3, num5, num); num5 *= 1.3f; } if (num4 < 0) { num4 = 1; } for (int j = 0; j < num; j++) { Light val2 = m_pathLights[j]; if ((Object)(object)val2 == (Object)null) { continue; } if (j >= num4) { ((Behaviour)val2).enabled = false; continue; } float num6 = m_pathT[j]; float num7 = m_pathGap[j]; float num8 = Mathf.Clamp(num7 * m_pathOverlap, m_pathMinRange, m_pathMaxRange); float num9 = Mathf.Clamp(m_pathOverlap * num7 / num8, 0.1f, 3f); ((Behaviour)val2).enabled = true; ((Component)val2).transform.position = m_origin + m_dir * num6; val2.range = num8; val2.intensity = m_pathIntensity * num9 * m_fade; float num10 = num6 - num2; LightRenderMode val3 = (LightRenderMode)((m_pathImportant && Mathf.Sqrt(num3 * num3 + num10 * num10) <= m_pathImportantDist) ? 1 : 0); if (val2.renderMode != val3) { val2.renderMode = val3; } } } private static void SetupRenderer(MeshRenderer r, Material m) { ((Renderer)r).sharedMaterial = m; ((Renderer)r).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)r).receiveShadows = false; } private float[] GetFlareRadii(int layer, float flareLen) { float[] array = new float[14]; for (int i = 0; i < 14; i++) { float num = (float)i / 13f; float num2 = Mathf.Clamp01(num * flareLen / m_taper); float num3 = 1f - Mathf.Pow(1f - num2, m_sharp); array[i] = 0.5f * m_widths[layer] * Mathf.Lerp(m_startWidth, 1f, num3); } return array; } private static void FillTube(Mesh m, int rings, float[] radii, float length) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_01d1: Unknown result type (might be due to invalid IL or mis