using System;
using System.Collections;
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.HuntWaterBottle
{
[BepInPlugin("BitWizrd.HuntWaterBottle", "HuntWaterBottle", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class HuntWaterBottlePlugin : 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.HuntWaterBottle");
OtherLoader.RegisterDirectLoad(BasePath, "BitWizrd.HuntWaterBottle", "", "waterbottle", "", "");
}
}
}
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.Fire
{
public static class Extingish
{
private class WetMarker : MonoBehaviour
{
public float WetUntil;
}
public static bool TryExtinguish(FVRIgnitable ignitable, float wetSeconds = 0.5f)
{
if ((Object)(object)ignitable == (Object)null)
{
return false;
}
bool result = ignitable.IsOnFire();
if ((Object)(object)ignitable.m_fireInstance != (Object)null)
{
ignitable.m_fireInstance.Stop(true, (ParticleSystemStopBehavior)0);
Object.Destroy((Object)(object)((Component)ignitable.m_fireInstance).gameObject);
}
ignitable.m_fireInstance = null;
ignitable.m_hasFireInstance = false;
ignitable.m_frequencyTick = ignitable.Dam_Frequency;
ApplyWet(ignitable, wetSeconds);
return result;
}
public static int ExtinguishInRadius(Vector3 center, float radius, LayerMask layerMask, float wetSeconds = 0.5f)
{
//IL_0001: 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)
Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(layerMask), (QueryTriggerInteraction)2);
int num = 0;
for (int i = 0; i < array.Length; i++)
{
FVRIgnitable componentInParent = ((Component)array[i]).GetComponentInParent<FVRIgnitable>();
if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)((Component)componentInParent).GetComponentInParent<FVRPhysicalObject>() != (Object)null) && TryExtinguish(componentInParent, wetSeconds))
{
num++;
}
}
return num;
}
public static bool IsWet(FVRIgnitable ignitable)
{
if ((Object)(object)ignitable == (Object)null)
{
return false;
}
WetMarker component = ((Component)ignitable).GetComponent<WetMarker>();
return (Object)(object)component != (Object)null && component.WetUntil > Time.time;
}
public static bool CanIgnite(FVRIgnitable ignitable)
{
return (Object)(object)ignitable != (Object)null && ignitable.IsIgniteable() && !IsWet(ignitable);
}
private static void ApplyWet(FVRIgnitable ignitable, float wetSeconds)
{
if (!(wetSeconds <= 0f) && !((Object)(object)ignitable == (Object)null))
{
WetMarker wetMarker = ((Component)ignitable).GetComponent<WetMarker>();
if ((Object)(object)wetMarker == (Object)null)
{
wetMarker = ((Component)ignitable).gameObject.AddComponent<WetMarker>();
}
wetMarker.WetUntil = Mathf.Max(wetMarker.WetUntil, Time.time + wetSeconds);
}
}
}
}
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;
}
}
}
namespace BitWizrd.Liquid
{
public class LiquidController : MonoBehaviour
{
[Header("Liquid Surface Settings")]
public Transform LiquidSurfaceBone;
public float SloshAmount = 40f;
public float AngularSloshFactor = 1f;
[Header("Physics Parameters")]
public float SpringConstant = 100f;
public float DampingFactor = 0.99f;
public float VelocityMultiplier = 500f;
public float SettleThreshold = 0.01f;
[Header("Axis Locks")]
[Range(0f, 1f)]
public float ZAxisInfluence = 1f;
[Header("Axis Flips")]
public bool FlipX;
public bool FlipY;
[Header("Axis Remapping")]
public bool SwapXY;
private Vector3 sloshOffset;
private Vector3 sloshVelocity;
private Rigidbody rb;
private Quaternion lastRotation;
private void Start()
{
//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_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_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)
sloshOffset = Vector3.zero;
sloshVelocity = Vector3.zero;
rb = ((Component)this).GetComponentInParent<Rigidbody>();
if ((Object)(object)rb != (Object)null)
{
lastRotation = rb.rotation;
}
}
private void Update()
{
//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_0038: 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_0056: 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_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_0078: 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_0085: 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_0094: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: 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_0134: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: 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_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: 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)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: 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_01c5: 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_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: 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_0200: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_031e: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_0331: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)rb == (Object)null) && !((Object)(object)LiquidSurfaceBone == (Object)null))
{
Vector3 val = ((Component)this).transform.InverseTransformDirection(Physics.gravity);
Vector3 normalized = ((Vector3)(ref val)).normalized;
Vector3 val2 = new Vector3(normalized.y, normalized.x, normalized.z) * SloshAmount;
Quaternion val3 = Quaternion.Inverse(lastRotation) * rb.rotation;
Vector3 val4 = ((Quaternion)(ref val3)).eulerAngles / Time.deltaTime;
((Vector3)(ref val4))..ctor(Mathf.DeltaAngle(0f, val4.x), Mathf.DeltaAngle(0f, val4.y), Mathf.DeltaAngle(0f, val4.z));
val4 = ((Component)this).transform.InverseTransformDirection(val4) * AngularSloshFactor;
Vector3 val5 = ((Component)this).transform.InverseTransformDirection(rb.velocity) * VelocityMultiplier;
Vector3 val6 = ((Component)this).transform.InverseTransformDirection(rb.angularVelocity) * AngularSloshFactor * VelocityMultiplier;
Vector3 val7 = val5 + val6 + val4;
if (ZAxisInfluence < 1f)
{
val2.z *= ZAxisInfluence;
val7.z *= ZAxisInfluence;
}
Vector3 val8 = (0f - SpringConstant) * (sloshOffset - val2);
Vector3 val9 = (0f - DampingFactor) * sloshVelocity;
Vector3 val10 = val8 + val9 + val7;
sloshVelocity += val10 * Time.deltaTime;
sloshOffset += sloshVelocity * Time.deltaTime;
if (ZAxisInfluence <= Mathf.Epsilon)
{
sloshOffset.z = 0f;
sloshVelocity.z = 0f;
}
if (((Vector3)(ref sloshVelocity)).magnitude < SettleThreshold)
{
sloshVelocity = Vector3.zero;
}
if (((Vector3)(ref sloshOffset)).magnitude < SettleThreshold)
{
sloshOffset = Vector3.zero;
}
sloshOffset = Vector3.ClampMagnitude(sloshOffset, SloshAmount);
Vector3 val11 = sloshOffset;
if (SwapXY)
{
float x = val11.x;
val11.x = val11.y;
val11.y = x;
}
if (FlipX)
{
val11.x = 0f - val11.x;
}
if (FlipY)
{
val11.y = 0f - val11.y;
}
Vector3 val12 = default(Vector3);
((Vector3)(ref val12))..ctor(0f - val11.x, 0f - val11.y, 0f - val11.z);
LiquidSurfaceBone.localRotation = Quaternion.Euler(val12);
lastRotation = rb.rotation;
}
}
}
}
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);
}
}
}
namespace BitWizrd.Fire
{
public class WetMarker : MonoBehaviour
{
public float WetUntil;
}
public class WaterBottle : FVRPhysicalObject, IFVRDamageable
{
private class ExtinguishLoopRunner : MonoBehaviour
{
private Vector3 _position;
private float _radius;
private LayerMask _mask;
private float _wetSeconds;
private int _loops;
private float _interval;
public static void Spawn(Vector3 position, float radius, LayerMask mask, float wetSeconds, int loops, float interval)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//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)
//IL_002a: 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)
GameObject val = new GameObject("WaterBottleExtinguishLoopRunner");
((Object)val).hideFlags = (HideFlags)61;
ExtinguishLoopRunner extinguishLoopRunner = val.AddComponent<ExtinguishLoopRunner>();
extinguishLoopRunner._position = position;
extinguishLoopRunner._radius = radius;
extinguishLoopRunner._mask = mask;
extinguishLoopRunner._wetSeconds = wetSeconds;
extinguishLoopRunner._loops = Mathf.Max(0, loops);
extinguishLoopRunner._interval = interval;
((MonoBehaviour)extinguishLoopRunner).StartCoroutine(extinguishLoopRunner.Run());
}
private IEnumerator Run()
{
for (int i = 0; i < _loops; i++)
{
if (_interval > 0f)
{
yield return (object)new WaitForSeconds(_interval);
}
else
{
yield return null;
}
ExtinguishFiresInRadius(_position, _radius, _mask, _wetSeconds);
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
[Header("Impact & Extinguish")]
public float ShatterThreshold = 4f;
public float ExtinguishRadius = 1.5f;
public float WetSeconds = 0.75f;
[Header("Extinguish Timing")]
[Tooltip("Additional extinguish attempts after the instant extinguish.")]
public int ExtinguishAdditionalLoops = 0;
[Tooltip("Delay between the extra extinguish attempts.")]
public float ExtinguishInterval = 0.1f;
[Header("Environment Filters")]
public LayerMask IgnitableMask = LayerMask.op_Implicit(-1);
public bool CanExplodeOnWater = false;
public LayerMask LM_Water;
[Header("FX Prefabs")]
public GameObject Prefab_ShatterFX;
public GameObject Prefab_ExtinguishFX;
[Header("Audio - Break/Splash/Extinguish")]
[Header("Audio - Slosh")]
public AudioSource SloshAudioSource;
public AudioClip[] SloshSounds;
[NonSerialized]
public bool m_hasTriggered;
[NonSerialized]
public AudioSource m_aud;
private FVRViveHand leftHand;
private FVRViveHand rightHand;
private FVRViveHand currentHandHolding;
private bool hasPlayedSloshSound;
private int lastSloshSoundIndex = -1;
private Rigidbody m_rb;
private RaycastHit m_hit;
public override void Awake()
{
((FVRPhysicalObject)this).Awake();
m_aud = ((Component)this).GetComponent<AudioSource>();
m_rb = ((Component)this).GetComponent<Rigidbody>();
if ((Object)(object)m_aud == (Object)null)
{
m_aud = ((Component)this).gameObject.AddComponent<AudioSource>();
m_aud.playOnAwake = false;
}
if ((Object)(object)SloshAudioSource == (Object)null)
{
SloshAudioSource = ((!((Object)(object)m_aud != (Object)null)) ? ((Component)this).GetComponent<AudioSource>() : m_aud);
if ((Object)(object)SloshAudioSource == (Object)null)
{
SloshAudioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
}
}
if ((Object)(object)GM.CurrentPlayerBody != (Object)null)
{
leftHand = ((!((Object)(object)GM.CurrentPlayerBody.LeftHand != (Object)null)) ? null : ((Component)GM.CurrentPlayerBody.LeftHand).GetComponent<FVRViveHand>());
rightHand = ((!((Object)(object)GM.CurrentPlayerBody.RightHand != (Object)null)) ? null : ((Component)GM.CurrentPlayerBody.RightHand).GetComponent<FVRViveHand>());
}
}
public override void FVRUpdate()
{
((FVRPhysicalObject)this).FVRUpdate();
CheckSloshSound();
CheckForWaterImpact();
}
public override void OnCollisionEnter(Collision col)
{
//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_0052: 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_0057: 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)
((FVRPhysicalObject)this).OnCollisionEnter(col);
if (!m_hasTriggered)
{
Vector3 relativeVelocity = col.relativeVelocity;
float magnitude = ((Vector3)(ref relativeVelocity)).magnitude;
Vector3 atPosition = ((col.contacts.Length <= 0) ? ((Component)this).transform.position : ((ContactPoint)(ref col.contacts[0])).point);
if (magnitude > ShatterThreshold)
{
Shatter(atPosition);
TryDamageIgnitable(col);
}
}
}
public void Damage(Damage d)
{
//IL_0024: 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_0049: 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_004e: 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)
if (!m_hasTriggered && d.Dam_TotalKinetic > 100f)
{
Vector3 atPosition = ((!(d.point != Vector3.zero)) ? ((Component)this).transform.position : d.point);
Shatter(atPosition);
}
}
private void TryDamageIgnitable(Collision col)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_0076: 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_007b: 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_00b0: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)col.collider.attachedRigidbody == (Object)null))
{
IFVRDamageable component = ((Component)col.collider.attachedRigidbody).GetComponent<IFVRDamageable>();
if (component != null)
{
Damage val = new Damage();
val.Dam_TotalEnergetic = 10f;
val.point = ((col.contacts.Length <= 0) ? ((Component)this).transform.position : ((ContactPoint)(ref col.contacts[0])).point);
val.hitNormal = ((col.contacts.Length <= 0) ? (-((Component)this).transform.forward) : ((ContactPoint)(ref col.contacts[0])).normal);
val.strikeDir = ((Component)this).transform.forward;
Damage val2 = val;
component.Damage(val2);
}
}
}
public void TriggerExtinguish(Vector3 atPosition)
{
//IL_0019: 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_0036: 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_0060: 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)
if (!m_hasTriggered)
{
m_hasTriggered = true;
bool flag = ExtinguishFiresInRadius(atPosition, ExtinguishRadius, IgnitableMask, WetSeconds) > 0;
int num = DestroyIgnitorSystems(atPosition);
if (flag || num > 0)
{
SpawnExtinguishFX(atPosition);
}
if (ExtinguishAdditionalLoops > 0)
{
ExtinguishLoopRunner.Spawn(atPosition, ExtinguishRadius, IgnitableMask, WetSeconds, ExtinguishAdditionalLoops, ExtinguishInterval);
}
KillMe();
}
}
private static int ExtinguishFiresInRadius(Vector3 center, float radius, LayerMask layerMask, float wetSeconds)
{
//IL_0001: 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)
Collider[] array = Physics.OverlapSphere(center, radius, LayerMask.op_Implicit(layerMask), (QueryTriggerInteraction)2);
int num = 0;
for (int i = 0; i < array.Length; i++)
{
FVRIgnitable componentInParent = ((Component)array[i]).GetComponentInParent<FVRIgnitable>();
if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)((Component)componentInParent).GetComponentInParent<FVRPhysicalObject>() != (Object)null) && TryExtinguishIgnitable(componentInParent, wetSeconds))
{
num++;
}
}
return num;
}
private static bool TryExtinguishIgnitable(FVRIgnitable ignitable, float wetSeconds)
{
if ((Object)(object)ignitable == (Object)null)
{
return false;
}
bool result = ignitable.IsOnFire();
if ((Object)(object)ignitable.m_fireInstance != (Object)null)
{
ignitable.m_fireInstance.Stop(true, (ParticleSystemStopBehavior)0);
Object.Destroy((Object)(object)((Component)ignitable.m_fireInstance).gameObject);
}
ignitable.m_fireInstance = null;
ignitable.m_hasFireInstance = false;
ignitable.m_frequencyTick = ignitable.Dam_Frequency;
if (wetSeconds > 0f)
{
WetMarker wetMarker = ((Component)ignitable).GetComponent<WetMarker>();
if ((Object)(object)wetMarker == (Object)null)
{
wetMarker = ((Component)ignitable).gameObject.AddComponent<WetMarker>();
}
wetMarker.WetUntil = Mathf.Max(wetMarker.WetUntil, Time.time + wetSeconds);
}
return result;
}
private void PlaySound(AudioClip clip, float minPitch, float maxPitch)
{
if (!((Object)(object)clip == (Object)null) && !((Object)(object)m_aud == (Object)null))
{
m_aud.pitch = Random.Range(minPitch, maxPitch);
m_aud.PlayOneShot(clip, Random.Range(0.9f, 1f));
}
}
private GameObject SpawnEffect(GameObject prefab, Vector3 position, Quaternion rotation, Transform parent)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)prefab == (Object)null)
{
return null;
}
GameObject val = Object.Instantiate<GameObject>(prefab, position, rotation);
if ((Object)(object)parent != (Object)null)
{
val.transform.SetParent(parent);
}
return val;
}
private void Shatter(Vector3 atPosition)
{
//IL_0013: 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)
if (!m_hasTriggered)
{
SpawnShatterFX(atPosition);
TriggerExtinguish(atPosition);
}
}
private void SpawnShatterFX(Vector3 atPosition)
{
//IL_0019: 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)
if ((Object)(object)Prefab_ShatterFX != (Object)null)
{
Object.Instantiate<GameObject>(Prefab_ShatterFX, atPosition, ((Component)this).transform.rotation);
}
}
private void CheckSloshSound()
{
FVRViveHand holdingHand;
bool flag = IsHeldByEitherHand(out holdingHand);
if (flag && (Object)(object)holdingHand != (Object)(object)currentHandHolding)
{
PlaySloshSound();
hasPlayedSloshSound = true;
currentHandHolding = holdingHand;
}
else if (!flag && hasPlayedSloshSound)
{
hasPlayedSloshSound = false;
currentHandHolding = null;
}
}
private bool IsHeldByEitherHand(out FVRViveHand holdingHand)
{
holdingHand = null;
if ((Object)(object)leftHand != (Object)null && (Object)(object)leftHand.CurrentInteractable == (Object)(object)this)
{
holdingHand = leftHand;
return true;
}
if ((Object)(object)rightHand != (Object)null && (Object)(object)rightHand.CurrentInteractable == (Object)(object)this)
{
holdingHand = rightHand;
return true;
}
return false;
}
private void PlaySloshSound()
{
if (SloshSounds == null || SloshSounds.Length == 0)
{
return;
}
if ((Object)(object)SloshAudioSource == (Object)null)
{
SloshAudioSource = ((!((Object)(object)m_aud != (Object)null)) ? ((Component)this).GetComponent<AudioSource>() : m_aud);
if ((Object)(object)SloshAudioSource == (Object)null)
{
SloshAudioSource = ((Component)this).gameObject.AddComponent<AudioSource>();
}
}
int nonRepeatingRandomIndex = GetNonRepeatingRandomIndex(SloshSounds.Length);
SloshAudioSource.PlayOneShot(SloshSounds[nonRepeatingRandomIndex]);
}
private int GetNonRepeatingRandomIndex(int length)
{
if (length <= 1)
{
return 0;
}
int num;
do
{
num = Random.Range(0, length);
}
while (num == lastSloshSoundIndex);
lastSloshSoundIndex = num;
return num;
}
private void SpawnExtinguishFX(Vector3 atPosition)
{
//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)
if ((Object)(object)Prefab_ExtinguishFX != (Object)null)
{
Object.Instantiate<GameObject>(Prefab_ExtinguishFX, atPosition, Quaternion.identity);
}
}
private int DestroyIgnitorSystems(Vector3 center)
{
//IL_0048: 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_0053: Unknown result type (might be due to invalid IL or missing references)
GameObject[] array = GameObject.FindGameObjectsWithTag("IgnitorSystem");
if (array == null || array.Length == 0)
{
return 0;
}
int num = 0;
float num2 = ExtinguishRadius * ExtinguishRadius;
foreach (GameObject val in array)
{
Vector3 val2 = val.transform.position - center;
if (((Vector3)(ref val2)).sqrMagnitude > num2)
{
continue;
}
ParticleSystem[] componentsInChildren = val.GetComponentsInChildren<ParticleSystem>(true);
foreach (ParticleSystem val3 in componentsInChildren)
{
if (!((Object)(object)val3 == (Object)null) && (Object)(object)((Component)val3).GetComponentInParent<FVRPhysicalObject>() == (Object)null)
{
Object.Destroy((Object)(object)((Component)val3).gameObject);
num++;
}
}
}
return num;
}
private void CheckForWaterImpact()
{
//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)
//IL_003f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
if (CanExplodeOnWater && !((Object)(object)m_rb == (Object)null) && Physics.Raycast(((Component)this).transform.position, Vector3.down, ref m_hit, 0.1f, LayerMask.op_Implicit(LM_Water)))
{
Vector3 velocity = m_rb.velocity;
float magnitude = ((Vector3)(ref velocity)).magnitude;
if (magnitude > ShatterThreshold)
{
Shatter(((Component)this).transform.position);
}
}
}
public void KillMe()
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public class WaterBottleFlameTrigger : MonoBehaviour, IFVRDamageable
{
public WaterBottle Target;
public bool IsArmed = true;
public void OnTriggerEnter(Collider col)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
if (IsArmed && !((Object)(object)Target == (Object)null))
{
IsArmed = false;
Target.TriggerExtinguish(((Component)col).transform.position);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public void Ignite()
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (IsArmed && !((Object)(object)Target == (Object)null))
{
IsArmed = false;
Target.TriggerExtinguish(((Component)Target).transform.position);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
public void Damage(Damage d)
{
if (IsArmed && !((Object)(object)Target == (Object)null) && d.Dam_Thermal > 0f)
{
Ignite();
}
}
}
}