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 VolksScripts
{
public class NVGPowerSwitch : FVRInteractiveObject
{
public PIPScope Scope;
[HideInInspector]
public bool Toggle = true;
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).SimpleInteraction(hand);
SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton<SM>.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position);
if (Toggle)
{
Scope.enableNightvision = (Scope.enableThermal = false);
}
else
{
Scope.enableNightvision = (Scope.enableThermal = true);
}
Toggle = !Toggle;
}
}
public class ANVIS21Control : MonoBehaviour
{
[Header("References")]
public PIPScope scope;
public Transform NVGObject;
[Header("Positions")]
public Vector3 OnLocalPosition;
public Vector3 OffLocalPosition;
public Vector3 OnLocalRotation;
public Vector3 OffLocalRotation;
[Header("Transition")]
public float TransitionSpeed = 5f;
[Header("Power State")]
public bool IsPoweredOn = false;
private Vector3 targetPos;
private Quaternion targetRot;
private void Start()
{
SetState(IsPoweredOn, instant: true);
}
private void Update()
{
//IL_001f: 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_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_0052: 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)
if ((Object)(object)NVGObject != (Object)null)
{
NVGObject.localPosition = Vector3.Lerp(NVGObject.localPosition, targetPos, Time.deltaTime * TransitionSpeed);
NVGObject.localRotation = Quaternion.Slerp(NVGObject.localRotation, targetRot, Time.deltaTime * TransitionSpeed);
}
if ((Object)(object)scope != (Object)null)
{
((Behaviour)scope).enabled = IsPoweredOn;
}
}
public void TogglePower()
{
SetState(!IsPoweredOn, instant: false);
}
public void SetState(bool on, bool instant)
{
//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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: 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_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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)
IsPoweredOn = on;
if (on)
{
targetPos = OnLocalPosition;
targetRot = Quaternion.Euler(OnLocalRotation);
}
else
{
targetPos = OffLocalPosition;
targetRot = Quaternion.Euler(OffLocalRotation);
}
if (instant && (Object)(object)NVGObject != (Object)null)
{
NVGObject.localPosition = targetPos;
NVGObject.localRotation = targetRot;
}
if ((Object)(object)scope != (Object)null)
{
((Behaviour)scope).enabled = on;
}
}
private void OnTriggerEnter(Collider other)
{
TogglePower();
}
}
}
public class ForceBindToHead : MonoBehaviour
{
[Tooltip("The object that should follow the player's head (e.g. NVG physical root).")]
public GameObject phys;
[Tooltip("Optional: if true, runs even when not equipped.")]
public bool alwaysFollow = true;
private Transform headTransform;
private void Start()
{
if ((Object)(object)GM.CurrentMovementManager != (Object)null && (Object)(object)GM.CurrentMovementManager.Head != (Object)null)
{
headTransform = ((Component)GM.CurrentMovementManager.Head).transform;
}
else
{
Debug.LogWarning((object)"[ForceBindToHead] Could not find head transform.");
}
}
private void FixedUpdate()
{
//IL_00ac: 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)
if (!((Object)(object)phys == (Object)null) && (alwaysFollow || !((Object)(object)headTransform == (Object)null)))
{
if ((Object)(object)headTransform == (Object)null && (Object)(object)GM.CurrentMovementManager != (Object)null)
{
headTransform = ((Component)GM.CurrentMovementManager.Head).transform;
}
if ((Object)(object)phys.transform.parent != (Object)(object)headTransform)
{
phys.transform.SetParent(headTransform);
}
phys.transform.localPosition = Vector3.zero;
phys.transform.localEulerAngles = Vector3.zero;
}
}
}
public class FlamethrowerValve : FVRInteractiveObject
{
[Header("References")]
public Transform RefFrame;
public Transform Valve;
[Header("Rotation Settings")]
public Vector2 ValveRotRange = new Vector2(-50f, 50f);
private float m_valveRot;
[Header("Runtime")]
public float Lerp = 0.5f;
private Vector3 refDir = Vector3.one;
public override void BeginInteraction(FVRViveHand hand)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
Vector3 up = ((HandInput)(ref hand.Input)).Up;
Vector3 val = Vector3.ProjectOnPlane(up, RefFrame.right);
refDir = ((Vector3)(ref val)).normalized;
((FVRInteractiveObject)this).BeginInteraction(hand);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_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)
//IL_0038: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
Vector3 up = ((HandInput)(ref hand.Input)).Up;
Vector3 val = Vector3.ProjectOnPlane(up, RefFrame.right);
Vector3 normalized = ((Vector3)(ref val)).normalized;
float num = Mathf.Atan2(Vector3.Dot(RefFrame.right, Vector3.Cross(refDir, normalized)), Vector3.Dot(refDir, normalized)) * 57.29578f;
num = Mathf.Clamp(num, -5f, 5f);
m_valveRot += num;
m_valveRot = Mathf.Clamp(m_valveRot, ValveRotRange.x, ValveRotRange.y);
Valve.localEulerAngles = new Vector3(m_valveRot, 0f, 0f);
Lerp = Mathf.InverseLerp(ValveRotRange.x, ValveRotRange.y, m_valveRot);
refDir = normalized;
((FVRInteractiveObject)this).UpdateInteraction(hand);
}
}
[ExecuteInEditMode]
public class HolographicSight : MonoBehaviour
{
public Transform VirtualQuad;
public float Scale = 1f;
public bool SizeCompensation = true;
private MaterialPropertyBlock m_block;
private void OnEnable()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
m_block = new MaterialPropertyBlock();
((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
}
private void OnWillRenderObject()
{
//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_001c: 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_0029: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)this).transform.InverseTransformPoint(((Component)VirtualQuad).transform.position);
m_block.SetVector("_Offset", Vector4.op_Implicit(val));
m_block.SetFloat("_Scale", Scale);
m_block.SetFloat("_SizeCompensation", (!SizeCompensation) ? 0f : 1f);
((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
}
}
namespace VolksScripts
{
public class BicLighter : FVRPhysicalObject
{
private bool m_isLit;
private bool isTouching;
private Vector2 initTouch = Vector2.zero;
private Vector2 LastTouchPoint = Vector2.zero;
[Header("Lighting Chance")]
[Range(0f, 1f)]
public float LightChance = 0.5f;
private float currentChance;
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 Transform[] FlameJoints;
public float[] FlameWeights;
public ParticleSystem Sparks;
public AlloyAreaLight AlloyLight;
public LayerMask LM_FireDamage;
private RaycastHit m_hit;
public override void Awake()
{
((FVRPhysicalObject)this).Awake();
currentChance = LightChance;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).UpdateInteraction(hand);
if (hand.IsInStreamlinedMode)
{
if (hand.Input.AXButtonDown)
{
TryLight();
}
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)
{
TryLight();
}
initTouch = Vector2.zero;
lastTouchPoint = Vector2.zero;
}
LastTouchPoint = hand.Input.TouchpadAxes;
}
public override void FVRUpdate()
{
//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_00bd: 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_00d2: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//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_0160: 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_017f: 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_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: 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_01fd: 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_027b: Expected O, but got Unknown
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).FVRUpdate();
if (m_isLit)
{
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)
{
return;
}
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);
}
}
}
private void TryLight()
{
Sparks.Emit(Random.Range(2, 3));
if (!m_isLit)
{
if (Random.value < currentChance)
{
m_isLit = true;
Audio_Lighter.PlayOneShot(AudioClip_Strike, 0.3f);
((Component)Flame).gameObject.SetActive(true);
currentChance = LightChance;
}
else
{
Audio_Lighter.PlayOneShot(AudioClip_Strike, 0.3f);
currentChance += 0.1f;
currentChance = Mathf.Clamp01(currentChance);
}
}
else
{
m_isLit = false;
((Component)Flame).gameObject.SetActive(false);
currentChance = LightChance;
}
}
}
public class Lighter : FVRPhysicalObject
{
private bool m_isLit;
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 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)
{
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)
{
Light();
}
initTouch = Vector2.zero;
lastTouchPoint = Vector2.zero;
}
LastTouchPoint = hand.Input.TouchpadAxes;
}
public override void FVRUpdate()
{
//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_00bd: 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_00d2: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_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)
//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_0160: 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_017f: 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_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: 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_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: 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_01fd: 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_027b: Expected O, but got Unknown
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).FVRUpdate();
if (m_isLit)
{
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)
{
return;
}
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);
}
}
}
private void Light()
{
if (!m_isLit)
{
Sparks.Emit(Random.Range(2, 3));
m_isLit = true;
Audio_Lighter.PlayOneShot(AudioClip_Strike, 0.3f);
((Component)Flame).gameObject.SetActive(true);
}
else
{
m_isLit = false;
Audio_Lighter.PlayOneShot(AudioClip_Extinguish, 0.3f);
((Component)Flame).gameObject.SetActive(false);
}
}
}
}
namespace Volks.RemingtonKeeneRifle
{
[BepInPlugin("Volks.RemingtonKeeneRifle", "RemingtonKeeneRifle", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class RemingtonKeeneRiflePlugin : 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.RemingtonKeeneRifle");
OtherLoader.RegisterDirectLoad(BasePath, "Volks.RemingtonKeeneRifle", "", "", "remingtonkeenerifle", "");
}
}
}
public class PepperSpray : FVRFireArm
{
[Header("Spray Config")]
public ParticleSystem SprayParticles;
public GameObject SprayCloudPrefab;
public Transform SprayOrigin;
public AudioEvent AudEvent_Spray;
public AudioSource AudSource_SprayLoop;
public float SprayVolume = 40f;
private bool m_isSpraying;
private float m_triggerFloat;
public override void FVRUpdate()
{
((FVRFireArm)this).FVRUpdate();
UpdateControls();
UpdateSpray();
}
private void UpdateControls()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
if (((FVRInteractiveObject)this).IsHeld)
{
m_triggerFloat = ((FVRInteractiveObject)this).m_hand.Input.TriggerFloat;
if (m_triggerFloat > 0.2f && HasFuel())
{
if (!m_isSpraying)
{
m_isSpraying = true;
if (AudEvent_Spray != null)
{
SM.PlayCoreSound((FVRPooledAudioType)10, AudEvent_Spray, SprayOrigin.position);
}
if ((Object)(object)SprayCloudPrefab != (Object)null)
{
Object.Instantiate<GameObject>(SprayCloudPrefab, SprayOrigin.position, SprayOrigin.rotation);
}
if ((Object)(object)AudSource_SprayLoop != (Object)null && !AudSource_SprayLoop.isPlaying)
{
AudSource_SprayLoop.Play();
}
}
base.Magazine.DrainFuel(Time.deltaTime);
}
else
{
StopSpraying();
}
}
else
{
m_triggerFloat = 0f;
StopSpraying();
}
}
private void UpdateSpray()
{
//IL_001d: 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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)SprayParticles == (Object)null))
{
EmissionModule emission = SprayParticles.emission;
MinMaxCurve rateOverTime = ((EmissionModule)(ref emission)).rateOverTime;
if (m_isSpraying)
{
((MinMaxCurve)(ref rateOverTime)).mode = (ParticleSystemCurveMode)0;
((MinMaxCurve)(ref rateOverTime)).constantMax = SprayVolume;
((MinMaxCurve)(ref rateOverTime)).constantMin = SprayVolume;
}
else
{
((MinMaxCurve)(ref rateOverTime)).mode = (ParticleSystemCurveMode)0;
((MinMaxCurve)(ref rateOverTime)).constantMax = 0f;
((MinMaxCurve)(ref rateOverTime)).constantMin = 0f;
}
((EmissionModule)(ref emission)).rateOverTime = rateOverTime;
}
}
private void StopSpraying()
{
if (m_isSpraying && (Object)(object)AudSource_SprayLoop != (Object)null)
{
AudSource_SprayLoop.Stop();
}
m_isSpraying = false;
}
private bool HasFuel()
{
return (Object)(object)base.Magazine != (Object)null && base.Magazine.FuelAmountLeft > 0f;
}
}
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 ManualHammerBoltActionRifle : BoltActionRifle
{
[Header("Manual Hammer Settings")]
public float HammerHalfCocked = 0.5f;
public float HammerHalfCockedRot = 30f;
public bool HammerUsesRotation = false;
public Axis HammerRotationAxis = (Axis)2;
public float HammerUncockedRot = 0f;
public float HammerCockedRot = 60f;
[Header("Hammer Animation Speed")]
[Tooltip("Controls how fast the hammer moves to its target position/rotation.")]
public float HammerAnimationSpeed = 15f;
private bool m_isHammerHalfCocked = false;
private bool m_wasBoltClosed = false;
private const float kBoltClosedThreshold = 0.05f;
public override void Awake()
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
base.CockType = (HammerCockType)99;
((BoltActionRifle)this).Awake();
}
public override void FVRUpdate()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArm)this).FVRUpdate();
bool flag = (int)base.CurBoltHandleState == 0 && base.BoltLerp <= 0.05f;
if (!m_wasBoltClosed && flag)
{
SetHammerHalfCock();
}
m_wasBoltClosed = flag;
if ((Object)(object)((FVRInteractiveObject)this).m_hand != (Object)null)
{
if (((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode)
{
if (((FVRInteractiveObject)this).m_hand.Input.AXButtonDown)
{
TryManualCock();
}
}
else
{
Vector2 touchpadAxes = ((FVRInteractiveObject)this).m_hand.Input.TouchpadAxes;
if (((FVRInteractiveObject)this).m_hand.Input.TouchpadDown && Vector2.Angle(touchpadAxes, Vector2.down) < 45f)
{
TryManualCock();
}
}
}
UpdateHammerVisual();
}
private void TryManualCock()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
if ((int)base.CurBoltHandleState == 0)
{
if (((BoltActionRifle)this).IsHammerCocked)
{
m_isHammerHalfCocked = false;
return;
}
((BoltActionRifle)this).CockHammer();
m_isHammerHalfCocked = false;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)7, 1f);
}
}
private void SetHammerHalfCock()
{
if (((BoltActionRifle)this).IsHammerCocked)
{
m_isHammerHalfCocked = false;
return;
}
m_isHammerHalfCocked = true;
((FVRFireArm)this).PlayAudioEvent((FirearmAudioEventType)6, 1f);
UpdateHammerVisualImmediate();
}
private void UpdateHammerVisual()
{
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_0079: Invalid comparison between Unknown and I4
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
if (!base.HasVisualHammer || (Object)(object)base.Hammer == (Object)null)
{
return;
}
if (HammerUsesRotation)
{
float num = HammerUncockedRot;
if (((BoltActionRifle)this).IsHammerCocked)
{
num = HammerCockedRot;
}
else if (m_isHammerHalfCocked)
{
num = HammerHalfCockedRot;
}
Vector3 localEulerAngles = base.Hammer.localEulerAngles;
Axis hammerRotationAxis = HammerRotationAxis;
if ((int)hammerRotationAxis != 0)
{
if ((int)hammerRotationAxis == 1)
{
localEulerAngles.y = Mathf.LerpAngle(localEulerAngles.y, num, Time.deltaTime * HammerAnimationSpeed);
}
else
{
localEulerAngles.z = Mathf.LerpAngle(localEulerAngles.z, num, Time.deltaTime * HammerAnimationSpeed);
}
}
else
{
localEulerAngles.x = Mathf.LerpAngle(localEulerAngles.x, num, Time.deltaTime * HammerAnimationSpeed);
}
base.Hammer.localEulerAngles = localEulerAngles;
}
else
{
float num2 = base.HammerUncocked;
if (((BoltActionRifle)this).IsHammerCocked)
{
num2 = base.HammerCocked;
}
else if (m_isHammerHalfCocked)
{
num2 = HammerHalfCocked;
}
Vector3 localPosition = base.Hammer.localPosition;
localPosition.z = Mathf.Lerp(localPosition.z, num2, Time.deltaTime * HammerAnimationSpeed);
base.Hammer.localPosition = localPosition;
}
}
private void UpdateHammerVisualImmediate()
{
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_007c: Invalid comparison between Unknown and I4
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
if (!base.HasVisualHammer || (Object)(object)base.Hammer == (Object)null)
{
return;
}
if (HammerUsesRotation)
{
float num = (m_isHammerHalfCocked ? HammerHalfCockedRot : ((!((BoltActionRifle)this).IsHammerCocked) ? HammerUncockedRot : HammerCockedRot));
Vector3 localEulerAngles = base.Hammer.localEulerAngles;
Axis hammerRotationAxis = HammerRotationAxis;
if ((int)hammerRotationAxis != 0)
{
if ((int)hammerRotationAxis == 1)
{
localEulerAngles.y = num;
}
else
{
localEulerAngles.z = num;
}
}
else
{
localEulerAngles.x = num;
}
base.Hammer.localEulerAngles = localEulerAngles;
}
else
{
float z = (m_isHammerHalfCocked ? HammerHalfCocked : ((!((BoltActionRifle)this).IsHammerCocked) ? base.HammerUncocked : base.HammerCocked));
Vector3 localPosition = base.Hammer.localPosition;
localPosition.z = z;
base.Hammer.localPosition = localPosition;
}
}
public override void EndInteraction(FVRViveHand hand)
{
((BoltActionRifle)this).EndInteraction(hand);
if (((BoltActionRifle)this).IsHammerCocked)
{
m_isHammerHalfCocked = false;
}
}
}
public class WheelVisualSync : MonoBehaviour
{
public WheelCollider wheelCollider;
public Transform wheelVisual;
public Vector3 visualRotationOffset;
public bool useLocalPose = false;
private void Start()
{
if ((Object)(object)wheelCollider == (Object)null)
{
wheelCollider = ((Component)this).GetComponent<WheelCollider>();
}
if ((Object)(object)wheelVisual == (Object)null)
{
wheelVisual = ((Component)this).transform;
}
}
private void LateUpdate()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: 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)
if (!((Object)(object)wheelCollider == (Object)null) && !((Object)(object)wheelVisual == (Object)null))
{
Vector3 val = default(Vector3);
Quaternion val2 = default(Quaternion);
wheelCollider.GetWorldPose(ref val, ref val2);
Quaternion val3 = Quaternion.Euler(visualRotationOffset);
if (useLocalPose && (Object)(object)wheelVisual.parent != (Object)null)
{
wheelVisual.parent.InverseTransformPoint(val);
wheelVisual.localPosition = wheelVisual.parent.InverseTransformPoint(val);
wheelVisual.localRotation = Quaternion.Inverse(wheelVisual.parent.rotation) * val2 * val3;
}
else
{
wheelVisual.position = val;
wheelVisual.rotation = val2 * val3;
}
}
}
}
}
public class UBFlameTankRelease : FVRInteractiveObject
{
public AttachableFirearm AFireArm;
public override bool IsInteractable()
{
return (Object)(object)AFireArm != (Object)null && (Object)(object)AFireArm.Magazine != (Object)null;
}
public override void BeginInteraction(FVRViveHand hand)
{
if (!((Object)(object)AFireArm == (Object)null) && (Object)(object)AFireArm.Magazine != (Object)null)
{
FVRFireArmMagazine magazine = AFireArm.Magazine;
AFireArm.EjectMag(false);
hand.ForceSetInteractable((FVRInteractiveObject)(object)magazine);
((FVRInteractiveObject)magazine).BeginInteraction(hand);
}
}
}
namespace VolksScripts
{
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 Shellholder : FVRInteractiveObject
{
[Header("Shellholder Config")]
public bool IsManuallyExtractable;
public bool IsAccessible;
private FVRFireArmRound m_round;
public bool IsFull;
[Header("Proxy Display")]
public Transform ProxyRound;
public MeshFilter ProxyMesh;
public MeshRenderer ProxyRenderer;
private ObjectTemperature geoTemp;
public FVRFireArmRound GetRound()
{
return m_round;
}
protected void Awake()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_0035: 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_0055: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).Awake();
GameObject val = new GameObject("Proxy");
ProxyRound = val.transform;
ProxyRound.SetParent(((Component)this).transform);
ProxyRound.localPosition = Vector3.zero;
ProxyRound.localEulerAngles = Vector3.zero;
ProxyRound.localScale = Vector3.one;
ProxyMesh = val.AddComponent<MeshFilter>();
ProxyRenderer = val.AddComponent<MeshRenderer>();
geoTemp = ((Component)ProxyRound).gameObject.AddComponent<ObjectTemperature>();
geoTemp.renderers.Add((Renderer)(object)ProxyRenderer);
}
public void UpdateProxyDisplay()
{
if ((Object)(object)m_round == (Object)null)
{
ProxyMesh.mesh = null;
((Renderer)ProxyRenderer).material = null;
((Renderer)ProxyRenderer).enabled = false;
return;
}
if ((Object)(object)m_round.FiredRenderer != (Object)null)
{
ProxyMesh.mesh = ((Component)m_round.FiredRenderer).gameObject.GetComponent<MeshFilter>().sharedMesh;
((Renderer)ProxyRenderer).material = m_round.FiredRenderer.sharedMaterial;
}
else
{
ProxyMesh.mesh = null;
((Renderer)ProxyRenderer).material = null;
}
((Renderer)ProxyRenderer).enabled = true;
}
public void SetRound(FVRFireArmRound round)
{
if ((Object)(object)round == (Object)null)
{
Debug.LogWarning((object)"Attempting to set a null round in Shellholder.");
}
m_round = round;
IsFull = (Object)(object)round != (Object)null;
UpdateProxyDisplay();
}
public void Unload()
{
SetRound(null);
}
public override void BeginInteraction(FVRViveHand hand)
{
if (IsManuallyExtractable && IsAccessible && IsFull)
{
FVRFireArmRound round = m_round;
SetRound(null);
if ((Object)(object)round != (Object)null)
{
((FVRInteractiveObject)round).BeginInteraction(hand);
hand.ForceSetInteractable((FVRInteractiveObject)(object)round);
}
}
}
private void OnTriggerEnter(Collider other)
{
FVRFireArmRound component = ((Component)other).GetComponent<FVRFireArmRound>();
if ((Object)(object)component != (Object)null && !IsFull)
{
SetRound(component);
Object.Destroy((Object)(object)((Component)component).gameObject);
Debug.Log((object)"Round stored in shellholder (proxy only).");
}
}
}
}
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();
}
}
public class FVRSmokingPipe : QBArmorHelmet
{
public GameObject FireGO;
public GameObject LinkedObject;
public AudioSource fireAud;
public float BurnDuration = 120f;
private bool m_isBurning = false;
private float m_burnTimer;
[Header("Trigger Reset")]
public GameObject RelightTrigger;
public bool IsBurning => m_isBurning;
public override void Awake()
{
((QBArmorHelmet)this).Awake();
if ((Object)(object)FireGO != (Object)null)
{
FireGO.SetActive(false);
}
if ((Object)(object)LinkedObject != (Object)null)
{
LinkedObject.SetActive(false);
}
}
public override void FVRUpdate()
{
((QBArmorPiece)this).FVRUpdate();
if (m_isBurning)
{
m_burnTimer -= Time.deltaTime;
if (m_burnTimer <= 0f)
{
StopBurning();
}
}
}
public void Ignite()
{
if (!m_isBurning)
{
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;
if ((Object)(object)FireGO != (Object)null)
{
FireGO.SetActive(false);
}
if ((Object)(object)fireAud != (Object)null)
{
fireAud.Stop();
}
if ((Object)(object)LinkedObject != (Object)null)
{
LinkedObject.SetActive(false);
}
if ((Object)(object)RelightTrigger != (Object)null)
{
RelightTrigger.SetActive(true);
}
Debug.Log((object)"Pipe burnt out. Ready to be reignited.");
}
}
public class SmokingPipeTrigger : MonoBehaviour
{
public FVRSmokingPipe SmokingPipe;
public Collider collider;
public float ResetDelay = 2f;
private bool isActive = true;
private void OnTriggerEnter(Collider col)
{
if (isActive && !SmokingPipe.IsBurning)
{
isActive = false;
SmokingPipe.Ignite();
collider.enabled = false;
((Component)this).gameObject.layer = LayerMask.NameToLayer("NoCol");
((MonoBehaviour)this).StartCoroutine(ResetTriggerAfterDelay());
}
}
private IEnumerator ResetTriggerAfterDelay()
{
yield return (object)new WaitForSeconds(ResetDelay);
collider.enabled = true;
((Component)this).gameObject.layer = LayerMask.NameToLayer("Default");
isActive = true;
}
}
public class FlamingSword : FVRMeleeWeapon
{
[Header("Fire Effects")]
public GameObject fireVisuals;
public ParticleSystem fireParticles;
public AudioSource audioSource;
public AudioClip startClip;
public AudioClip loopClip;
public AudioClip endClip;
[Header("Glow Emission")]
public Renderer glowRenderer;
public Color glowColor = Color.red;
public float glowIntensity = 2f;
[Header("Timing")]
public float extinguishDelay = 2f;
private bool isOn = false;
private Coroutine extinguishCoroutine;
protected void Start()
{
SetFireState(on: false);
}
private void Update()
{
//IL_0073: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
if (!((FVRInteractiveObject)this).IsHeld || (Object)(object)((FVRInteractiveObject)this).m_hand == (Object)null)
{
if (isOn && extinguishCoroutine == null)
{
extinguishCoroutine = ((MonoBehaviour)this).StartCoroutine(ExtinguishAfterDelay());
}
return;
}
if (extinguishCoroutine != null)
{
((MonoBehaviour)this).StopCoroutine(extinguishCoroutine);
extinguishCoroutine = null;
}
HandInput input = ((FVRInteractiveObject)this).m_hand.Input;
bool flag = false;
if ((!((FVRInteractiveObject)this).m_hand.IsInStreamlinedMode) ? (input.TouchpadDown && ((Vector2)(ref input.TouchpadAxes)).magnitude > 0.2f && Vector2.Angle(input.TouchpadAxes, Vector2.down) < 45f) : input.BYButtonDown)
{
isOn = !isOn;
SetFireState(isOn);
}
}
private void SetFireState(bool on)
{
//IL_00d2: 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_009c: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)fireVisuals != (Object)null)
{
fireVisuals.SetActive(on);
}
if ((Object)(object)fireParticles != (Object)null)
{
if (on)
{
fireParticles.Play();
}
else
{
fireParticles.Stop();
}
}
if ((Object)(object)glowRenderer != (Object)null)
{
if (on)
{
glowRenderer.material.EnableKeyword("_EMISSION");
glowRenderer.material.SetColor("_EmissionColor", glowColor * glowIntensity);
}
else
{
glowRenderer.material.DisableKeyword("_EMISSION");
glowRenderer.material.SetColor("_EmissionColor", Color.black);
}
}
if ((Object)(object)audioSource != (Object)null)
{
audioSource.Stop();
if (on && (Object)(object)startClip != (Object)null)
{
audioSource.clip = startClip;
audioSource.loop = false;
audioSource.Play();
((MonoBehaviour)this).StartCoroutine(PlayLoopAfterDelay(startClip.length));
}
else if (!on && (Object)(object)endClip != (Object)null)
{
audioSource.clip = endClip;
audioSource.loop = false;
audioSource.Play();
}
}
}
private IEnumerator PlayLoopAfterDelay(float delay)
{
yield return (object)new WaitForSeconds(delay);
if (isOn && (Object)(object)loopClip != (Object)null)
{
audioSource.clip = loopClip;
audioSource.loop = true;
audioSource.Play();
}
}
private IEnumerator ExtinguishAfterDelay()
{
yield return (object)new WaitForSeconds(extinguishDelay);
isOn = false;
SetFireState(on: false);
extinguishCoroutine = null;
}
}