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 OpenScripts2;
using OtherLoader;
using UnityEngine;
using VolksScripts;
[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 Volks.BTAPR308Rifle
{
[BepInPlugin("Volks.BTAPR308Rifle", "BTAPR308Rifle", "1.0.2")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class BTAPR308RiflePlugin : 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(), "Volks.BTAPR308Rifle");
OtherLoader.RegisterDirectLoad(BasePath, "Volks.BTAPR308Rifle", "", "", "apr308rifle", "");
}
}
}
namespace VolksScripts
{
public class PocketWatch : FVRPhysicalObject
{
[SerializeField]
private GameObject secondsHandle;
[SerializeField]
private GameObject minutesHandle;
[SerializeField]
private GameObject hoursHandle;
private float secondsMultiplier = 1f;
public Transform WatchLid;
public float openRotationX = 90f;
public float openRotationY = 0f;
public float openRotationZ = 0f;
public float closeRotationX = 0f;
public float closeRotationY = 0f;
public float closeRotationZ = 0f;
public float rotationSpeed = 5f;
private bool isOpen = false;
[SerializeField]
private AudioSource openCloseAudioSource;
[SerializeField]
private AudioClip openClip;
[SerializeField]
private AudioClip closeClip;
[SerializeField]
private AudioSource tickingAudioSource;
[SerializeField]
private AudioClip tickingClip;
private Coroutine tickingCoroutine;
private bool isTouching = false;
private Vector2 initTouch = Vector2.zero;
private Vector2 LastTouchPoint = Vector2.zero;
private void Update()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: 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_00c7: 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_0109: Unknown result type (might be due to invalid IL or missing references)
DateTime now = DateTime.Now;
int second = now.Second;
int minute = now.Minute;
int hour = now.Hour;
float num = second * 6;
float num2 = (float)(minute * 6) + (float)second * 0.1f;
float num3 = (float)(hour * 30) + (float)minute * 0.5f;
secondsHandle.transform.localRotation = Quaternion.Euler(0f - num, 0f, 0f);
minutesHandle.transform.localRotation = Quaternion.Euler(0f - num2, 0f, 0f);
hoursHandle.transform.localRotation = Quaternion.Euler(0f - num3, 0f, 0f);
Quaternion val = ((!isOpen) ? Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ) : Quaternion.Euler(openRotationX, openRotationY, openRotationZ));
WatchLid.localRotation = Quaternion.Lerp(WatchLid.localRotation, val, Time.deltaTime * rotationSpeed);
}
public void ToggleLid()
{
isOpen = !isOpen;
if (isOpen)
{
openCloseAudioSource.PlayOneShot(openClip);
if (tickingCoroutine == null)
{
tickingCoroutine = ((MonoBehaviour)this).StartCoroutine(PlayTickingSound());
}
return;
}
openCloseAudioSource.PlayOneShot(closeClip);
if (tickingCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(tickingCoroutine);
tickingCoroutine = null;
}
tickingAudioSource.Stop();
}
private IEnumerator PlayTickingSound()
{
while (true)
{
tickingAudioSource.PlayOneShot(tickingClip);
yield return (object)new WaitForSeconds(1f);
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0108: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_00c8: 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_008c: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonDown || hand.Input.AXButtonDown)
{
ToggleLid();
}
return;
}
if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero)
{
isTouching = true;
initTouch = hand.Input.TouchpadAxes;
}
if (hand.Input.TouchpadTouchUp && isTouching)
{
isTouching = false;
Vector2 lastTouchPoint = LastTouchPoint;
float y = (lastTouchPoint - initTouch).y;
if (y > 0.5f || y < -0.5f)
{
ToggleLid();
}
initTouch = Vector2.zero;
lastTouchPoint = Vector2.zero;
}
LastTouchPoint = hand.Input.TouchpadAxes;
}
}
public class CigarCase : FVRPhysicalObject
{
private bool isOpen = false;
private bool isTouching = false;
private Vector2 initTouch = Vector2.zero;
private Vector2 LastTouchPoint = Vector2.zero;
public Transform CaseLid;
public float openRotationX = 90f;
public float openRotationY = 0f;
public float openRotationZ = 0f;
public float closeRotationX = 0f;
public float closeRotationY = 0f;
public float closeRotationZ = 0f;
public float rotationSpeed = 5f;
public AudioSource audioSource;
public AudioClip openSound;
public AudioClip closeSound;
public GameObject objectToToggle;
public List<Transform> Dings;
public int m_numDings;
public CigarCaseTrigger cigarCaseTrigger;
private Quaternion targetRotation;
public override void Start()
{
//IL_0019: 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)
CaseLid.localRotation = Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ);
targetRotation = CaseLid.localRotation;
}
private void Update()
{
//IL_000d: 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_0024: Unknown result type (might be due to invalid IL or missing references)
CaseLid.localRotation = Quaternion.Lerp(CaseLid.localRotation, targetRotation, Time.deltaTime * rotationSpeed);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0108: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_00c8: 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_008c: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (hand.IsInStreamlinedMode)
{
if (hand.Input.BYButtonDown || hand.Input.AXButtonDown)
{
ToggleLid();
}
return;
}
if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero)
{
isTouching = true;
initTouch = hand.Input.TouchpadAxes;
}
if (hand.Input.TouchpadTouchUp && isTouching)
{
isTouching = false;
Vector2 lastTouchPoint = LastTouchPoint;
float y = (lastTouchPoint - initTouch).y;
if (y > 0.5f || y < -0.5f)
{
ToggleLid();
}
initTouch = Vector2.zero;
lastTouchPoint = Vector2.zero;
}
LastTouchPoint = hand.Input.TouchpadAxes;
}
private void ToggleLid()
{
//IL_004a: 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_004f: Unknown result type (might be due to invalid IL or missing references)
isOpen = !isOpen;
targetRotation = ((!isOpen) ? Quaternion.Euler(closeRotationX, closeRotationY, closeRotationZ) : Quaternion.Euler(openRotationX, openRotationY, openRotationZ));
if (isOpen)
{
if ((Object)(object)audioSource != (Object)null && (Object)(object)openSound != (Object)null)
{
audioSource.PlayOneShot(openSound);
}
if ((Object)(object)objectToToggle != (Object)null)
{
objectToToggle.SetActive(true);
}
Open();
}
else
{
if ((Object)(object)audioSource != (Object)null && (Object)(object)closeSound != (Object)null)
{
audioSource.PlayOneShot(closeSound);
}
if ((Object)(object)objectToToggle != (Object)null)
{
objectToToggle.SetActive(false);
}
Close();
}
}
public bool IsOpen()
{
return isOpen;
}
public bool HasADing()
{
return m_numDings > 0;
}
public override void FVRUpdate()
{
((FVRPhysicalObject)this).FVRUpdate();
}
public void Open()
{
isOpen = true;
if ((Object)(object)audioSource != (Object)null && (Object)(object)openSound != (Object)null)
{
audioSource.PlayOneShot(openSound);
}
UpdateDingDisplay();
}
public void Close()
{
isOpen = false;
if ((Object)(object)audioSource != (Object)null && (Object)(object)closeSound != (Object)null)
{
audioSource.PlayOneShot(closeSound);
}
UpdateDingDisplay();
}
public void RemoveDing()
{
if (m_numDings > 0)
{
m_numDings--;
UpdateDingDisplay();
}
}
private void UpdateDingDisplay()
{
for (int i = 0; i < Dings.Count; i++)
{
if (i < m_numDings)
{
((Component)Dings[i]).gameObject.SetActive(true);
}
else
{
((Component)Dings[i]).gameObject.SetActive(false);
}
}
}
}
}
public class CigarCaseTrigger : FVRInteractiveObject
{
public CigarCase cigarCase;
public GameObject cigarPrefab;
public override bool IsInteractable()
{
return cigarCase.HasADing() && ((FVRInteractiveObject)this).IsInteractable();
}
public override void BeginInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).SimpleInteraction(hand);
}
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_0030: 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)
((FVRInteractiveObject)this).SimpleInteraction(hand);
if (cigarCase.IsOpen())
{
cigarCase.RemoveDing();
GameObject val = Object.Instantiate<GameObject>(cigarPrefab, ((HandInput)(ref hand.Input)).Pos, ((HandInput)(ref hand.Input)).Rot);
FVRPhysicalObject component = val.GetComponent<FVRPhysicalObject>();
hand.ForceSetInteractable((FVRInteractiveObject)(object)component);
((FVRInteractiveObject)component).BeginInteraction(hand);
}
else
{
cigarCase.Open();
}
}
}
public class FVRCigar : QBArmorHelmet
{
public GameObject FireGO;
public GameObject LinkedObject;
public AudioSource fireAud;
public float BurnDuration = 120f;
public float DestructionDelay = 10f;
public MeshFilter cigarMeshFilter;
public MeshRenderer cigarRenderer;
public Mesh burntMesh;
public Material burntMaterial;
public float damageInterval = 1f;
private float damageTimer = 0f;
private bool m_isBurning = false;
private bool m_hasBeenLit = false;
private float m_burnTimer;
private bool m_isEquipped = false;
private float m_unequippedTimer = 0f;
private bool m_hasBurntOut = false;
private FVRPlayerBody playerBody;
public float damageAmount = 1f;
public override void Awake()
{
((QBArmorHelmet)this).Awake();
if ((Object)(object)FireGO != (Object)null)
{
fireAud = FireGO.GetComponent<AudioSource>();
FireGO.SetActive(false);
}
if ((Object)(object)LinkedObject != (Object)null)
{
LinkedObject.SetActive(false);
}
playerBody = Object.FindObjectOfType<FVRPlayerBody>();
}
public override void FVRUpdate()
{
((QBArmorPiece)this).FVRUpdate();
if (m_isBurning)
{
m_burnTimer -= Time.deltaTime;
if ((Object)(object)fireAud != (Object)null)
{
fireAud.volume = Mathf.Lerp(fireAud.volume, 0f, Time.deltaTime / BurnDuration);
}
if (m_burnTimer <= 0f)
{
StopBurning();
}
if (m_isEquipped && (Object)(object)playerBody != (Object)null)
{
damageTimer += Time.deltaTime;
if (damageTimer >= damageInterval)
{
playerBody.RegisterPlayerHit(1f, false, playerBody.GetPlayerIFF());
damageTimer = 0f;
}
}
}
if (m_hasBurntOut && !m_isEquipped && !((FVRInteractiveObject)this).IsHeld)
{
m_unequippedTimer += Time.deltaTime;
if (m_unequippedTimer >= DestructionDelay)
{
Debug.Log((object)"Cigar destroyed after being unequipped and left alone.");
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
else
{
m_unequippedTimer = 0f;
}
}
public void Ignite()
{
if (!m_hasBeenLit)
{
m_hasBeenLit = true;
m_isBurning = true;
m_burnTimer = BurnDuration;
if ((Object)(object)FireGO != (Object)null)
{
FireGO.SetActive(true);
}
if ((Object)(object)fireAud != (Object)null)
{
fireAud.Play();
}
if ((Object)(object)LinkedObject != (Object)null)
{
LinkedObject.SetActive(true);
}
}
}
private void StopBurning()
{
m_isBurning = false;
m_hasBurntOut = true;
if ((Object)(object)FireGO != (Object)null)
{
FireGO.SetActive(false);
}
if ((Object)(object)fireAud != (Object)null)
{
fireAud.Stop();
}
if ((Object)(object)cigarMeshFilter != (Object)null && (Object)(object)burntMesh != (Object)null)
{
cigarMeshFilter.mesh = burntMesh;
}
if ((Object)(object)cigarRenderer != (Object)null && (Object)(object)burntMaterial != (Object)null)
{
((Renderer)cigarRenderer).material = burntMaterial;
}
Debug.Log((object)"Cigar has burnt out.");
}
public override void SetQuickBeltSlot(FVRQuickBeltSlot slot)
{
((QBArmorHelmet)this).SetQuickBeltSlot(slot);
if ((Object)(object)slot != (Object)null)
{
m_isEquipped = true;
m_unequippedTimer = 0f;
}
else
{
m_isEquipped = false;
}
}
}
namespace VolksScripts
{
public class MatchStick : FVRPhysicalObject
{
private bool m_isLit;
private bool m_hasBurntOut;
private bool isTouching;
private Vector2 initTouch = Vector2.zero;
private Vector2 LastTouchPoint = Vector2.zero;
public Transform Flame;
private float m_flame_min = 0.1f;
private float m_flame_max = 0.85f;
private float m_flame_cur = 0.1f;
public AudioSource Audio_Lighter;
public AudioClip AudioClip_Strike;
public AudioClip AudioClip_Extinguish;
public Transform[] FlameJoints;
public float[] FlameWeights;
public ParticleSystem Sparks;
public AlloyAreaLight AlloyLight;
public LayerMask LM_FireDamage;
private RaycastHit m_hit;
public float BurnDuration = 10f;
private float burnTimer = 0f;
public float DestructionDelay = 5f;
private float destructionTimer = 0f;
public MeshFilter matchstickMeshFilter;
public MeshRenderer matchstickRenderer;
public Mesh burntMesh;
public Material burntMaterial;
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: 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_0097: 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_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (hand.IsInStreamlinedMode)
{
if ((hand.Input.BYButtonDown || hand.Input.AXButtonDown) && !m_hasBurntOut)
{
Light();
}
return;
}
if (hand.Input.TouchpadTouched && !isTouching && hand.Input.TouchpadAxes != Vector2.zero)
{
isTouching = true;
initTouch = hand.Input.TouchpadAxes;
}
if (hand.Input.TouchpadTouchUp && isTouching)
{
isTouching = false;
Vector2 lastTouchPoint = LastTouchPoint;
float y = (lastTouchPoint - initTouch).y;
if ((y > 0.5f || y < -0.5f) && !m_hasBurntOut)
{
Light();
}
initTouch = Vector2.zero;
lastTouchPoint = Vector2.zero;
}
LastTouchPoint = hand.Input.TouchpadAxes;
}
public override void FVRUpdate()
{
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: 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_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: 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_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Expected O, but got Unknown
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).FVRUpdate();
if (m_isLit)
{
burnTimer += Time.deltaTime;
if (burnTimer >= BurnDuration)
{
BurnOut();
}
m_flame_cur = Mathf.Lerp(m_flame_cur, m_flame_max, Time.deltaTime * 2f);
AlloyLight.Intensity = m_flame_cur * (Mathf.PerlinNoise(Time.time * 10f, ((Component)AlloyLight).transform.position.y) * 0.05f + 0.5f);
}
else
{
m_flame_cur = Mathf.Lerp(m_flame_cur, m_flame_min, Time.deltaTime * 7f);
}
Flame.localScale = new Vector3(m_flame_cur, m_flame_cur, m_flame_cur);
Quaternion val = Quaternion.Inverse(((Component)this).transform.rotation);
val = Quaternion.Slerp(val, Random.rotation, Mathf.PerlinNoise(Time.time * 5f, 0f) * 0.3f);
for (int i = 0; i < FlameJoints.Length; i++)
{
Quaternion val2 = Quaternion.Slerp(Quaternion.identity, val, FlameWeights[i] + Random.Range(-0.05f, 0.05f));
FlameJoints[i].localScale = new Vector3(Random.Range(0.95f, 1.05f), Random.Range(0.98f, 1.02f), Random.Range(0.95f, 1.05f));
FlameJoints[i].localRotation = Quaternion.Slerp(FlameJoints[i].localRotation, val2, Time.deltaTime * 6f);
}
if (m_isLit)
{
Vector3 position = FlameJoints[0].position;
Vector3 position2 = FlameJoints[FlameJoints.Length - 1].position;
Vector3 val3 = position2 - position;
if (Physics.Raycast(position, ((Vector3)(ref val3)).normalized, ref m_hit, ((Vector3)(ref val3)).magnitude, LayerMask.op_Implicit(LM_FireDamage), (QueryTriggerInteraction)2))
{
IFVRDamageable component = ((Component)((RaycastHit)(ref m_hit)).collider).gameObject.GetComponent<IFVRDamageable>();
if (component == null && (Object)(object)((RaycastHit)(ref m_hit)).collider.attachedRigidbody != (Object)null)
{
component = ((Component)((RaycastHit)(ref m_hit)).collider.attachedRigidbody).gameObject.GetComponent<IFVRDamageable>();
}
if (component != null)
{
IFVRDamageable obj = component;
Damage val4 = new Damage();
val4.Class = (DamageClass)2;
val4.Dam_Thermal = 50f;
val4.Dam_TotalEnergetic = 50f;
val4.point = ((RaycastHit)(ref m_hit)).point;
val4.hitNormal = ((RaycastHit)(ref m_hit)).normal;
val4.strikeDir = ((Component)this).transform.forward;
obj.Damage(val4);
}
FVRIgnitable component2 = ((Component)((Component)((RaycastHit)(ref m_hit)).collider).transform).gameObject.GetComponent<FVRIgnitable>();
if ((Object)(object)component2 == (Object)null && (Object)(object)((RaycastHit)(ref m_hit)).collider.attachedRigidbody != (Object)null)
{
((Component)((RaycastHit)(ref m_hit)).collider.attachedRigidbody).gameObject.GetComponent<FVRIgnitable>();
}
if ((Object)(object)component2 != (Object)null)
{
FXM.Ignite(component2, 0.1f);
}
}
}
if (m_hasBurntOut && !((FVRInteractiveObject)this).IsHeld)
{
destructionTimer += Time.deltaTime;
if (destructionTimer >= DestructionDelay)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRPhysicalObject)this).EndInteraction(hand);
if (m_hasBurntOut)
{
destructionTimer = 0f;
}
}
private void Light()
{
if (!m_isLit && !m_hasBurntOut)
{
Sparks.Emit(Random.Range(2, 3));
m_isLit = true;
burnTimer = 0f;
Audio_Lighter.PlayOneShot(AudioClip_Strike, 0.3f);
((Component)Flame).gameObject.SetActive(true);
}
}
private void BurnOut()
{
m_isLit = false;
m_hasBurntOut = true;
Audio_Lighter.PlayOneShot(AudioClip_Extinguish, 0.3f);
((Component)Flame).gameObject.SetActive(false);
if ((Object)(object)matchstickMeshFilter != (Object)null && (Object)(object)burntMesh != (Object)null)
{
matchstickMeshFilter.mesh = burntMesh;
}
if ((Object)(object)matchstickRenderer != (Object)null && (Object)(object)burntMaterial != (Object)null)
{
((Renderer)matchstickRenderer).material = burntMaterial;
}
destructionTimer = 0f;
}
}
}
public class TorchTrigger : MonoBehaviour
{
public FVRCigar Torch;
public Collider collider;
private void OnTriggerEnter(Collider col)
{
collider.enabled = false;
((Component)collider).gameObject.layer = LayerMask.NameToLayer("NoCol");
Torch.Ignite();
}
}