using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using UnityEditor;
using UnityEngine;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace BitWizrd.HuntStickyBomb
{
[BepInPlugin("BitWizrd.HuntStickyBomb", "HuntStickyBomb", "1.0.9")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HuntStickyBombPlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "BitWizrd.HuntStickyBomb");
OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntStickyBomb", "", "huntstickybomb", "", "");
}
}
}
public class BloodBondSR : MonoBehaviour
{
private void Awake()
{
string name = "Ammo_69_CashMoney_D100(Clone)";
((Object)((Component)this).gameObject).name = name;
Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
((Object)((Component)componentsInChildren[i]).gameObject).name = name;
}
}
}
public class CooldownSound : MonoBehaviour
{
public ClosedBoltWeapon weapon;
public AudioClip[] audioClips;
public float volume = 1f;
public int minShots = 5;
public int maxShots = 10;
public float minDelay = 0.5f;
public float maxDelay = 2f;
public float resetTime = 1.5f;
private AudioSource audioSource;
private int shotCounter = 0;
private float lastShotTime;
private bool lastRoundSpent;
private int nextShotThreshold;
private bool isPlayingSound = false;
private void Start()
{
if ((Object)(object)weapon == (Object)null)
{
weapon = ((Component)this).GetComponent<ClosedBoltWeapon>();
}
if ((Object)(object)weapon == (Object)null)
{
Debug.LogError((object)"CooldownSound: Weapon reference is missing. Attach this script to a ClosedBoltWeapon.");
return;
}
audioSource = ((Component)weapon).gameObject.GetComponent<AudioSource>();
if ((Object)(object)audioSource == (Object)null)
{
audioSource = ((Component)weapon).gameObject.AddComponent<AudioSource>();
}
audioSource.spatialBlend = 1f;
audioSource.playOnAwake = false;
audioSource.rolloffMode = (AudioRolloffMode)0;
lastRoundSpent = weapon.Chamber.IsSpent;
SetNewShotThreshold();
}
private void Update()
{
DetectFiring();
}
private void DetectFiring()
{
if (weapon.Chamber.IsFull && weapon.Chamber.IsSpent && !lastRoundSpent)
{
OnWeaponFired();
}
lastRoundSpent = weapon.Chamber.IsSpent;
}
private void OnWeaponFired()
{
float num = Time.time - lastShotTime;
if (num > resetTime)
{
shotCounter = 0;
SetNewShotThreshold();
}
shotCounter++;
lastShotTime = Time.time;
if (shotCounter >= nextShotThreshold)
{
((MonoBehaviour)this).StartCoroutine(PlaySoundWithDelay());
shotCounter = 0;
SetNewShotThreshold();
}
}
private IEnumerator PlaySoundWithDelay()
{
if (!isPlayingSound)
{
isPlayingSound = true;
float delay = Random.Range(minDelay, maxDelay);
yield return (object)new WaitForSeconds(delay);
if (audioClips.Length > 0)
{
int index = Random.Range(0, audioClips.Length);
audioSource.clip = audioClips[index];
audioSource.PlayOneShot(audioSource.clip, volume);
yield return (object)new WaitForSeconds(audioSource.clip.length);
}
isPlayingSound = false;
}
}
private void SetNewShotThreshold()
{
nextShotThreshold = Random.Range(minShots, maxShots + 1);
}
}
public class CustomWaggleJoint : MonoBehaviour
{
public float distanceLimit = 0.25f;
public float angleLimitLeft = 45f;
public float angleLimitRight = 45f;
public float gravityScale = 1f;
public bool useSpring;
public float springApproachRate = 0.95f;
public float damping;
public Transform hingeGraphic;
public Vector3 hingeGraphicRotationOffset;
public bool invertWaggleAxis;
public bool ManualExecution;
public float onHitLimitCooldown = 0.05f;
public Vector3 waggleAxis = Vector3.up;
public Vector3 rotationAxis = Vector3.up;
[Header("Gizmo Options")]
public bool debugGizmos = false;
public bool showRotationExtremes = false;
public bool showRotationDirectionArrows = false;
private Vector3 particlePos;
private Vector3 particleVel;
private bool leftCatchState;
private bool rightCatchState;
private float lastTouchTime = float.MinValue;
private Vector3 EffectiveWaggleDir()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
return ((Component)this).transform.TransformDirection((!invertWaggleAxis) ? waggleAxis : (-waggleAxis));
}
private void GetEffectiveAngleLimits(out float effectiveAngleMin, out float effectiveAngleMax)
{
if (invertWaggleAxis)
{
effectiveAngleMin = 0f - angleLimitLeft;
effectiveAngleMax = angleLimitRight;
}
else
{
effectiveAngleMin = 0f - angleLimitRight;
effectiveAngleMax = angleLimitLeft;
}
}
public void ResetParticlePos()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
particlePos = ((Component)this).transform.position + EffectiveWaggleDir() * distanceLimit;
particleVel = Vector3.zero;
}
private void OnHitLimit(float angularVelocity)
{
}
public void Execute()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
float deltaTime = Time.deltaTime;
Transform transform = ((Component)this).transform;
Vector3 val = Physics.gravity * gravityScale;
Vector3 val2 = particlePos;
Vector3 val3 = particleVel * Mathf.Pow(1f - damping, deltaTime) + val * deltaTime;
Vector3 val4 = val2 + val3 * deltaTime;
Vector3 val5 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized);
Vector3 val6 = EffectiveWaggleDir();
Vector3 position = transform.position;
if (useSpring)
{
val4 = Vector3.Lerp(val4, position + val6 * distanceLimit, 1f - Mathf.Pow(1f - springApproachRate, deltaTime));
}
GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax);
particlePos = ProjectOnHinge(val4, position, val5, val6, distanceLimit, effectiveAngleMin, effectiveAngleMax);
particleVel = (particlePos - val2) / deltaTime;
if ((Object)(object)hingeGraphic != (Object)null)
{
hingeGraphic.rotation = Quaternion.LookRotation(particlePos - transform.position, val5) * Quaternion.Euler(hingeGraphicRotationOffset);
}
}
private Vector3 ProjectOnHinge(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection, float distanceLimit, float angleMin, float angleMax)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
float num = ToHingeAngle(point, hingePivot, hingeAxis, hingeDirection);
num = Mathf.Clamp(num, angleMin, angleMax);
Vector3 val = Quaternion.AngleAxis(num, hingeAxis) * hingeDirection;
return val * distanceLimit + hingePivot;
}
private float ToHingeAngle(Vector3 point, Vector3 hingePivot, Vector3 hingeAxis, Vector3 hingeDirection)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = point - hingePivot;
Vector3 val2 = Vector3.ProjectOnPlane(val, hingeAxis);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
return SignedAngle(hingeDirection, normalized, hingeAxis);
}
private float SignedAngle(Vector3 from, Vector3 to, Vector3 axis)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Angle(from, to);
return num * Mathf.Sign(Vector3.Dot(axis, Vector3.Cross(from, to)));
}
private void Start()
{
ResetParticlePos();
}
private void Update()
{
if (!ManualExecution)
{
Execute();
}
}
private void OnDrawGizmosSelected()
{
//IL_002e: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00d7: 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_00e3: 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_0102: 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_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: 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_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: 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_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: 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_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_0235: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
if (debugGizmos && !((Object)(object)Selection.activeGameObject != (Object)(object)((Component)this).gameObject))
{
Transform transform = ((Component)this).transform;
Vector3 position = transform.position;
Vector3 val = EffectiveWaggleDir();
Vector3 val2 = transform.TransformDirection(((Vector3)(ref rotationAxis)).normalized);
Vector3 val3 = position + val * distanceLimit;
Gizmos.color = Color.white;
float num = 0.01f;
Gizmos.DrawLine(position + Vector3.left * num, position + Vector3.right * num);
Gizmos.DrawLine(position + Vector3.up * num, position + Vector3.down * num);
Gizmos.DrawLine(position + Vector3.forward * num, position + Vector3.back * num);
Handles.BeginGUI();
Handles.Label(position, "Pivot");
Handles.EndGUI();
Gizmos.color = Color.green;
Gizmos.DrawLine(position, val3);
GetEffectiveAngleLimits(out var effectiveAngleMin, out var effectiveAngleMax);
Vector3 val4 = Quaternion.AngleAxis(effectiveAngleMax, val2) * val;
Vector3 val5 = Quaternion.AngleAxis(effectiveAngleMin, val2) * val;
Vector3 val6 = position + val4 * distanceLimit;
Vector3 val7 = position + val5 * distanceLimit;
Gizmos.color = Color.cyan;
Gizmos.DrawLine(position, val6);
Gizmos.DrawLine(position, val7);
Handles.color = Color.yellow;
Handles.DrawWireArc(position, val2, val5, effectiveAngleMax - effectiveAngleMin, distanceLimit * 0.5f);
if (Application.isPlaying)
{
Gizmos.color = Color.red;
float num2 = 0.01f;
Gizmos.DrawLine(particlePos + Vector3.left * num2, particlePos + Vector3.right * num2);
Gizmos.DrawLine(particlePos + Vector3.up * num2, particlePos + Vector3.down * num2);
Gizmos.DrawLine(particlePos + Vector3.forward * num2, particlePos + Vector3.back * num2);
}
}
}
}
namespace BitWizrd.ExplosionRicochet
{
public class ExplosionRicochet : MonoBehaviour
{
public AudioClip[] whizBySounds;
public AudioClip[] ricochetSounds;
[Range(0f, 100f)]
public float ricochetPlayChance = 5f;
[Range(1f, 10f)]
public int minWhizBySounds = 1;
[Range(1f, 10f)]
public int maxWhizBySounds = 5;
[Range(1f, 10f)]
public int minRicochetSounds = 1;
[Range(1f, 10f)]
public int maxRicochetSounds = 5;
[Range(0f, 1f)]
public float volume = 1f;
public float minDelay = 0.1f;
public float maxDelay = 1f;
[Range(0f, 1f)]
public float spatialBlend = 1f;
public bool playOnSpawn = true;
public bool debugMode = false;
private const float speedOfSound = 343f;
private const float maxWhizDistance = 20f;
private const float maxRicochetDistance = 15f;
private void Start()
{
if (playOnSpawn)
{
((MonoBehaviour)this).StartCoroutine(PlaySoundsWithDelay());
}
}
public IEnumerator PlaySoundsWithDelay()
{
float delay = 0f;
float distance = 0f;
if ((Object)(object)GM.CurrentPlayerBody != (Object)null)
{
distance = Vector3.Distance(((Component)GM.CurrentPlayerBody).transform.position, ((Component)this).transform.position);
delay = distance / 343f;
}
if (distance <= 20f && whizBySounds != null && whizBySounds.Length > 0)
{
List<AudioClip> availableWhizBySounds = new List<AudioClip>(whizBySounds);
int whizBySoundCount = Mathf.Min(Random.Range(minWhizBySounds, maxWhizBySounds + 1), availableWhizBySounds.Count);
for (int j = 0; j < whizBySoundCount; j++)
{
PlayBuzzingSound(ref availableWhizBySounds, delay, distance, 20f);
float randomDelay2 = Random.Range(minDelay, maxDelay);
yield return (object)new WaitForSeconds(randomDelay2);
}
}
if (distance <= 15f && !(Random.Range(0f, 100f) > ricochetPlayChance) && ricochetSounds != null && ricochetSounds.Length > 0)
{
List<AudioClip> availableRicochetSounds = new List<AudioClip>(ricochetSounds);
int ricochetSoundCount = Mathf.Min(Random.Range(minRicochetSounds, maxRicochetSounds + 1), availableRicochetSounds.Count);
for (int i = 0; i < ricochetSoundCount; i++)
{
PlayBuzzingSound(ref availableRicochetSounds, delay, distance, 15f);
float randomDelay = Random.Range(minDelay, maxDelay);
yield return (object)new WaitForSeconds(randomDelay);
}
}
}
private void PlayBuzzingSound(ref List<AudioClip> availableSounds, float soundDelay, float distance, float maxDistance)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
if (availableSounds.Count != 0)
{
int index = Random.Range(0, availableSounds.Count);
AudioClip val = availableSounds[index];
availableSounds.RemoveAt(index);
GameObject val2 = new GameObject("TempAudioObject");
AudioSource val3 = val2.AddComponent<AudioSource>();
val3.clip = val;
float num = Mathf.Clamp01(1f - distance / maxDistance);
val3.volume = num * volume;
val3.spatialBlend = spatialBlend;
float panStereo = ((!(Random.Range(0f, 1f) < 0.5f)) ? Random.Range(0.5f, 1f) : Random.Range(-1f, -0.5f));
val3.panStereo = panStereo;
val3.PlayDelayed(soundDelay);
Object.Destroy((Object)(object)val2, val.length + soundDelay);
}
}
}
}
namespace BitWizrd.GrenadeMod
{
public static class PlayerBleedingImmunity
{
private static bool s_isBloodlessActive = false;
public static void SetBloodless(bool isActive)
{
s_isBloodlessActive = isActive;
}
public static bool IsBloodless()
{
return s_isBloodlessActive;
}
}
public class GrenadeBleedingMod : MonoBehaviour
{
[Header("Bleeding Settings")]
public bool InducesBleeding = false;
public float BleedingRadius = 10f;
[Tooltip("Bleeding amount per projectile. Each projectile that hits will apply this amount (scaled by distance). Multiple hits accumulate. Note: This value is further multiplied by BleedDamageMult (typically 0.5) when applied to sosigs. Default 20 provides noticeable bleeding per hit.")]
public float BleedingAmount = 20f;
[Header("Player Bleeding")]
public bool CanBleedPlayer = false;
[Tooltip("Total damage percent that will be applied to player over the bleeding duration. For example, 0.1 = 10% of max health over the duration.")]
public float PlayerBleedingDamagePercent = 0.1f;
[Tooltip("Duration in seconds for player bleeding effect (damage over time).")]
public float PlayerBleedingDuration = 5f;
[Header("Bleed Projectiles")]
public int BleedProjectileCount = 20;
public float BleedProjectileSpread = 180f;
[Tooltip("Layer mask that determines which layers the bleed projectile raycasts will hit. Only sosigs on these layers will be affected by bleeding. Set to -1 (Everything) to check all layers, or specify only sosig layers for better performance. Sosigs are usually on the 'AgentBody' layer (layer index 17).")]
public LayerMask SosigLayerMask = LayerMask.op_Implicit(-1);
[Header("Debug Gizmos")]
public bool ShowGizmos = false;
public Color GizmoRaycastColor = Color.red;
public Color GizmoRadiusColor = Color.yellow;
private bool hasAppliedBleeding = false;
private bool previousShowGizmos = false;
private Vector3[] cachedGizmoDirections;
private RaycastHit[] cachedGizmoHits;
private bool[] cachedGizmoHitResults;
private GrenadeExplosion grenadeExplosion;
private void Awake()
{
grenadeExplosion = ((Component)this).GetComponent<GrenadeExplosion>();
if ((Object)(object)grenadeExplosion == (Object)null)
{
Debug.LogWarning((object)"GrenadeBleedingMod: No GrenadeExplosion component found on same GameObject. This script must be on the explosion prefab!");
}
}
private void OnEnable()
{
if (InducesBleeding && !hasAppliedBleeding)
{
ApplyBleeding();
hasAppliedBleeding = true;
}
}
private void ApplyBleeding()
{
//IL_0018: 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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
if (!InducesBleeding)
{
return;
}
Vector3 position = ((Component)this).transform.position;
RaycastHit val = default(RaycastHit);
for (int i = 0; i < BleedProjectileCount; i++)
{
Vector3 randomDirection = GetRandomDirection();
if (!Physics.Raycast(position, randomDirection, ref val, BleedingRadius, LayerMask.op_Implicit(SosigLayerMask)))
{
continue;
}
Collider collider = ((RaycastHit)(ref val)).collider;
if (CanBleedPlayer && (Object)(object)GM.CurrentPlayerBody != (Object)null)
{
if (PlayerBleedingImmunity.IsBloodless())
{
continue;
}
FVRPlayerHitbox component = ((Component)collider).GetComponent<FVRPlayerHitbox>();
if ((Object)(object)component != (Object)null)
{
float distance = ((RaycastHit)(ref val)).distance;
float num = 1f - distance / BleedingRadius;
num = Mathf.Clamp01(num);
float num2 = PlayerBleedingDamagePercent / (float)BleedProjectileCount * num;
if (num2 > 0f)
{
ApplyPlayerBleeding(num2);
}
}
}
SosigLink component2 = ((Component)collider).GetComponent<SosigLink>();
if ((Object)(object)component2 == (Object)null && (Object)(object)collider.attachedRigidbody != (Object)null)
{
component2 = ((Component)collider.attachedRigidbody).GetComponent<SosigLink>();
}
if ((Object)(object)component2 != (Object)null && (Object)(object)component2.S != (Object)null && component2.S.Mustard > 0f)
{
float distance2 = ((RaycastHit)(ref val)).distance;
float num3 = 1f - distance2 / BleedingRadius;
num3 = Mathf.Clamp01(num3);
float num4 = BleedingAmount * num3;
if (num4 > 0f)
{
CreateBleedingEvent(component2, ((RaycastHit)(ref val)).point, randomDirection, num4);
}
}
}
}
private void CreateBleedingEvent(SosigLink sosigLink, Vector3 hitPoint, Vector3 direction, float bloodAmount)
{
//IL_0050: 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_0056: 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_0063: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Invalid comparison between Unknown and I4
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: 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_0162: Expected O, but got Unknown
if ((Object)(object)sosigLink == (Object)null || (Object)(object)sosigLink.S == (Object)null || sosigLink.S.Mustard <= 0f)
{
return;
}
Sosig s = sosigLink.S;
float num = bloodAmount * s.BleedDamageMult;
Vector3 val = sosigLink.C.ClosestPoint(hitPoint);
Vector3 val2 = -((Vector3)(ref direction)).normalized;
if (num >= 10f && (Object)(object)s.DamageFX_LargeMustardBurst != (Object)null)
{
Object.Instantiate<GameObject>(s.DamageFX_LargeMustardBurst, val, Quaternion.LookRotation(val2));
}
if (num >= 1f && (Object)(object)s.DamageFX_SmallMustardBurst != (Object)null)
{
Object.Instantiate<GameObject>(s.DamageFX_SmallMustardBurst, val, Quaternion.LookRotation(val2));
}
if (num >= 0.1f)
{
GameObject val3 = ((!(num >= 10f)) ? s.DamageFX_MustardSpoutSmall : s.DamageFX_MustardSpoutLarge);
if ((Object)(object)val3 != (Object)null)
{
Type typeFromHandle = typeof(Sosig);
FieldInfo field = typeFromHandle.GetField("m_bleedingEvents", BindingFlags.Instance | BindingFlags.NonPublic);
if ((object)field != null && field.GetValue(s) is List<BleedingEvent> list)
{
float num2 = Mathf.Max(num, 1f);
BleedingEvent item = new BleedingEvent(val3, sosigLink, num2, val, val2, num2 * 0.25f, s.BleedVFXIntensity);
list.Add(item);
}
}
}
if ((int)s.BodyState != 3 && (int)sosigLink.BodyPart == 0)
{
Type typeFromHandle2 = typeof(Sosig);
typeFromHandle2.GetField("m_receivedHeadShot", BindingFlags.Instance | BindingFlags.NonPublic)?.SetValue(s, true);
}
}
private void ApplyPlayerBleeding(float damagePercent)
{
if (!((Object)(object)GM.CurrentPlayerBody == (Object)null))
{
GM.CurrentPlayerBody.m_isHurting = true;
GM.CurrentPlayerBody.m_isHealing = false;
float buffIntensity_HealHarm = damagePercent / PlayerBleedingDuration;
if (GM.CurrentPlayerBody.m_debuffTime_Hurt <= 0f)
{
GM.CurrentPlayerBody.m_buffIntensity_HealHarm = buffIntensity_HealHarm;
GM.CurrentPlayerBody.m_debuffTime_Hurt = PlayerBleedingDuration;
return;
}
float num = GM.CurrentPlayerBody.m_buffIntensity_HealHarm * GM.CurrentPlayerBody.m_debuffTime_Hurt;
float num2 = num + damagePercent;
float num3 = Mathf.Max(GM.CurrentPlayerBody.m_debuffTime_Hurt, PlayerBleedingDuration);
GM.CurrentPlayerBody.m_buffIntensity_HealHarm = num2 / num3;
GM.CurrentPlayerBody.m_debuffTime_Hurt = num3;
}
}
public void StopPlayerBleeding()
{
if (!((Object)(object)GM.CurrentPlayerBody == (Object)null))
{
GM.CurrentPlayerBody.m_isHurting = false;
GM.CurrentPlayerBody.m_debuffTime_Hurt = 0f;
GM.CurrentPlayerBody.m_buffIntensity_HealHarm = 0f;
}
}
public bool IsPlayerBleeding()
{
if ((Object)(object)GM.CurrentPlayerBody == (Object)null)
{
return false;
}
return GM.CurrentPlayerBody.m_isHurting && GM.CurrentPlayerBody.m_debuffTime_Hurt > 0f;
}
private Vector3 GetRandomDirection()
{
//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_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Random.onUnitSphere;
if (BleedProjectileSpread < 180f)
{
Vector3 forward = Vector3.forward;
float num = BleedProjectileSpread * ((float)Math.PI / 180f) * 0.5f;
float num2 = Random.Range(0f, num);
float num3 = Random.Range(0f, (float)Math.PI * 2f);
val = Quaternion.Euler(Mathf.Sin(num3) * num2 * 57.29578f, Mathf.Cos(num3) * num2 * 57.29578f, 0f) * forward;
}
return ((Vector3)(ref val)).normalized;
}
private void OnValidate()
{
if (ShowGizmos && !previousShowGizmos)
{
GenerateGizmoRaycasts();
}
previousShowGizmos = ShowGizmos;
}
private void GenerateGizmoRaycasts()
{
//IL_002e: 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_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_0082: 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_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)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
if (BleedProjectileCount <= 0)
{
cachedGizmoDirections = null;
cachedGizmoHits = null;
cachedGizmoHitResults = null;
return;
}
Vector3 position = ((Component)this).transform.position;
cachedGizmoDirections = (Vector3[])(object)new Vector3[BleedProjectileCount];
cachedGizmoHits = (RaycastHit[])(object)new RaycastHit[BleedProjectileCount];
cachedGizmoHitResults = new bool[BleedProjectileCount];
for (int i = 0; i < BleedProjectileCount; i++)
{
Vector3 randomDirection = GetRandomDirection();
cachedGizmoDirections[i] = randomDirection;
cachedGizmoHitResults[i] = Physics.Raycast(position, randomDirection, ref cachedGizmoHits[i], BleedingRadius, LayerMask.op_Implicit(SosigLayerMask));
}
}
private void OnDrawGizmos()
{
//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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: 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_00f0: 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)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
if (!ShowGizmos || !InducesBleeding)
{
return;
}
if (cachedGizmoDirections == null || cachedGizmoHits == null || cachedGizmoHitResults == null)
{
GenerateGizmoRaycasts();
}
Vector3 position = ((Component)this).transform.position;
Gizmos.color = GizmoRadiusColor;
Gizmos.DrawWireSphere(position, BleedingRadius);
if (cachedGizmoDirections == null || cachedGizmoDirections.Length <= 0)
{
return;
}
Gizmos.color = GizmoRaycastColor;
for (int i = 0; i < cachedGizmoDirections.Length; i++)
{
Vector3 val = cachedGizmoDirections[i];
if (cachedGizmoHitResults[i])
{
Gizmos.DrawLine(position, ((RaycastHit)(ref cachedGizmoHits[i])).point);
Gizmos.DrawSphere(((RaycastHit)(ref cachedGizmoHits[i])).point, 0.05f);
}
else
{
Vector3 val2 = position + val * BleedingRadius;
Gizmos.DrawLine(position, val2);
Gizmos.DrawWireSphere(val2, 0.03f);
}
}
}
}
public class GrenadeMod : FVRPhysicalObject
{
[Header("Grenade Settings")]
public GameObject grenadeGameObject;
public PinnedGrenadeRing pinnedGrenadeRing;
public Rigidbody grenadeRigidbody;
public bool activateLeverOnPinPull = false;
[Header("Sticky Grenade Settings")]
public bool isStickyGrenade = true;
public Collider stickyCollider;
public float stickingDistance = 0.1f;
public LayerMask stickyLayers;
public float embeddingDistance = 0.02f;
public bool playStickSoundForRigidbodiesOnly = true;
public AudioSource stickSoundSource;
public AudioClip[] stickSounds;
public float minimumStickVelocity = 2f;
public float regrabActivationDelay = 0.5f;
public float massWhileStuck = 10f;
[Header("Grenade Cooking Settings")]
public GameObject pinPullEffectPrefab;
public AudioSource cookingAudioSource;
public AudioClip[] cookingClips;
public float cookingSoundDelay = 1f;
[Header("Grenade Fast Throw Settings")]
public AudioSource fastThrowAudioSource;
public AudioClip[] fastThrowClips;
public float fastThrowVelocityThreshold = 10f;
public float releaseWindow = 0.5f;
private PinnedGrenade grenade;
private Collider grenadeCollider;
private bool hasPlayedFastThrowSound = false;
private bool isPinPulled = false;
private bool isHeld = false;
private bool wasHeld = false;
private bool pinPulledChecked = false;
private bool shouldCheckVelocity = false;
private bool hasReleasedLever = false;
private bool isSticking = false;
private float timeSinceRelease = 0f;
private GameObject parentObject;
private FVRInteractiveObject interactiveObject;
private bool isCookingCoroutineRunning = false;
public override void Start()
{
interactiveObject = ((Component)this).GetComponent<FVRInteractiveObject>();
((FVRInteractiveObject)this).Start();
}
public override void FVRUpdate()
{
((FVRPhysicalObject)this).FVRUpdate();
if ((Object)(object)grenadeGameObject == (Object)null)
{
return;
}
grenade = grenadeGameObject.GetComponent<PinnedGrenade>();
if ((Object)(object)grenade == (Object)null)
{
return;
}
FVRPhysicalObject component = grenadeGameObject.GetComponent<FVRPhysicalObject>();
if ((Object)(object)component == (Object)null)
{
return;
}
grenadeCollider = grenadeGameObject.GetComponent<Collider>();
if ((Object)(object)grenadeCollider == (Object)null)
{
return;
}
isHeld = ((FVRInteractiveObject)component).IsHeld;
if ((Object)(object)pinnedGrenadeRing != (Object)null)
{
isPinPulled = pinnedGrenadeRing.HasPinDetached();
if (!pinPulledChecked && isPinPulled)
{
pinPulledChecked = true;
shouldCheckVelocity = true;
if (isStickyGrenade)
{
EnableStickyCollider();
}
if ((Object)(object)pinPullEffectPrefab != (Object)null)
{
pinPullEffectPrefab.SetActive(true);
}
}
if (!wasHeld && isHeld)
{
hasPlayedFastThrowSound = false;
timeSinceRelease = 0f;
if (isPinPulled)
{
EnableStickyCollider();
}
shouldCheckVelocity = isPinPulled;
wasHeld = true;
isSticking = false;
FixedJoint component2 = ((Component)this).GetComponent<FixedJoint>();
if ((Object)(object)component2 != (Object)null)
{
Object.Destroy((Object)(object)component2);
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.detectCollisions = true;
grenadeRigidbody.useGravity = true;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
Debug.Log((object)"FixedJoint grenade unstuck upon being picked up.");
}
else if ((Object)(object)((Component)this).transform.parent != (Object)null && ((Object)((Component)((Component)this).transform.parent).gameObject).name == "DummyParent")
{
GameObject gameObject = ((Component)((Component)this).transform.parent).gameObject;
((Component)this).transform.SetParent((Transform)null, true);
Object.Destroy((Object)(object)gameObject);
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.detectCollisions = true;
grenadeRigidbody.useGravity = true;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
Debug.Log((object)"Static-stuck grenade unstuck upon being picked up.");
}
if (isStickyGrenade)
{
DisableStickyColliderTemporarily();
}
}
if (wasHeld && !isHeld)
{
isSticking = false;
wasHeld = false;
}
}
if (isPinPulled || !isHeld)
{
DisableMeleeDamage(component);
}
else
{
EnableMeleeDamage(component);
}
if (isPinPulled && !cookingAudioSource.isPlaying && cookingClips.Length > 0 && !isCookingCoroutineRunning)
{
if (cookingSoundDelay == 0f)
{
PlayCookingSoundImmediately();
}
else
{
((MonoBehaviour)this).StartCoroutine(HandleCookingSoundDelay());
}
}
if (isPinPulled && (Object)(object)pinPullEffectPrefab != (Object)null)
{
pinPullEffectPrefab.SetActive(true);
}
if (isPinPulled && activateLeverOnPinPull && !hasReleasedLever)
{
grenade.ReleaseLever();
hasReleasedLever = true;
}
}
public override void FVRFixedUpdate()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).FVRFixedUpdate();
if (!shouldCheckVelocity || isHeld)
{
}
if (!shouldCheckVelocity || isHeld)
{
return;
}
timeSinceRelease += Time.fixedDeltaTime;
if (timeSinceRelease <= releaseWindow)
{
Vector3 velocity = grenadeRigidbody.velocity;
if (((Vector3)(ref velocity)).magnitude > fastThrowVelocityThreshold && !hasPlayedFastThrowSound)
{
PlayFastThrowSound();
}
}
else
{
shouldCheckVelocity = false;
}
}
private void DisableMeleeDamage(FVRPhysicalObject physicalObject)
{
if (physicalObject.MP != null && physicalObject.MP.IsMeleeWeapon)
{
physicalObject.MP.IsMeleeWeapon = false;
}
}
private void EnableMeleeDamage(FVRPhysicalObject physicalObject)
{
if (physicalObject.MP != null && !physicalObject.MP.IsMeleeWeapon)
{
physicalObject.MP.IsMeleeWeapon = true;
}
}
private void PlayFastThrowSound()
{
if (fastThrowClips.Length > 0 && (Object)(object)fastThrowAudioSource != (Object)null)
{
AudioClip val = fastThrowClips[Random.Range(0, fastThrowClips.Length)];
fastThrowAudioSource.PlayOneShot(val);
}
hasPlayedFastThrowSound = true;
}
public override void OnCollisionEnter(Collision collision)
{
//IL_00bd: 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)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).OnCollisionEnter(collision);
if (!isPinPulled || isSticking || !isStickyGrenade || !((Object)(object)stickyCollider != (Object)null) || (Object)(object)collision.gameObject.GetComponent<BreakableGlass>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenade>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<PinnedGrenadePin>() != (Object)null || (Object)(object)collision.gameObject.GetComponent<SosigWeapon>() != (Object)null)
{
return;
}
ContactPoint[] contacts = collision.contacts;
for (int i = 0; i < contacts.Length; i++)
{
ContactPoint contact = contacts[i];
if (!((Object)(object)((ContactPoint)(ref contact)).thisCollider == (Object)(object)stickyCollider))
{
continue;
}
if ((LayerMask.op_Implicit(stickyLayers) & (1 << collision.gameObject.layer)) == 0 || !IsContactPointWithinStickingDistance(((ContactPoint)(ref contact)).point))
{
break;
}
isSticking = true;
StickToSurface(collision, contact);
PlayStickingSound(collision);
parentObject = collision.gameObject;
if ((Object)(object)parentObject != (Object)null)
{
DestroyNotifier destroyNotifier = parentObject.GetComponent<DestroyNotifier>();
if ((Object)(object)destroyNotifier == (Object)null)
{
destroyNotifier = parentObject.AddComponent<DestroyNotifier>();
}
destroyNotifier.OnDestroyed += OnDestroyUnstickGrenade;
}
break;
}
}
private bool IsContactPointWithinStickingDistance(Vector3 contactPoint)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_000f: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = stickyCollider.ClosestPoint(contactPoint);
float num = Vector3.Distance(contactPoint, val);
return num < stickingDistance;
}
private void StickToSurface(Collision collision, ContactPoint contact)
{
//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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)stickyCollider == (Object)null)
{
return;
}
if ((Object)(object)interactiveObject != (Object)null && interactiveObject.IsHeld)
{
interactiveObject.ForceBreakInteraction();
}
Vector3 lossyScale = ((Component)this).transform.lossyScale;
Quaternion rotation = ((Component)this).transform.rotation;
Rigidbody rigidbody = collision.rigidbody;
Vector3 val = ((ContactPoint)(ref contact)).normal * embeddingDistance;
if ((Object)(object)rigidbody != (Object)null)
{
((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val;
FixedJoint component = ((Component)this).GetComponent<FixedJoint>();
if ((Object)(object)component != (Object)null)
{
Object.Destroy((Object)(object)component);
}
FixedJoint val2 = ((Component)this).gameObject.AddComponent<FixedJoint>();
((Joint)val2).connectedBody = rigidbody;
((Joint)val2).breakForce = float.MaxValue;
((Joint)val2).breakTorque = float.MaxValue;
grenadeRigidbody.useGravity = false;
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
grenadeRigidbody.mass = massWhileStuck;
SetCollidersToLayer(stickyCollider, "NoCol");
}
else
{
GameObject val3 = new GameObject("DummyParent");
val3.transform.position = ((ContactPoint)(ref contact)).point;
val3.transform.rotation = collision.transform.rotation;
grenadeRigidbody.isKinematic = true;
val3.transform.SetParent(collision.transform, true);
((Component)this).transform.SetParent(val3.transform, false);
((Component)this).transform.localScale = new Vector3(lossyScale.x / ((Component)this).transform.lossyScale.x, lossyScale.y / ((Component)this).transform.lossyScale.y, lossyScale.z / ((Component)this).transform.lossyScale.z);
((Component)this).transform.position = ((ContactPoint)(ref contact)).point + val;
((Component)this).transform.rotation = rotation;
}
}
private void EnableStickyCollider()
{
if ((Object)(object)stickyCollider != (Object)null)
{
stickyCollider.enabled = true;
}
}
private void DisableStickyColliderTemporarily()
{
if ((Object)(object)stickyCollider != (Object)null)
{
stickyCollider.enabled = false;
}
((MonoBehaviour)this).StartCoroutine(ReenableStickyColliderAfterDelay());
}
private IEnumerator ReenableStickyColliderAfterDelay()
{
yield return (object)new WaitForSeconds(regrabActivationDelay);
EnableStickyCollider();
}
private void PlayStickingSound(Collision collision)
{
if ((Object)(object)stickSoundSource != (Object)null && stickSounds.Length > 0 && ((playStickSoundForRigidbodiesOnly && (Object)(object)collision.rigidbody != (Object)null) || !playStickSoundForRigidbodiesOnly))
{
int num = Random.Range(0, stickSounds.Length);
stickSoundSource.clip = stickSounds[num];
stickSoundSource.Play();
}
}
private void OnDestroyUnstickGrenade()
{
if ((Object)(object)this == (Object)null)
{
return;
}
if ((Object)(object)parentObject != (Object)null)
{
DestroyNotifier component = parentObject.GetComponent<DestroyNotifier>();
if ((Object)(object)component != (Object)null)
{
component.OnDestroyed -= OnDestroyUnstickGrenade;
}
parentObject = null;
}
FixedJoint component2 = ((Component)this).GetComponent<FixedJoint>();
if ((Object)(object)component2 != (Object)null)
{
Object.Destroy((Object)(object)component2);
}
else if ((Object)(object)((Component)this).transform.parent != (Object)null)
{
((Component)this).transform.SetParent((Transform)null);
}
if ((Object)(object)grenadeRigidbody != (Object)null)
{
grenadeRigidbody.isKinematic = false;
grenadeRigidbody.detectCollisions = true;
grenadeRigidbody.useGravity = true;
grenadeRigidbody.constraints = (RigidbodyConstraints)0;
}
isSticking = false;
if ((Object)(object)stickyCollider != (Object)null)
{
stickyCollider.enabled = false;
}
}
private void SetCollidersToLayer(Collider collider, string layer)
{
((Component)collider).gameObject.layer = LayerMask.NameToLayer(layer);
}
private IEnumerator HandleCookingSoundDelay()
{
isCookingCoroutineRunning = true;
if (cookingSoundDelay > 0f)
{
yield return (object)new WaitForSeconds(cookingSoundDelay);
}
if ((Object)(object)cookingAudioSource != (Object)null && cookingClips.Length > 0)
{
int num = Random.Range(0, cookingClips.Length);
cookingAudioSource.clip = cookingClips[num];
cookingAudioSource.Play();
}
isCookingCoroutineRunning = false;
}
private void PlayCookingSoundImmediately()
{
if ((Object)(object)cookingAudioSource != (Object)null && cookingClips.Length > 0)
{
int num = Random.Range(0, cookingClips.Length);
cookingAudioSource.clip = cookingClips[num];
cookingAudioSource.Play();
}
}
public override void OnDestroy()
{
if ((Object)(object)parentObject != (Object)null)
{
DestroyNotifier component = parentObject.GetComponent<DestroyNotifier>();
if ((Object)(object)component != (Object)null)
{
component.OnDestroyed -= OnDestroyUnstickGrenade;
}
}
((FVRPhysicalObject)this).OnDestroy();
}
}
public class DestroyNotifier : MonoBehaviour
{
public delegate void DestroyedAction();
public event DestroyedAction OnDestroyed;
private void OnDestroy()
{
if (this.OnDestroyed != null)
{
this.OnDestroyed();
}
}
}
}
public class GunStockLace : MonoBehaviour
{
public float length = 0.5f;
public float gravity = 9.81f;
public float damping = 0.05f;
public float maxDeviationAngle = 45f;
public LayerMask collisionMask;
public bool showGizmos = false;
private Vector3 pendulumDirection;
private Vector3 angularVelocity;
private Quaternion baseRotation;
private Vector3 restDirection;
private Vector3 previousPosition;
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
baseRotation = ((Component)this).transform.rotation;
restDirection = baseRotation * -Vector3.up;
pendulumDirection = restDirection;
previousPosition = ((Component)this).transform.position;
}
private void FixedUpdate()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)this).transform.position - previousPosition;
previousPosition = ((Component)this).transform.position;
float fixedDeltaTime = Time.fixedDeltaTime;
Vector3 val2 = Vector3.Cross(((Vector3)(ref pendulumDirection)).normalized, Vector3.down) * gravity / length;
Vector3 val3 = val * 10f / fixedDeltaTime;
angularVelocity += (val2 + val3) * fixedDeltaTime;
angularVelocity *= Mathf.Clamp01(1f - damping * fixedDeltaTime);
Quaternion val4 = Quaternion.Euler(angularVelocity * fixedDeltaTime * 57.29578f);
pendulumDirection = val4 * pendulumDirection;
HandleCollisionLimits();
ClampToMaxAngle();
((Component)this).transform.rotation = Quaternion.FromToRotation(-Vector3.up, pendulumDirection) * baseRotation;
}
private void HandleCollisionLimits()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)this).transform.position, pendulumDirection, ref val, length, LayerMask.op_Implicit(collisionMask)))
{
Vector3 normal = ((RaycastHit)(ref val)).normal;
Vector3 val2 = Vector3.ProjectOnPlane(pendulumDirection, normal);
Vector3 normalized = ((Vector3)(ref val2)).normalized;
float num = Vector3.Angle(pendulumDirection, normalized);
pendulumDirection = Vector3.RotateTowards(pendulumDirection, normalized, num * ((float)Math.PI / 180f), 0f);
angularVelocity = Vector3.ProjectOnPlane(angularVelocity, normal);
}
}
private void ClampToMaxAngle()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Angle(restDirection, pendulumDirection);
if (num > maxDeviationAngle)
{
pendulumDirection = Vector3.RotateTowards(restDirection, pendulumDirection, maxDeviationAngle * ((float)Math.PI / 180f), 0f);
angularVelocity *= 0.5f;
}
}
private void OnDrawGizmos()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
if (showGizmos)
{
Gizmos.color = Color.yellow;
Gizmos.DrawLine(((Component)this).transform.position, ((Component)this).transform.position + pendulumDirection * length);
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(((Component)this).transform.position + pendulumDirection * length, 0.02f);
}
}
}
public class HuntDollarSR : MonoBehaviour
{
private IEnumerator Start()
{
yield return (object)new WaitForSeconds(3f);
string str = "CharcoalBriquette(Clone)";
((Object)((Component)this).gameObject).name = str;
Collider[] componentsInChildren = ((Component)this).GetComponentsInChildren<Collider>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
Component val = (Component)(object)componentsInChildren[i];
((Object)val.gameObject).name = str;
}
}
}
public class PlayRandomSoundOnSpawn : MonoBehaviour
{
public AudioClip[] spawnSounds;
public float volume = 1f;
[Header("Pitch Settings")]
public float minPitch = 0.9f;
public float maxPitch = 1.1f;
private AudioSource audioSource;
private void Start()
{
if (spawnSounds.Length > 0)
{
audioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
audioSource.playOnAwake = false;
audioSource.spatialBlend = 1f;
audioSource.volume = volume;
AudioClip val = spawnSounds[Random.Range(0, spawnSounds.Length)];
audioSource.pitch = Random.Range(minPitch, maxPitch);
audioSource.PlayOneShot(val);
}
}
}
public class RandomSpinOnSpawn : MonoBehaviour
{
public float spinForce = 0.5f;
public Vector3 torqueAxis = new Vector3(1f, 0f, 0f);
private Rigidbody rb;
private void Start()
{
//IL_003e: 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_005f: Unknown result type (might be due to invalid IL or missing references)
rb = ((Component)this).GetComponent<Rigidbody>();
if ((Object)(object)rb != (Object)null)
{
((Component)this).transform.rotation = Quaternion.Euler(0f, Random.Range(0f, 360f), 0f);
rb.AddTorque(((Vector3)(ref torqueAxis)).normalized * spinForce, (ForceMode)1);
}
}
}