Decompiled source of H3ZM LaserMine v1.0.0
H3ZM_LaserMine.dll
Decompiled 4 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using Sodalite.Api; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.Serialization; [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 quaternion.H3ZM_LaserMine; [AddComponentMenu("H3ZM/Laser Mine")] public class LaserMine : FVRPhysicalObject, IFVRDamageable { [Header("State")] public bool IsPlanted; public bool IsArmed; public LaserMineBatterySocket BatterySocket; public LaserMineSwitch ArmSwitch; [Header("Placement")] public Transform PlacementProbe; [Tooltip("Surfaces the mine can attach to.")] public LayerMask PlacementLayerMask = LayerMask.op_Implicit(-1); public float PlacementRayLength = 0.12f; public float PlacementRayInset = 0.02f; public float PlacementSurfaceOffset = 0.02f; public bool RequireStaticPlacementCollider = true; public bool ArmWhenPlanted = true; public float ActivationDelaySeconds = 1f; [Header("Audio")] [FormerlySerializedAs("AudEvent_ArmBeep")] public AudioEvent AudEvent_Plant; public AudioEvent AudEvent_ChargeUp; [FormerlySerializedAs("AudEvent_Activation")] public AudioEvent AudEvent_LaserActivated; public AudioEvent AudEvent_LaserActiveLoop; public AudioEvent AudEvent_LaserDeactivated; public AudioSource LaserLoopSource; public bool CreateLaserLoopSourceAtRuntime = true; public FVRPooledAudioType LaserAudioPool = (FVRPooledAudioType)0; [Header("Indicator")] public Renderer StateIndicatorRenderer; public Color IdleColor = new Color(0.05f, 0.25f, 0.25f, 1f); public Color ArmingColor = new Color(1f, 0.8f, 0.1f, 1f); public Color ArmedColor = new Color(0f, 1f, 1f, 1f); public Color CooldownColor = new Color(0.65f, 1f, 0.35f, 1f); [Header("Beam")] public Transform BeamOrigin; public float BeamOriginForwardOffset = 0.15f; public float LaserRange = 15f; public float BeamWidth = 0.012f; [Range(0f, 1f)] public float BeamAlpha = 0.5f; public Color BeamColor = new Color(0f, 1f, 1f, 0.5f); public Color CooldownBeamColor = new Color(0.65f, 1f, 0.35f, 0.5f); public Material BeamMaterial; public Material GlowMaterial; public Renderer[] BeamMaterialRenderers; public bool CloneBeamMaterialAtRuntime = true; public float BeamRangeRefreshInterval = 0.1f; [Tooltip("World geometry that can shorten the beam when the mine arms.")] public LayerMask BeamBlockingLayerMask = LayerMask.op_Implicit(-1); [Header("Damage")] [Tooltip("Colliders checked for Sosig links and player hitboxes along the beam.")] public LayerMask DamageLayerMask = LayerMask.op_Implicit(-1); public float DamageAmount = 400f; public float DamageCooldownSeconds = 2f; [Tooltip("Seconds after a zap begins during which newly intersecting Sosig links join the same charge.")] public float DamageActivePeriodSeconds = 0.25f; public float DamageRadius = 0.05f; public DamageClass DamageClass = (DamageClass)0; public bool IgnoreSourceIFF; public int SourceIFF; [Header("Hit Effect")] public Material ShockMaterial; public AudioEvent AudEvent_Zap; public FVRPooledAudioType ZapAudioPool = (FVRPooledAudioType)0; [Header("H3ZM Integration")] public bool ShowTnHRadarMarker = true; public Color RadarMarkerColor = new Color(0.2f, 1f, 0.25f, 1f); [Range(0f, 1f)] public float DisruptionFlashMinimumAlpha = 0.15f; public float DisruptionFlashFrequency = 4f; private readonly List<SosigLink> _linksHitThisTick = new List<SosigLink>(); private readonly List<Vector3> _hitPointsThisTick = new List<Vector3>(); private readonly List<Vector3> _hitNormalsThisTick = new List<Vector3>(); private readonly List<Collider> _ownColliders = new List<Collider>(); private readonly HashSet<SosigLink> _linksDamagedThisActivation = new HashSet<SosigLink>(); private readonly List<FVRPlayerHitbox> _playerHitboxesThisTick = new List<FVRPlayerHitbox>(); private readonly List<Vector3> _playerHitPointsThisTick = new List<Vector3>(); private readonly List<Vector3> _playerHitNormalsThisTick = new List<Vector3>(); private readonly HashSet<FVRPlayerBody> _playersDamagedThisActivation = new HashSet<FVRPlayerBody>(); private LineRenderer _beamLine; private bool _wasArmed; private bool _isArmingPending; private float _armAtTime; private float _lockedRange; private float _nextRangeRefreshTime; private float _nextDamageTime; private float _damageActiveUntil; private float _disruptedUntil; private Material _runtimeIndicatorMaterial; private AudioSource _runtimeLaserLoopSource; private bool _laserAudioActive; private TAH_Reticle _radarReticle; private TAH_ReticleContact _radarContact; private Material _radarIconMaterial; private Material _radarArrowMaterial; private bool _powerReady; private LaserMineVisuals _visuals; private bool _hasBeamSurface; private Vector3 _beamSurfacePoint; private Vector3 _beamSurfaceNormal; private Collider _supportCollider; private Vector3 _supportPosition; private Quaternion _supportRotation; private Vector3 _supportScale; private float _nextSupportCheck; private Damage _lastDamage; private int _lastDamageFrame = -1; public bool HasUsablePower => (Object)(object)BatterySocket != (Object)null && (Object)(object)BatterySocket.Battery != (Object)null && (BatterySocket.Battery.RemainingEnergy >= LaserMineSettings.EnergyPerCharge || Time.time < _damageActiveUntil); private bool IsRecharging => Time.time >= _damageActiveUntil && Time.time < _nextDamageTime; public override void Awake() { ((FVRPhysicalObject)this).Awake(); DamageAmount = LaserMineSettings.LaserDamage; DamageCooldownSeconds = LaserMineSettings.RechargeDelaySeconds; base.SpawnLockable = false; IsPlanted = false; IsArmed = false; CacheOwnColliders(); _beamLine = CreateBeamLineRenderer(); _visuals = new LaserMineVisuals(this); LaserMineShockFX.Prepare(ShockMaterial); AssignSharedBeamMaterial(); _runtimeLaserLoopSource = ResolveLaserLoopSource(); SetBeamEnabled(enabled: false); UpdateIndicator(); if ((Object)(object)ArmSwitch != (Object)null) { ArmSwitch.RefreshPose(); } } public override void BeginInteraction(FVRViveHand hand) { ((FVRPhysicalObject)this).BeginInteraction(hand); SetPlanted(planted: false); CancelPendingArming(); } public override void EndInteraction(FVRViveHand hand) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).EndInteraction(hand); if (TryPlant()) { ((FVRInteractiveObject)this).ForceBreakInteraction(); SetPlanted(planted: true); PlayAudioEvent(AudEvent_Plant, ((Component)this).transform.position, LaserAudioPool); BeginArming(); } UpdateIndicator(); } public override void EndInteractionIntoInventorySlot(FVRViveHand hand, FVRQuickBeltSlot slot) { SetPlanted(planted: false); CancelPendingArming(); ((FVRPhysicalObject)this).EndInteractionIntoInventorySlot(hand, slot); UpdateIndicator(); } public override bool IsDistantGrabbable() { if (IsPlanted) { return false; } return ((FVRPhysicalObject)this).IsDistantGrabbable(); } public override void SetQuickBeltSlot(FVRQuickBeltSlot slot) { ((FVRPhysicalObject)this).SetQuickBeltSlot(slot); if ((Object)(object)BatterySocket != (Object)null && (Object)(object)BatterySocket.Battery != (Object)null) { ((FVRInteractiveObject)BatterySocket.Battery).SetAllCollidersToLayer(false, (!((Object)(object)slot == (Object)null)) ? "NoCol" : "Default"); } } public override void FVRUpdate() { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016c: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) ((FVRPhysicalObject)this).FVRUpdate(); CheckSupport(); if (!IsPlanted || !IsArmed || !HasUsablePower || !(Time.time >= _disruptedUntil)) { CancelPendingArming(); } else if (!_powerReady && !_isArmingPending) { BeginArming(); } UpdatePendingArming(); UpdateRadarMarker(); bool flag = IsPlanted && IsArmed && _powerReady && HasUsablePower && Time.time >= _disruptedUntil; UpdateLaserAudioState(flag); if (flag && (!_wasArmed || ShouldRefreshBeamRange())) { LockBeamRange(); } if (!flag) { _lockedRange = 0f; } _wasArmed = flag; SetBeamEnabled(flag); UpdateIndicator(); if (!flag) { UpdateEmitterVisuals(active: false); return; } Vector3 beamOrigin = GetBeamOrigin(); Vector3 beamForward = GetBeamForward(); float num = ((!(_lockedRange > 0f)) ? Mathf.Max(1f, LaserRange) : _lockedRange); Vector3 val = beamOrigin + beamForward * num; UpdateBeamDamage(beamOrigin, beamForward, num); UpdateBeamVisual(); UpdateEmitterVisuals(flag); _beamLine.SetPosition(0, beamOrigin); _beamLine.SetPosition(1, val); } public override void OnDestroy() { if (_visuals != null) { _visuals.Dispose(); } UpdateLaserAudioState(active: false); RemoveRadarMarker(); DestroyRuntimeMaterial(_beamLine); if ((Object)(object)_runtimeIndicatorMaterial != (Object)null) { Object.Destroy((Object)(object)_runtimeIndicatorMaterial); _runtimeIndicatorMaterial = null; } ((FVRPhysicalObject)this).OnDestroy(); } private void OnDisable() { if (_visuals != null) { _visuals.Hide(); } CancelPendingArming(); SetBeamEnabled(enabled: false); UpdateLaserAudioState(active: false); RemoveRadarMarker(); } public void OnH3ZMDisrupted(float durationSeconds) { _disruptedUntil = Mathf.Max(_disruptedUntil, Time.time + Mathf.Max(0f, durationSeconds)); } private bool TryPlant() { //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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: 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_00c0: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) Transform val = ((!((Object)(object)PlacementProbe == (Object)null)) ? PlacementProbe : ((Component)this).transform); Vector3 forward = val.forward; float num = Mathf.Max(0f, PlacementRayInset); RaycastHit val2 = default(RaycastHit); if (!Physics.Raycast(val.position - forward * num, forward, ref val2, Mathf.Max(0.01f, PlacementRayLength) + num, LayerMask.op_Implicit(PlacementLayerMask), (QueryTriggerInteraction)1)) { return false; } if (RequireStaticPlacementCollider && (Object)(object)((RaycastHit)(ref val2)).collider != (Object)null && (Object)(object)((RaycastHit)(ref val2)).collider.attachedRigidbody != (Object)null) { return false; } Quaternion val3 = Quaternion.FromToRotation(val.forward, -((RaycastHit)(ref val2)).normal); ((Component)this).transform.rotation = val3 * ((Component)this).transform.rotation; AlignUpToSurface(((RaycastHit)(ref val2)).normal); Transform transform = ((Component)this).transform; transform.position += ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * PlacementSurfaceOffset - val.position; RecordSupport(((RaycastHit)(ref val2)).collider); return true; } private void AlignUpToSurface(Vector3 surfaceNormal) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_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_003c: 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_0062: 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_006e: 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) Vector3 val = Vector3.ProjectOnPlane(Vector3.up, surfaceNormal); if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.ProjectOnPlane(((Component)this).transform.up, surfaceNormal); if (!(((Vector3)(ref val2)).sqrMagnitude < 0.0001f)) { ((Vector3)(ref val2)).Normalize(); ((Component)this).transform.rotation = Quaternion.FromToRotation(val2, val) * ((Component)this).transform.rotation; } } } private void SetPlanted(bool planted) { IsPlanted = planted; if (!planted) { _supportCollider = null; CancelPendingArming(); } if ((Object)(object)((FVRPhysicalObject)this).RootRigidbody != (Object)null) { ((FVRPhysicalObject)this).RootRigidbody.isKinematic = planted; ((FVRPhysicalObject)this).RootRigidbody.useGravity = !planted; } if (!planted) { StopOperation(); } } private void SetArmed(bool armed) { IsArmed = armed; if (!armed) { _lockedRange = 0f; _nextRangeRefreshTime = 0f; } if (!armed) { StopOperation(); } } private void BeginArming() { if (IsPlanted && IsArmed && HasUsablePower && !(Time.time < _disruptedUntil)) { PlayChargeUpFeedback(); _isArmingPending = true; _armAtTime = Mathf.Max(Time.time + Mathf.Max(0f, ActivationDelaySeconds), _nextDamageTime); } } private void UpdatePendingArming() { if (_isArmingPending && IsPlanted && Time.time >= _armAtTime) { CompleteArming(); } } private void CompleteArming() { _isArmingPending = false; _powerReady = true; } private void CancelPendingArming() { _isArmingPending = false; _armAtTime = 0f; _powerReady = false; _damageActiveUntil = 0f; } public void SetArmSwitch(bool armed) { SetArmed(armed); CancelPendingArming(); if ((Object)(object)ArmSwitch != (Object)null) { ArmSwitch.RefreshPose(); } if (armed) { BeginArming(); } UpdateIndicator(); } public void OnBatteryChanged() { StopOperation(); _nextDamageTime = Mathf.Max(_nextDamageTime, Time.time + LaserMineSettings.RechargeDelaySeconds); BeginArming(); UpdateIndicator(); } private void StopOperation() { CancelPendingArming(); SetBeamEnabled(enabled: false); UpdateLaserAudioState(active: false); } public override void ContainOtherObject(FVRPhysicalObject item) { LaserMineBattery laserMineBattery = item as LaserMineBattery; if ((Object)(object)laserMineBattery != (Object)null && (Object)(object)BatterySocket != (Object)null) { if (!BatterySocket.Attach(laserMineBattery)) { ((Component)laserMineBattery).gameObject.SetActive(true); } } else { ((FVRPhysicalObject)this).ContainOtherObject(item); } } public override Dictionary<string, string> GetFlagDic() { Dictionary<string, string> flagDic = ((FVRPhysicalObject)this).GetFlagDic(); flagDic["LM.Armed"] = IsArmed.ToString(); flagDic["LM.Cooldown"] = Mathf.Max(0f, _nextDamageTime - Time.time).ToString("R", CultureInfo.InvariantCulture); return flagDic; } public override void ConfigureFromFlagDic(Dictionary<string, string> flags) { ((FVRPhysicalObject)this).ConfigureFromFlagDic(flags); if (flags.TryGetValue("LM.Cooldown", out var value) && float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { _nextDamageTime = Time.time + LaserMineSettings.Valid(result, 0f, 0f); } SetPlanted(planted: false); SetArmSwitch(flags.TryGetValue("LM.Armed", out value) && bool.TryParse(value, out var result2) && result2); } private void RecordSupport(Collider support) { //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_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_0031: 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) _supportCollider = support; _supportPosition = ((Component)support).transform.position; _supportRotation = ((Component)support).transform.rotation; _supportScale = ((Component)support).transform.lossyScale; _nextSupportCheck = Time.time + 0.2f; } private void CheckSupport() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00a6: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) if (!IsPlanted || Time.time < _nextSupportCheck) { return; } _nextSupportCheck = Time.time + 0.2f; if (!((Object)(object)_supportCollider == (Object)null) && _supportCollider.enabled && ((Component)_supportCollider).gameObject.activeInHierarchy) { Vector3 val = ((Component)_supportCollider).transform.position - _supportPosition; if (!(((Vector3)(ref val)).sqrMagnitude > 4E-06f) && !(Quaternion.Angle(((Component)_supportCollider).transform.rotation, _supportRotation) > 0.5f)) { Vector3 val2 = ((Component)_supportCollider).transform.lossyScale - _supportScale; if (!(((Vector3)(ref val2)).sqrMagnitude > 1E-06f)) { return; } } } SetPlanted(planted: false); } public float DrainBattery(float damageEnergy) { if ((Object)(object)BatterySocket == (Object)null || (Object)(object)BatterySocket.Battery == (Object)null) { return 0f; } float result = BatterySocket.Battery.Drain(damageEnergy / LaserMineSettings.ResilienceMultiplier); if (BatterySocket.Battery.RemainingEnergy <= 0f) { StopOperation(); } UpdateIndicator(); return result; } void IFVRDamageable.Damage(Damage damage) { if (damage != null && (!object.ReferenceEquals(damage, _lastDamage) || _lastDamageFrame != Time.frameCount)) { _lastDamage = damage; _lastDamageFrame = Time.frameCount; float num = Mathf.Max(damage.Dam_TotalKinetic, damage.Dam_Blunt + damage.Dam_Piercing + damage.Dam_Cutting); float num2 = Mathf.Max(damage.Dam_TotalEnergetic, damage.Dam_Thermal + damage.Dam_Chilling + damage.Dam_EMP); DrainBattery(Mathf.Max(0f, num) + Mathf.Max(0f, num2)); } } private void PlayChargeUpFeedback() { //IL_000e: 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) PlayAudioEvent(AudEvent_ChargeUp, ((Component)this).transform.position, LaserAudioPool); } private void UpdateLaserAudioState(bool active) { //IL_005e: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (_laserAudioActive != active) { _laserAudioActive = active; if (active) { PlayAudioEvent(AudEvent_LaserActivated, ((Component)this).transform.position, LaserAudioPool); StartLaserLoop(); } else { StopLaserLoop(); PlayAudioEvent(AudEvent_LaserDeactivated, ((Component)this).transform.position, LaserAudioPool); } } } private Vector3 GetBeamOrigin() { //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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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) Transform val = ((!((Object)(object)BeamOrigin == (Object)null)) ? BeamOrigin : ((Component)this).transform); return val.position + GetBeamForward() * BeamOriginForwardOffset; } private Vector3 GetBeamForward() { //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_0030: Unknown result type (might be due to invalid IL or missing references) Transform val = ((!((Object)(object)BeamOrigin == (Object)null)) ? BeamOrigin : ((Component)this).transform); return val.forward; } private void LockBeamRange() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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_004a: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00ea: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) Vector3 beamOrigin = GetBeamOrigin(); Vector3 beamForward = GetBeamForward(); float num = (_lockedRange = Mathf.Max(1f, LaserRange)); _hasBeamSurface = false; _nextRangeRefreshTime = Time.time + Mathf.Max(0f, BeamRangeRefreshInterval); RaycastHit[] array = Physics.RaycastAll(beamOrigin, beamForward, num, LayerMask.op_Implicit(BeamBlockingLayerMask), (QueryTriggerInteraction)2); Array.Sort(array, CompareRaycastHits); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; if (!ShouldIgnoreCollider(((RaycastHit)(ref val)).collider) && !((Object)(object)ResolveSosigLink(((RaycastHit)(ref val)).collider) != (Object)null)) { _lockedRange = Mathf.Max(0.05f, ((RaycastHit)(ref val)).distance); _hasBeamSurface = true; _beamSurfacePoint = ((RaycastHit)(ref val)).point; _beamSurfaceNormal = ((RaycastHit)(ref val)).normal; break; } } } private bool ShouldRefreshBeamRange() { if (BeamRangeRefreshInterval <= 0f) { return true; } return Time.time >= _nextRangeRefreshTime; } private void UpdateEmitterVisuals(bool active) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (_visuals != null) { bool powered = (Object)(object)BatterySocket != (Object)null && (Object)(object)BatterySocket.Battery != (Object)null && (BatterySocket.Battery.RemainingEnergy > 0f || Time.time < _damageActiveUntil); _visuals.Update(active, powered, IsArmed, Time.time < _disruptedUntil, _isArmingPending || !IsPlanted || !_powerReady, IsRecharging, BeamColor, CooldownBeamColor, _hasBeamSurface, _beamSurfacePoint, _beamSurfaceNormal); } } private void UpdateBeamDamage(Vector3 origin, Vector3 direction, float range) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_009f: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) _linksHitThisTick.Clear(); _hitPointsThisTick.Clear(); _hitNormalsThisTick.Clear(); _playerHitboxesThisTick.Clear(); _playerHitPointsThisTick.Clear(); _playerHitNormalsThisTick.Clear(); RaycastHit[] array = Physics.SphereCastAll(origin, Mathf.Max(0.001f, DamageRadius), direction, range, LayerMask.op_Implicit(DamageLayerMask), (QueryTriggerInteraction)2); Array.Sort(array, CompareRaycastHits); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; if (ShouldIgnoreCollider(((RaycastHit)(ref val)).collider)) { continue; } SosigLink val2 = ResolveSosigLink(((RaycastHit)(ref val)).collider); if ((Object)(object)val2 != (Object)null) { AddLinkOncePerTick(val2, ((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal); } else if (LaserMineSettings.DamagePlayer && (Object)(object)GM.CurrentSceneSettings != (Object)null && GM.CurrentSceneSettings.DoesDamageGetRegistered) { FVRPlayerHitbox componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<FVRPlayerHitbox>(); if ((Object)(object)componentInParent != (Object)null && componentInParent.IsActivated && (Object)(object)componentInParent.Body != (Object)null) { _playerHitboxesThisTick.Add(componentInParent); _playerHitPointsThisTick.Add(((RaycastHit)(ref val)).point); _playerHitNormalsThisTick.Add(((RaycastHit)(ref val)).normal); } } } if (Time.time < _damageActiveUntil) { DamageNewTargets(origin, direction); } else if ((_linksHitThisTick.Count > 0 || _playerHitboxesThisTick.Count > 0) && TryBeginDamageWindow()) { DamageNewTargets(origin, direction); } } private bool TryBeginDamageWindow() { if (!IsPlanted || !IsArmed || !_powerReady || Time.time < _disruptedUntil || Time.time < _nextDamageTime || (Object)(object)BatterySocket == (Object)null || (Object)(object)BatterySocket.Battery == (Object)null || !BatterySocket.Battery.TrySpend(LaserMineSettings.EnergyPerCharge)) { return false; } _linksDamagedThisActivation.Clear(); _playersDamagedThisActivation.Clear(); _damageActiveUntil = Time.time + Mathf.Max(0f, DamageActivePeriodSeconds); _nextDamageTime = _damageActiveUntil + Mathf.Max(0f, DamageCooldownSeconds); return true; } private void AddLinkOncePerTick(SosigLink link, Vector3 hitPoint, Vector3 hitNormal) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (!_linksHitThisTick.Contains(link) && (!IgnoreSourceIFF || !((Object)(object)link.S != (Object)null) || link.S.m_originalIFFTeam != SourceIFF)) { _linksHitThisTick.Add(link); _hitPointsThisTick.Add(hitPoint); _hitNormalsThisTick.Add(hitNormal); } } private void DamageNewTargets(Vector3 origin, Vector3 direction) { //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_0048: 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_004a: 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_0059: 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_0071: 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_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _linksHitThisTick.Count; i++) { SosigLink val = _linksHitThisTick[i]; if (!((Object)(object)val == (Object)null) && _linksDamagedThisActivation.Add(val)) { Vector3 val2 = _hitPointsThisTick[i]; DamageLink(val, origin, direction, val2); SpawnShockEffect(val2, _hitNormalsThisTick[i], direction, ((Component)val).transform); PlayAudioEvent(AudEvent_Zap, val2, ZapAudioPool); } } for (int j = 0; j < _playerHitboxesThisTick.Count; j++) { FVRPlayerHitbox val3 = _playerHitboxesThisTick[j]; if (!((Object)(object)val3 == (Object)null) && !((Object)(object)val3.Body == (Object)null) && _playersDamagedThisActivation.Add(val3.Body)) { Vector3 val4 = _playerHitPointsThisTick[j]; Damage val5 = new Damage(); val5.Class = DamageClass; val5.damageSize = DamageAmount; val5.Dam_Thermal = DamageAmount; val5.Dam_TotalEnergetic = DamageAmount; val5.point = val4; val5.hitNormal = -direction; val5.strikeDir = direction; val5.Source_IFF = SourceIFF; val5.Source_Transform = ((Component)this).transform; val5.Source_Point = origin; val3.Damage(val5); SpawnShockEffect(val4, _playerHitNormalsThisTick[j], direction, ((Component)val3).transform); PlayAudioEvent(AudEvent_Zap, val4, ZapAudioPool); } } } private void UpdateRadarMarker() { TAH_Reticle val = ((!((Object)(object)GM.TNH_Manager == (Object)null)) ? GM.TNH_Manager.TAHReticle : null); if (!ShowTnHRadarMarker || !IsPlanted || (Object)(object)val == (Object)null) { RemoveRadarMarker(); } else { if ((Object)(object)_radarContact != (Object)null && (Object)(object)_radarReticle == (Object)(object)val) { return; } RemoveRadarMarker(); _radarReticle = val; _radarContact = _radarReticle.RegisterTrackedObject(((Component)this).transform, (ContactType)0); if (!((Object)(object)_radarContact == (Object)null)) { int num = 4; if (_radarContact.Meshes_Icon != null && _radarContact.Meshes_Icon.Count > num) { _radarContact.M_Icon.mesh = _radarContact.Meshes_Icon[num]; } if (_radarContact.Meshes_Arrow != null && _radarContact.Meshes_Arrow.Count > num) { _radarContact.M_Arrow.mesh = _radarContact.Meshes_Arrow[num]; } _radarIconMaterial = CreateRadarMaterial(_radarContact.R_Icon); _radarArrowMaterial = CreateRadarMaterial(_radarContact.R_Arrow); } } } private Material CreateRadarMaterial(Renderer renderer) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)renderer == (Object)null || (Object)(object)renderer.sharedMaterial == (Object)null) { return null; } Material val = new Material(renderer.sharedMaterial); SetMaterialColor(val, RadarMarkerColor); renderer.material = val; return val; } private void RemoveRadarMarker() { if ((Object)(object)_radarReticle != (Object)null) { _radarReticle.m_trackedTransforms.Remove(((Component)this).transform); if ((Object)(object)_radarContact != (Object)null) { _radarReticle.Contacts.Remove(_radarContact); } } if ((Object)(object)_radarContact != (Object)null) { Object.Destroy((Object)(object)((Component)_radarContact).gameObject); } if ((Object)(object)_radarIconMaterial != (Object)null) { Object.Destroy((Object)(object)_radarIconMaterial); } if ((Object)(object)_radarArrowMaterial != (Object)null) { Object.Destroy((Object)(object)_radarArrowMaterial); } _radarReticle = null; _radarContact = null; _radarIconMaterial = null; _radarArrowMaterial = null; } private void DamageLink(SosigLink link, Vector3 origin, Vector3 direction, Vector3 hitPoint) { //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_000e: 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_005e: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) Damage val = new Damage(); val.Class = DamageClass; val.damageSize = DamageAmount; val.Dam_Blunt = DamageAmount; val.Dam_Piercing = DamageAmount; val.Dam_TotalKinetic = DamageAmount; val.Dam_Thermal = DamageAmount; val.Dam_TotalEnergetic = DamageAmount; val.point = hitPoint; val.hitNormal = -direction; val.strikeDir = direction; val.Source_IFF = SourceIFF; val.Source_Transform = ((Component)this).transform; val.Source_Point = origin; Damage val2 = val; link.Damage(val2); } private static SosigLink ResolveSosigLink(Collider collider) { if ((Object)(object)collider == (Object)null) { return null; } SosigLink component = ((Component)collider).GetComponent<SosigLink>(); if ((Object)(object)component != (Object)null) { return component; } component = ((Component)collider).GetComponentInParent<SosigLink>(); if ((Object)(object)component != (Object)null) { return component; } if ((Object)(object)collider.attachedRigidbody != (Object)null) { component = ((Component)collider.attachedRigidbody).GetComponent<SosigLink>(); if ((Object)(object)component != (Object)null) { return component; } component = ((Component)collider.attachedRigidbody).GetComponentInParent<SosigLink>(); if ((Object)(object)component != (Object)null) { return component; } } return null; } private void CacheOwnColliders() { _ownColliders.Clear(); Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { _ownColliders.Add(componentsInChildren[i]); } } private bool ShouldIgnoreCollider(Collider collider) { if ((Object)(object)collider == (Object)null) { return true; } return _ownColliders.Contains(collider) || ((Component)collider).transform.IsChildOf(((Component)this).transform); } private LineRenderer CreateBeamLineRenderer() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("H3ZM Beam"); val.transform.SetParent(((Component)this).transform, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.positionCount = 2; val2.startWidth = BeamWidth; val2.endWidth = BeamWidth; val2.useWorldSpace = true; ((Renderer)val2).material = ResolveBeamMaterial(); ((Renderer)val2).enabled = false; return val2; } private void AssignSharedBeamMaterial() { if ((Object)(object)_beamLine == (Object)null || (Object)(object)((Renderer)_beamLine).material == (Object)null || BeamMaterialRenderers == null) { return; } for (int i = 0; i < BeamMaterialRenderers.Length; i++) { Renderer val = BeamMaterialRenderers[i]; if ((Object)(object)val != (Object)null) { val.material = ((Renderer)_beamLine).material; } } } private void SetBeamEnabled(bool enabled) { if ((Object)(object)_beamLine != (Object)null) { ((Renderer)_beamLine).enabled = enabled; } if (BeamMaterialRenderers == null) { return; } for (int i = 0; i < BeamMaterialRenderers.Length; i++) { Renderer val = BeamMaterialRenderers[i]; if ((Object)(object)val != (Object)null) { val.enabled = enabled; } } } private Material ResolveBeamMaterial() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)BeamMaterial != (Object)null) { return (!CloneBeamMaterialAtRuntime) ? BeamMaterial : Object.Instantiate<Material>(BeamMaterial); } Shader val = Shader.Find("Alloy/Particles/Additive") ?? Shader.Find("Particles/Additive") ?? Shader.Find("Legacy Shaders/Particles/Additive") ?? Shader.Find("Unlit/Transparent") ?? Shader.Find("Unlit/Color"); Material val2 = new Material(val); SetMaterialColor(val2, GetBeamColor()); val2.renderQueue = 3000; return val2; } private Color GetBeamColor() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) Color beamColor = BeamColor; beamColor.a = Mathf.Clamp01(BeamAlpha); return beamColor; } private Color GetCooldownBeamColor() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) Color cooldownBeamColor = CooldownBeamColor; cooldownBeamColor.a = Mathf.Clamp01(BeamAlpha); return cooldownBeamColor; } private static void SetMaterialColor(Material material, Color color) { //IL_0014: 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_004f: 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_008b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)material == (Object)null)) { material.color = color; if (material.HasProperty("_Color")) { material.SetColor("_Color", color); } if (material.HasProperty("_TintColor")) { material.SetColor("_TintColor", color); } if (material.HasProperty("_Tint")) { material.SetColor("_Tint", color); } if (material.HasProperty("_EmissionColor")) { material.SetColor("_EmissionColor", color); } } } private void UpdateBeamVisual() { //IL_0018: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: 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) Color color = ((!IsRecharging) ? GetBeamColor() : GetCooldownBeamColor()); _beamLine.startColor = new Color(1f, 1f, 1f, color.a); _beamLine.endColor = _beamLine.startColor; SetMaterialColor(((Renderer)_beamLine).material, color); } private void UpdateIndicator() { //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00e1: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StateIndicatorRenderer == (Object)null) { return; } if ((Object)(object)_runtimeIndicatorMaterial == (Object)null) { _runtimeIndicatorMaterial = StateIndicatorRenderer.material; EnableMaterialAlphaBlending(_runtimeIndicatorMaterial); } Color color = default(Color); ((Color)(ref color))..ctor(0.015f, 0.015f, 0.015f, 1f); if ((Object)(object)BatterySocket != (Object)null && (Object)(object)BatterySocket.Battery != (Object)null && (BatterySocket.Battery.RemainingEnergy > 0f || Time.time < _damageActiveUntil)) { color = IdleColor; if (IsArmed && Time.time < _disruptedUntil) { color = GetDisruptionFlashColor(); } else if (IsArmed && !HasUsablePower) { ((Color)(ref color))..ctor(0.5f, 0.015f, 0.005f, 1f); } else if (IsArmed && !IsPlanted) { color = PulseIndicator(ArmingColor, 0.5f); } else if (IsArmed && (_isArmingPending || !_powerReady || IsRecharging)) { color = PulseIndicator(CooldownColor, 2f); } else if (IsArmed) { color = ArmedColor; } } SetMaterialColor(_runtimeIndicatorMaterial, color); } private static Color PulseIndicator(Color color, float frequency) { //IL_0052: 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_005d: Unknown result type (might be due to invalid IL or missing references) float num = 0.2f + 0.8f * (0.5f + 0.5f * Mathf.Sin(Time.time * frequency * (float)Math.PI * 2f)); return new Color(color.r * num, color.g * num, color.b * num, 1f); } private Color GetDisruptionFlashColor() { //IL_0038: 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_0062: 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_0069: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0.1f, DisruptionFlashFrequency); float num2 = 0.5f + 0.5f * Mathf.Sin(Time.time * num * (float)Math.PI * 2f); Color cooldownColor = CooldownColor; cooldownColor.a *= Mathf.Lerp(Mathf.Clamp01(DisruptionFlashMinimumAlpha), 1f, num2); return cooldownColor; } private static void EnableMaterialAlphaBlending(Material material) { if (!((Object)(object)material == (Object)null) && material.HasProperty("_Mode")) { material.SetFloat("_Mode", 2f); if (material.HasProperty("_SrcBlend")) { material.SetInt("_SrcBlend", 5); } if (material.HasProperty("_DstBlend")) { material.SetInt("_DstBlend", 10); } if (material.HasProperty("_ZWrite")) { material.SetInt("_ZWrite", 0); } material.DisableKeyword("_ALPHATEST_ON"); material.EnableKeyword("_ALPHABLEND_ON"); material.DisableKeyword("_ALPHAPREMULTIPLY_ON"); material.renderQueue = 3000; } } private void SpawnShockEffect(Vector3 hitPoint, Vector3 normal, Vector3 direction, Transform contact) { //IL_0007: 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_0019: 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) LaserMineShockFX.Play(ShockMaterial, hitPoint, (!(((Vector3)(ref normal)).sqrMagnitude > 0.0001f)) ? (-direction) : normal, contact, BeamColor); } private AudioSource ResolveLaserLoopSource() { if ((Object)(object)LaserLoopSource != (Object)null) { ConfigureLaserLoopSource(LaserLoopSource); return LaserLoopSource; } if (!CreateLaserLoopSourceAtRuntime) { return null; } AudioSource val = ((Component)this).gameObject.AddComponent<AudioSource>(); ConfigureLaserLoopSource(val); return val; } private static void ConfigureLaserLoopSource(AudioSource source) { if (!((Object)(object)source == (Object)null)) { source.playOnAwake = false; source.loop = true; source.spatialBlend = 1f; source.minDistance = 0.5f; source.maxDistance = 20f; source.rolloffMode = (AudioRolloffMode)0; } } private void StartLaserLoop() { if ((Object)(object)_runtimeLaserLoopSource == (Object)null) { _runtimeLaserLoopSource = ResolveLaserLoopSource(); } if (!((Object)(object)_runtimeLaserLoopSource == (Object)null) && AudEvent_LaserActiveLoop != null && AudEvent_LaserActiveLoop.Clips != null && AudEvent_LaserActiveLoop.Clips.Count != 0) { _runtimeLaserLoopSource.clip = AudEvent_LaserActiveLoop.Clips[Random.Range(0, AudEvent_LaserActiveLoop.Clips.Count)]; _runtimeLaserLoopSource.volume = Random.Range(AudEvent_LaserActiveLoop.VolumeRange.x, AudEvent_LaserActiveLoop.VolumeRange.y); _runtimeLaserLoopSource.pitch = Random.Range(AudEvent_LaserActiveLoop.PitchRange.x, AudEvent_LaserActiveLoop.PitchRange.y); _runtimeLaserLoopSource.loop = true; _runtimeLaserLoopSource.Play(); } } private void StopLaserLoop() { if ((Object)(object)_runtimeLaserLoopSource != (Object)null && _runtimeLaserLoopSource.isPlaying) { _runtimeLaserLoopSource.Stop(); } } private void PlayAudioEvent(AudioEvent audioEvent, Vector3 position, FVRPooledAudioType pool) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (audioEvent != null && audioEvent.Clips != null && audioEvent.Clips.Count != 0 && Application.isPlaying) { SM.PlayCoreSound(pool, audioEvent, position); } } private static int CompareRaycastHits(RaycastHit a, RaycastHit b) { return ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance); } private void DestroyRuntimeMaterial(LineRenderer line) { if (!((Object)(object)line == (Object)null) && !((Object)(object)((Renderer)line).material == (Object)null) && (Object)(object)((Renderer)line).material != (Object)(object)BeamMaterial) { Object.Destroy((Object)(object)((Renderer)line).material); } } } public class LaserMineBattery : FVRPhysicalObject { public const string ItemId = "H3ZM_LM_B1_Battery"; public Transform ContactFace; public Renderer ChargeGaugeRenderer; private BatteryEnergy _energy; private MaterialPropertyBlock _chargeGaugeProperties; private Quaternion _defaultQuickbeltRotation; private bool _hasQuickbeltRotation; internal float CanInsertAfter; internal int SeatedFrame; public LaserMineBatterySocket Socket { get; internal set; } public float RemainingEnergy { get { EnsureEnergy(); return _energy.Remaining; } } public float Capacity { get { EnsureEnergy(); return _energy.Capacity; } } private void EnsureEnergy() { if (_energy == null) { _energy = new BatteryEnergy(LaserMineSettings.BatteryCapacity, LaserMineSettings.BatteryCapacity); } } public override void Awake() { ((FVRPhysicalObject)this).Awake(); EnsureEnergy(); RefreshChargeGauge(); } public bool TrySpend(float amount) { EnsureEnergy(); bool flag = _energy.TrySpend(amount); if (flag) { RefreshChargeGauge(); } return flag; } public float Drain(float amount) { EnsureEnergy(); float num = _energy.Drain(amount); if (num > 0f) { RefreshChargeGauge(); } return num; } private void RefreshChargeGauge() { //IL_0044: 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_0068: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown if (!((Object)(object)ChargeGaugeRenderer == (Object)null)) { float num = Mathf.Clamp01(RemainingEnergy / Capacity); Color val = ((num < 0.2f) ? new Color(0.8f, 0.06f, 0.025f) : ((!(num < 0.5f)) ? new Color(0.2f, 0.65f, 0.25f) : new Color(1f, 0.95f, 0.04f))); if (_chargeGaugeProperties == null) { _chargeGaugeProperties = new MaterialPropertyBlock(); } _chargeGaugeProperties.SetFloat("_Charge", num); _chargeGaugeProperties.SetColor("_ChargeColor", val); ChargeGaugeRenderer.SetPropertyBlock(_chargeGaugeProperties); } } public override bool IsInteractable() { return ((Object)(object)Socket == (Object)null || Time.frameCount > SeatedFrame) && ((FVRPhysicalObject)this).IsInteractable(); } public override bool IsDistantGrabbable() { return (Object)(object)Socket == (Object)null && ((FVRPhysicalObject)this).IsDistantGrabbable(); } public override void SetQuickBeltSlot(FVRQuickBeltSlot slot) { //IL_004a: 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_0036: 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_008e: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_0145: 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_011c: 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) ((FVRPhysicalObject)this).SetQuickBeltSlot(slot); if ((Object)(object)((FVRInteractiveObject)this).QBPoseOverride == (Object)null) { return; } if (!_hasQuickbeltRotation) { _defaultQuickbeltRotation = ((FVRInteractiveObject)this).QBPoseOverride.localRotation; _hasQuickbeltRotation = true; } ((FVRInteractiveObject)this).QBPoseOverride.localRotation = _defaultQuickbeltRotation; FVRPlayerBody currentPlayerBody = GM.CurrentPlayerBody; if (!((Object)(object)slot == (Object)null) && !((FVRInteractiveObject)this).IsHeld && slot.IsPlayer && !slot.UseStraightAxisAlignment && (int)slot.Shape == 1 && !((Object)(object)slot.PoseOverride == (Object)null) && !((Object)(object)slot.RectBounds == (Object)null) && !((Object)(object)currentPlayerBody == (Object)null) && !((Object)(object)currentPlayerBody.Torso == (Object)null)) { Vector3 up = slot.RectBounds.up; Vector3 val = slot.RectBounds.forward; Vector3 val2 = currentPlayerBody.Torso.position - slot.RectBounds.position; if (Vector3.Dot(val, val2) < 0f) { val = -val; } Quaternion val3 = Quaternion.LookRotation(val, Vector3.Cross(val, up)); ((FVRInteractiveObject)this).QBPoseOverride.localRotation = Quaternion.Inverse(val3) * slot.PoseOverride.rotation; } } public override void BeginInteraction(FVRViveHand hand) { if ((Object)(object)Socket != (Object)null) { Socket.Detach(); } ((FVRPhysicalObject)this).BeginInteraction(hand); } public override GameObject DuplicateFromSpawnLock(FVRViveHand hand) { GameObject val = ((FVRPhysicalObject)this).DuplicateFromSpawnLock(hand); LaserMineBattery component = val.GetComponent<LaserMineBattery>(); component._energy = new BatteryEnergy(Capacity, RemainingEnergy); component.RefreshChargeGauge(); return val; } public override Dictionary<string, string> GetFlagDic() { Dictionary<string, string> flagDic = ((FVRPhysicalObject)this).GetFlagDic(); flagDic["LM.Capacity"] = Capacity.ToString("R", CultureInfo.InvariantCulture); flagDic["LM.Energy"] = RemainingEnergy.ToString("R", CultureInfo.InvariantCulture); return flagDic; } public override void ConfigureFromFlagDic(Dictionary<string, string> flags) { ((FVRPhysicalObject)this).ConfigureFromFlagDic(flags); float num = ReadEnergy(flags, "LM.Capacity", LaserMineSettings.BatteryCapacity); _energy = new BatteryEnergy(num, ReadEnergy(flags, "LM.Energy", num)); RefreshChargeGauge(); } private static float ReadEnergy(Dictionary<string, string> flags, string name, float fallback) { string value; float result; return (!flags.TryGetValue(name, out value) || !float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out result)) ? fallback : result; } public override void OnDestroy() { if ((Object)(object)Socket != (Object)null) { Socket.Forget(this); } ((FVRPhysicalObject)this).OnDestroy(); } } internal static class LaserMineBatteryCleanup { internal static void Clean(bool emptyOnly) { LaserMineBattery[] array = Object.FindObjectsOfType<LaserMineBattery>(); foreach (LaserMineBattery laserMineBattery in array) { if (!((FVRInteractiveObject)laserMineBattery).IsHeld && (Object)(object)((FVRPhysicalObject)laserMineBattery).QuickbeltSlot == (Object)null && (Object)(object)laserMineBattery.Socket == (Object)null && (!emptyOnly || laserMineBattery.RemainingEnergy < LaserMineSettings.EnergyPerCharge)) { Object.Destroy((Object)(object)((Component)laserMineBattery).gameObject); } } } } [HarmonyPatch(typeof(FVRWristMenuSection_CleanUp), "CleanUpScene_Empties")] internal static class LaserMineEmptyBatteryCleanupPatch { private static void Prefix(bool ___askConfirm_CleanupEmpties, out bool __state) { __state = ___askConfirm_CleanupEmpties; } private static void Postfix(bool __state) { if (__state) { LaserMineBatteryCleanup.Clean(emptyOnly: true); } } } [HarmonyPatch(typeof(FVRWristMenuSection_CleanUp), "CleanUpScene_AllMags")] internal static class LaserMineAllBatteryCleanupPatch { private static void Prefix(bool ___askConfirm_CleanupAllMags, out bool __state) { __state = ___askConfirm_CleanupAllMags; } private static void Postfix(bool __state) { if (__state) { LaserMineBatteryCleanup.Clean(emptyOnly: false); } } } [HarmonyPatch(typeof(FVRWristMenu), "CleanUpScene_Empties")] internal static class LaserMineLegacyEmptyBatteryCleanupPatch { private static void Prefix(bool ___askConfirm_CleanupEmpties, out bool __state) { __state = ___askConfirm_CleanupEmpties; } private static void Postfix(bool __state) { if (__state) { LaserMineBatteryCleanup.Clean(emptyOnly: true); } } } [HarmonyPatch(typeof(FVRWristMenu), "CleanUpScene_AllMags")] internal static class LaserMineLegacyAllBatteryCleanupPatch { private static void Prefix(bool ___askConfirm_CleanupAllMags, out bool __state) { __state = ___askConfirm_CleanupAllMags; } private static void Postfix(bool __state) { if (__state) { LaserMineBatteryCleanup.Clean(emptyOnly: false); } } } public class LaserMineBatterySocket : MonoBehaviour { public LaserMine Mine; public Transform Seat; public LaserMineBattery Battery { get; private set; } private void OnTriggerStay(Collider other) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_009f: 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_00ba: 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_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_015e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Battery != (Object)null || (Object)(object)other.attachedRigidbody == (Object)null) { return; } LaserMineBattery component = ((Component)other.attachedRigidbody).GetComponent<LaserMineBattery>(); if (!((Object)(object)component == (Object)null) && ((FVRInteractiveObject)component).IsHeld && !((Object)(object)component.Socket != (Object)null) && !((Object)(object)((FVRPhysicalObject)component).QuickbeltSlot != (Object)null) && !(Time.time < component.CanInsertAfter)) { Vector3 val = Seat.InverseTransformPoint(((Component)component).transform.position); float num = Mathf.Min(Quaternion.Angle(((Component)component).transform.rotation, Seat.rotation), Quaternion.Angle(((Component)component).transform.rotation, Seat.rotation * Quaternion.Euler(0f, 180f, 0f))); if (!(Mathf.Abs(val.x) > 0.025f) && !(Mathf.Abs(val.z) > 0.018f) && !(val.y < -0.04f) && !(val.y > 0.015f) && !(num > 30f) && Attach(component)) { LaserMineMechanicalAudio.Insert(Seat.position); } } } public bool Attach(LaserMineBattery battery) { //IL_0090: 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) if ((Object)(object)battery == (Object)null || (Object)(object)Battery != (Object)null || (Object)(object)battery.Socket != (Object)null || (Object)(object)Mine == (Object)null || (Object)(object)Seat == (Object)null) { return false; } ((FVRInteractiveObject)battery).ForceBreakInteraction(); ((FVRPhysicalObject)battery).SetQuickBeltSlot((FVRQuickBeltSlot)null); Battery = battery; battery.Socket = this; battery.SeatedFrame = Time.frameCount; ((FVRPhysicalObject)battery).SetParentage(Seat); ((Component)battery).transform.localPosition = Vector3.zero; ((Component)battery).transform.localRotation = Quaternion.identity; ((FVRPhysicalObject)battery).StoreAndDestroyRigidbody(); ((FVRInteractiveObject)battery).SetAllCollidersToLayer(false, (!((Object)(object)((FVRPhysicalObject)Mine).QuickbeltSlot == (Object)null)) ? "NoCol" : "Default"); if (!((FVRPhysicalObject)Mine).GetContainedObjects().Contains((FVRPhysicalObject)(object)battery)) { ((FVRPhysicalObject)Mine).GetContainedObjects().Add((FVRPhysicalObject)(object)battery); } ((Component)battery).gameObject.SetActive(true); Mine.OnBatteryChanged(); return true; } public LaserMineBattery Detach() { //IL_00a6: 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) LaserMineBattery battery = Battery; if ((Object)(object)battery == (Object)null) { return null; } Forget(battery); ((FVRPhysicalObject)battery).SetParentage((Transform)null); ((FVRPhysicalObject)battery).RecoverRigidbody(); ((FVRInteractiveObject)battery).SetAllCollidersToLayer(false, "Default"); ((FVRPhysicalObject)battery).RootRigidbody.isKinematic = false; ((FVRPhysicalObject)battery).RootRigidbody.useGravity = true; if ((Object)(object)((FVRPhysicalObject)Mine).RootRigidbody != (Object)null) { ((FVRPhysicalObject)battery).RootRigidbody.velocity = ((FVRPhysicalObject)Mine).RootRigidbody.GetPointVelocity(((Component)battery).transform.position); } battery.CanInsertAfter = Time.time + 0.4f; LaserMineMechanicalAudio.Remove(((Component)battery).transform.position); Collider component = ((Component)this).GetComponent<Collider>(); if ((Object)(object)component != (Object)null && component.enabled) { ((MonoBehaviour)this).StartCoroutine(RefreshTrigger(component)); } return battery; } private IEnumerator RefreshTrigger(Collider trigger) { trigger.enabled = false; yield return (object)new WaitForFixedUpdate(); if ((Object)(object)trigger != (Object)null) { trigger.enabled = true; } } internal void Forget(LaserMineBattery battery) { if (!((Object)(object)Battery != (Object)(object)battery)) { Battery = null; battery.Socket = null; if ((Object)(object)Mine != (Object)null) { ((FVRPhysicalObject)Mine).GetContainedObjects().Remove((FVRPhysicalObject)(object)battery); Mine.OnBatteryChanged(); } } } } [ExecuteInEditMode] [DisallowMultipleComponent] public class LaserMineBatteryVisual : MonoBehaviour { public GameObject BatteryPrefab; public Transform BatterySeat; public static Func<GameObject, bool> EditorPreviewAllowed; [NonSerialized] private GameObject _instance; [NonSerialized] private GameObject _source; [NonSerialized] private Transform _seat; private void OnEnable() { RefreshVisual(); } private void Update() { if ((Object)(object)_instance == (Object)null || (Object)(object)_source != (Object)(object)BatteryPrefab || (Object)(object)_seat != (Object)(object)BatterySeat) { RefreshVisual(); } } public void RefreshVisual() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) if (Application.isPlaying) { ClearVisual(); } else { if (Application.isEditor && (EditorPreviewAllowed == null || !EditorPreviewAllowed(((Component)this).gameObject))) { return; } Scene scene = ((Component)this).gameObject.scene; if (!((Scene)(ref scene)).IsValid() || ((Object)(object)_instance != (Object)null && (Object)(object)_source == (Object)(object)BatteryPrefab && (Object)(object)_seat == (Object)(object)BatterySeat)) { return; } ClearVisual(); if (!((Object)(object)BatteryPrefab == (Object)null) && !((Object)(object)BatterySeat == (Object)null)) { _instance = Object.Instantiate<GameObject>(BatteryPrefab); ((Object)_instance).name = "LM-B1 Battery (linked visual)"; _instance.transform.SetParent(BatterySeat, false); _instance.transform.localPosition = Vector3.zero; _instance.transform.localRotation = Quaternion.identity; _instance.transform.localScale = Vector3.one; if (!Application.isPlaying) { ((Object)_instance).hideFlags = (HideFlags)52; } _source = BatteryPrefab; _seat = BatterySeat; } } } private void OnDisable() { ClearVisual(); } private void OnDestroy() { ClearVisual(); } private void ClearVisual() { if ((Object)(object)_instance != (Object)null) { if (Application.isPlaying) { Object.Destroy((Object)(object)_instance); } else { Object.DestroyImmediate((Object)(object)_instance); } } _instance = null; _source = null; _seat = null; } } public class LaserMineDamageRelay : MonoBehaviour, IFVRDamageable { public LaserMine Mine; public void Damage(Damage damage) { if ((Object)(object)Mine != (Object)null) { ((IFVRDamageable)Mine).Damage(damage); } } } [HarmonyPatch(typeof(FVRViveHand), "RetrieveObject")] internal static class LaserMineLaserGrabPosePatch { private static void Postfix(FVRViveHand __instance, FVRPhysicalObject obj) { //IL_006b: 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) if ((obj is LaserMine || obj is LaserMineBattery) && ((FVRInteractiveObject)obj).IsHeld && !((Object)(object)((FVRInteractiveObject)obj).m_hand != (Object)(object)__instance) && !((Object)(object)((FVRInteractiveObject)obj).GrabPointTransform == (Object)null) && !((Object)(object)__instance.PoseOverride == (Object)null)) { ((FVRInteractiveObject)obj).GrabPointTransform.position = __instance.PoseOverride.position; ((FVRInteractiveObject)obj).GrabPointTransform.rotation = __instance.PoseOverride.rotation; } } } internal static class LaserMineMechanicalAudio { internal static void Insert(Vector3 position) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) SM.PlayHandlingGrabSound((HandlingGrabType)21, position, true); } internal static void Remove(Vector3 position) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) SM.PlayHandlingReleaseSound((HandlingReleaseType)11, position); } internal static void Switch(Vector3 position) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) AudioEvent audioEvent_AttachmentClick_Minor = ManagerSingleton<SM>.Instance.AudioEvent_AttachmentClick_Minor; if (audioEvent_AttachmentClick_Minor != null && audioEvent_AttachmentClick_Minor.Clips != null && audioEvent_AttachmentClick_Minor.Clips.Count > 0) { SM.PlayCoreSoundOverrides((FVRPooledAudioType)10, audioEvent_AttachmentClick_Minor, position, audioEvent_AttachmentClick_Minor.VolumeRange * 0.8f, audioEvent_AttachmentClick_Minor.PitchRange); } } } public static class LaserMineSettings { public static float EnergyPerCharge = 500f; public static float RechargeDelaySeconds = 2f; public static float BatteryCapacity = 10000f; public static float LaserDamage = 2000f; public static bool DamagePlayer = true; public static float ResilienceMultiplier = 1f; public static float Valid(float value, float minimum, float fallback) { return (!float.IsNaN(value) && !float.IsInfinity(value) && !(value < minimum)) ? value : fallback; } } public sealed class BatteryEnergy { public float Capacity { get; private set; } public float Remaining { get; private set; } public BatteryEnergy(float capacity, float remaining) { Capacity = LaserMineSettings.Valid(capacity, 0.001f, 10000f); Remaining = Math.Max(0f, Math.Min(Capacity, LaserMineSettings.Valid(remaining, 0f, 0f))); } public bool TrySpend(float amount) { if (float.IsNaN(amount) || float.IsInfinity(amount) || amount <= 0f || Remaining < amount) { return false; } Remaining = Math.Max(0f, Remaining - amount); return true; } public float Drain(float amount) { amount = Math.Min(Remaining, LaserMineSettings.Valid(amount, 0f, 0f)); Remaining -= amount; return amount; } } public sealed class LaserMineShockFX : MonoBehaviour { private sealed class Burst { public Transform Transform; public Transform Contact; public Vector3 LocalPoint; public Vector3 LocalNormal; public Mesh Mesh; public MeshRenderer Renderer; public MaterialPropertyBlock Properties = new MaterialPropertyBlock(); public Vector3[] Vertices = (Vector3[])(object)new Vector3[152]; public Vector2[] UV = (Vector2[])(object)new Vector2[152]; public Vector2[] Style = (Vector2[])(object)new Vector2[152]; public int[] Triangles = new int[228]; public Vector3[] Main = (Vector3[])(object)new Vector3[7]; public float Started; public float Roll; public bool Active; public bool Restruck; } public const int Capacity = 8; public const float Duration = 0.2f; public const float VisualScale = 3f; private const float RestrikeTime = 0.07f; private static LaserMineShockFX _instance; private readonly Burst[] _bursts = new Burst[8]; private Material _material; private float _nextFlash; private uint _random = 17627u; private static readonly int AgeId = Shader.PropertyToID("_Age"); private static readonly int ColorId = Shader.PropertyToID("_Color"); public static void Prepare(Material source) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (!((Object)(object)_instance != (Object)null) && !((Object)(object)source == (Object)null)) { GameObject val = new GameObject("H3ZM pooled contact discharge"); _instance = val.AddComponent<LaserMineShockFX>(); _instance.Initialize(source); } } private void Initialize(Material source) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0056: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) Material val = new Material(source); ((Object)val).name = "H3ZM shared contact discharge"; _material = val; for (int i = 0; i < 8; i++) { Burst burst = new Burst(); GameObject val2 = new GameObject("H3ZM zap burst " + i); val2.transform.SetParent(((Component)this).transform, false); val2.transform.localScale = Vector3.one * 3f; burst.Transform = val2.transform; Mesh val3 = new Mesh(); ((Object)val3).name = "H3ZM pooled forked discharge " + i; burst.Mesh = val3; burst.Mesh.MarkDynamic(); for (int j = 0; j < 38; j++) { int num = j * 4; int num2 = j * 6; ref Vector2 reference = ref burst.UV[num]; reference = Vector2.zero; ref Vector2 reference2 = ref burst.UV[num + 1]; reference2 = Vector2.right; ref Vector2 reference3 = ref burst.UV[num + 2]; reference3 = Vector2.one; ref Vector2 reference4 = ref burst.UV[num + 3]; reference4 = Vector2.up; burst.Triangles[num2] = num; burst.Triangles[num2 + 1] = num + 1; burst.Triangles[num2 + 2] = num + 2; burst.Triangles[num2 + 3] = num; burst.Triangles[num2 + 4] = num + 2; burst.Triangles[num2 + 5] = num + 3; } burst.Mesh.vertices = burst.Vertices; burst.Mesh.uv = burst.UV; burst.Mesh.triangles = burst.Triangles; burst.Mesh.bounds = new Bounds(Vector3.zero, Vector3.one * 0.36f); val2.AddComponent<MeshFilter>().sharedMesh = burst.Mesh; burst.Renderer = val2.AddComponent<MeshRenderer>(); ((Renderer)burst.Renderer).sharedMaterial = _material; ((Renderer)burst.Renderer).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)burst.Renderer).receiveShadows = false; ((Renderer)burst.Renderer).enabled = false; _bursts[i] = burst; } ((Behaviour)this).enabled = false; } public static void Play(Material source, Vector3 point, Vector3 normal, Transform contact, Color color) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) Prepare(source); if (!((Object)(object)_instance == (Object)null)) { _instance.Emit(point, normal, contact, color); } } private void Emit(Vector3 point, Vector3 normal, Transform contact, Color color) { //IL_00b5: 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_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_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_00ba: 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_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_00dd: 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) //IL_00f0: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_01c2: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) float time = Time.time; Burst burst = null; for (int i = 0; i < 8; i++) { Burst burst2 = _bursts[i]; if (!burst2.Active || time - burst2.Started >= 0.2f) { if (burst == null) { burst = burst2; } } else if (time - burst2.Started < 0.05f) { Vector3 val = burst2.Transform.position - point; if (((Vector3)(ref val)).sqrMagnitude < 0.0016f) { return; } } } if (burst != null) { normal = ((!(((Vector3)(ref normal)).sqrMagnitude > 0.0001f)) ? Vector3.up : ((Vector3)(ref normal)).normalized); burst.Contact = contact; burst.LocalPoint = ((!((Object)(object)contact != (Object)null)) ? point : contact.InverseTransformPoint(point)); burst.LocalNormal = ((!((Object)(object)contact != (Object)null)) ? normal : contact.InverseTransformDirection(normal)); burst.Started = time; burst.Roll = Next() * 360f; burst.Restruck = false; burst.Active = true; Position(burst); Build(burst); color.a = 1f; burst.Properties.SetColor(ColorId, color); burst.Properties.SetFloat(AgeId, 0f); ((Renderer)burst.Renderer).SetPropertyBlock(burst.Properties); ((Renderer)burst.Renderer).enabled = true; ((Behaviour)this).enabled = true; if (time >= _nextFlash && (Object)(object)ManagerSingleton<FXM>.Instance != (Object)null) { _nextFlash = time + 0.075f; FXM.InitiateMuzzleFlashLowPriority(point + normal * 0.025f, normal, 0.8f, Color.Lerp(color, Color.white, 0.22f), 0.8f); } } } private void Update() { bool enabled = false; for (int i = 0; i < 8; i++) { Burst burst = _bursts[i]; if (!burst.Active) { continue; } float num = Time.time - burst.Started; if (num >= 0.2f) { burst.Active = false; ((Renderer)burst.Renderer).enabled = false; burst.Contact = null; continue; } enabled = true; if ((Object)(object)burst.Contact != (Object)null) { Position(burst); } if (!burst.Restruck && num >= 0.07f) { burst.Restruck = true; Build(burst); } burst.Properties.SetFloat(AgeId, num); ((Renderer)burst.Renderer).SetPropertyBlock(burst.Properties); } ((Behaviour)this).enabled = enabled; } private static void Position(Burst b) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_006c: 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_0077: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((!((Object)(object)b.Contact != (Object)null)) ? b.LocalPoint : b.Contact.TransformPoint(b.LocalPoint)); Vector3 val3; if ((Object)(object)b.Contact != (Object)null) { Vector3 val2 = b.Contact.TransformDirection(b.LocalNormal); val3 = ((Vector3)(ref val2)).normalized; } else { val3 = b.LocalNormal; } Vector3 val4 = val3; b.Transform.position = val + val4 * 0.006f; b.Transform.rotation = Quaternion.LookRotation(val4) * Quaternion.Euler(0f, 0f, b.Roll); } private float Next() { _random ^= _random << 13; _random ^= _random >> 17; _random ^= _random << 5; return (float)(_random & 0xFFFFFF) / 16777216f; } private void Build(Burst b) { //IL_0052: 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_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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_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_01be: 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_01d1: 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) int quad = 0; for (int i = 0; i < 3; i++) { float num = (float)i * (float)Math.PI * 2f / 3f + (Next() - 0.5f) * 0.28f; float num2 = 0.1f + Next() * 0.025f; ref Vector3 reference = ref b.Main[0]; reference = Vector3.zero; for (int j = 1; j <= 6; j++) { float num3 = num2 * (float)j / 6f; float num4 = num + (Next() - 0.5f) * 0.38f; ref Vector3 reference2 = ref b.Main[j]; reference2 = new Vector3(Mathf.Cos(num4) * num3, Mathf.Sin(num4) * num3, Next() * 0.008f); Segment(b, ref quad, b.Main[j - 1], b.Main[j], 0.0028f, 1f); } for (int k = 0; k < 2; k++) { Vector3 val = b.Main[(k != 0) ? 4 : 2]; Vector3 start = val; float num5 = num + ((k != 0) ? (-0.8f) : 0.9f); float num6 = 0.027f + Next() * 0.014f; for (int l = 1; l <= 3; l++) { float num7 = num5 + (Next() - 0.5f) * 0.5f; Vector3 val2 = val + new Vector3(Mathf.Cos(num7), Mathf.Sin(num7), 0.1f) * num6 * (float)l / 3f; Segment(b, ref quad, start, val2, 0.0018f, 0.72f); start = val2; } } } Disc(b, ref quad, 0.036f, 2f); Disc(b, ref quad, 0.035f, 1f); b.Mesh.vertices = b.Vertices; b.Mesh.uv2 = b.Style; } private static void Segment(Burst b, ref int quad, Vector3 start, Vector3 end, float width, float strength) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0015: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_008f: 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) Vector3 val = Vector3.Cross(end - start, Vector3.forward); Vector3 val2 = ((Vector3)(ref val)).normalized * width; int num = quad++ * 4; ref Vector3 reference = ref b.Vertices[num]; reference = start - val2; ref Vector3 reference2 = ref b.Vertices[num + 1]; reference2 = end - val2; ref Vector3 reference3 = ref b.Vertices[num + 2]; reference3 = end + val2; ref Vector3 reference4 = ref b.Vertices[num + 3]; reference4 = start + val2; for (int i = 0; i < 4; i++) { ref Vector2 reference5 = ref b.Style[num + i]; reference5 = new Vector2(0f, strength); } } private static void Disc(Burst b, ref int quad, float radius, float style) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_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_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_00a6: 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) int num = quad++ * 4; ref Vector3 reference = ref b.Vertices[num]; reference = new Vector3(0f - radius, 0f - radius, 0.001f); ref Vector3 reference2 = ref b.Vertices[num + 1]; reference2 = new Vector3(radius, 0f - radius, 0.001f); ref Vector3 reference3 = ref b.Vertices[num + 2]; reference3 = new Vector3(radius, radius, 0.001f); ref Vector3 reference4 = ref b.Vertices[num + 3]; reference4 = new Vector3(0f - radius, radius, 0.001f); for (int i = 0; i < 4; i++) { ref Vector2 reference5 = ref b.Style[num + i]; reference5 = new Vector2(style, 1f); } } private void OnDestroy() { for (int i = 0; i < 8; i++) { if (_bursts[i] != null) { Object.Destroy((Object)(object)_bursts[i].Mesh); } } if ((Object)(object)_material != (Object)null) { Object.Destroy((Object)(object)_material); } if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } } [HarmonyPatch(typeof(ZosigContainer_WeaponCase), "LoadIntoCrate")] internal static class LaserMineWeaponCasePatch { private static void Postfix(FVRObject obj, ref FVRObject ___m_storedObject_attachA) { if ((Object)(object)obj != (Object)null && obj.ItemID == "H3ZM_LaserMine" && obj.RequiredSecondaryPieces.Count == 1) { ___m_storedObject_attachA = obj.RequiredSecondaryPieces[0]; } } } [HarmonyPatch(typeof(MM_LootCrate), "Destroy")] internal static class LaserMineLootCratePatch { private static void Postfix(MM_LootCrate __instance, bool ___m_hasObjs) { //IL_0060: 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) FVRObject storedObject = __instance.m_storedObject1; if (___m_hasObjs && !((Object)(object)storedObject == (Object)null) && !(storedObject.ItemID != "H3ZM_LaserMine") && storedObject.RequiredSecondaryPieces.Count == 1) { Transform val = __instance.SpawnPoints[1]; Object.Instantiate<GameObject>(((AnvilAsset)storedObject.RequiredSecondaryPieces[0]).GetGameObject(), val.position, val.rotation); } } } public class LaserMineSwitch : FVRInteractiveObject { public LaserMine Mine; public Transform Lever; public Vector3 ArmedAngles = new Vector3(-50f, 0f, 0f); private float _nextToggle; public override void SimpleInteraction(FVRViveHand hand) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Mine == (Object)null) && !(Time.time < _nextToggle)) { _nextToggle = Time.time + 0.25f; Mine.SetArmSwitch(!Mine.IsArmed); LaserMineMechanicalAudio.Switch(((Component)this).transform.position); if ((Object)(object)hand != (Object)null) { hand.Buzz(hand.Buzzer.Buzz_BeginInteraction); } } } public void RefreshPose() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Lever != (Object)null && (Object)(object)Mine != (Object)null) { Lever.localRotation = Quaternion.Euler((!Mine.IsArmed) ? Vector3.zero : ArmedAngles); } } public override bool IsInteractable() { return (Object)(object)Mine != (Object)null && ((FVRInteractiveObject)this).IsInteractable(); } } public sealed class LaserMineVisuals { private static Mesh _quad; private static Texture2D _falloff; private readonly Material _material; private readonly MaterialPropertyBlock _properties = new MaterialPropertyBlock(); private readonly MeshRenderer _core; private readonly MeshRenderer _lens; private readonly MeshRenderer _impact; public LaserMineVisuals(LaserMine mine) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_009b: 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_00bb: 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_00dc: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Expected O, but got Unknown //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: 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_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) if ((Object)(object)_quad == (Object)null) { Mesh val = new Mesh(); ((Object)val).name = "LaserMine shared glow quad"; _quad = val; _quad.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) }; _quad.uv = (Vector2[])(object)new Vector2[4] { Vector2.zero, Vector2.right, Vector2.one, Vector2.up }; _quad.triangles = new int[6] { 0, 1, 2, 0, 2, 3 }; _quad.RecalculateBounds(); Texture2D val2 = new Texture2D(64, 64, (TextureFormat)4, false); ((Object)val2).name = "LaserMine shared radial falloff"; ((Texture)val2).wrapMode = (TextureWrapMode)1; _falloff = val2; Color[] array = (Color[])(object)new Color[4096]; Vector2 val3 = default(Vector2); for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { ((Vector2)(ref val3))..ctor(((float)j + 0.5f) / 32f - 1f, ((float)i + 0.5f) / 32f - 1f); float magnitude = ((Vector2)(ref val3)).magnitude; float num = Mathf.Pow(Mathf.Clamp01(1f - magnitude), 2f); ref Color reference = ref array[i * 64 + j]; reference = new Color(1f, 1f, 1f, num); } } _falloff.SetPixels(array); _falloff.Apply(false, true); } _material = ((!((Object)(object)mine.GlowMaterial != (Object)null)) ? new Material(Shader.Find("Particles/Additive")) : new Material(mine.GlowMaterial)); _material.mainTexture = (Texture)(object)_falloff; Transform parent = ((!((Object)(object)mine.BeamOrigin == (Object)null)) ? mine.BeamOrigin : ((Component)mine).transform); _core = Make("H3ZM Emitter Core", parent, 0.018f, new Vector3(0f, 0f, -0.0013f)); _lens = Make("H3ZM Lens Halo", parent, 0.055f, new Vector3(0f, 0f, -0.0004f)); _impact = Make("H3ZM Surface Halo", ((Component)mine).transform, 0.075f, Vector3.zero); Hide(); } private MeshRenderer Make(string name, Transform parent, float size, Vector3 position) { //IL_0002: Unknown result type (might be