using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OtherLoader;
using Sodalite.Api;
using Steamworks;
using UnityEngine;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace JerryComponent
{
public class AlyxBulletHopper : MonoBehaviour
{
public FVRFireArmAttachment AttachmentBase;
public List<FireArmRoundClass> curClasses;
public int HopperCapacity = 10;
public int curNumber = 0;
public Handgun Gun;
public FVRFireArmMagazine Mag;
public MeshRenderer indicator;
public Material m0;
public Material m1;
public Material m2;
public Material m3;
public Material m4;
public Material m5;
public Material m6;
public Material m7;
public Material m8;
public Material m9;
public Material m10;
public float grabcd = 0f;
public float cd = 0.1f;
public bool chamber = false;
public FireArmRoundClass curClass;
public Animator AnimG;
public Animator AnimS;
public float ScrollValue;
public float ScrollSpeed;
public GameObject bullet1;
public GameObject bullet2;
public GameObject ind;
public AudioEvent clip;
public AudioEvent full;
public bool isFull = false;
public bool isLoading = false;
public GameObject geo;
private void Start()
{
}
private void FixedUpdate()
{
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_052e: Unknown result type (might be due to invalid IL or missing references)
//IL_0393: Unknown result type (might be due to invalid IL or missing references)
//IL_0398: Unknown result type (might be due to invalid IL or missing references)
//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
//IL_04d4: Unknown result type (might be due to invalid IL or missing references)
//IL_05e5: Unknown result type (might be due to invalid IL or missing references)
//IL_060e: Unknown result type (might be due to invalid IL or missing references)
//IL_0613: Unknown result type (might be due to invalid IL or missing references)
//IL_0640: Unknown result type (might be due to invalid IL or missing references)
//IL_044d: Unknown result type (might be due to invalid IL or missing references)
//IL_0453: Invalid comparison between Unknown and I4
//IL_04bb: Unknown result type (might be due to invalid IL or missing references)
//IL_047c: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)AttachmentBase != (Object)null)
{
if ((Object)(object)AttachmentBase.curMount == (Object)null)
{
Gun = null;
Mag = null;
ind.SetActive(false);
}
if ((Object)(object)AttachmentBase.curMount != (Object)null && (Object)(object)((Component)AttachmentBase.curMount.MyObject).gameObject.GetComponent<Handgun>() != (Object)null)
{
ind.SetActive(true);
Gun = ((Component)AttachmentBase.curMount.MyObject).gameObject.GetComponent<Handgun>();
}
}
if ((Object)(object)AttachmentBase == (Object)null || (Object)(object)Gun == (Object)null || (Object)(object)Mag == (Object)null)
{
}
if (curNumber == 0)
{
((Renderer)indicator).material = m0;
}
if (curNumber == 1)
{
((Renderer)indicator).material = m1;
}
if (curNumber == 2)
{
((Renderer)indicator).material = m2;
}
if (curNumber == 3)
{
((Renderer)indicator).material = m3;
}
if (curNumber == 4)
{
((Renderer)indicator).material = m4;
}
if (curNumber == 5)
{
((Renderer)indicator).material = m5;
}
if (curNumber == 6)
{
((Renderer)indicator).material = m6;
}
if (curNumber == 7)
{
((Renderer)indicator).material = m7;
}
if (curNumber == 8)
{
((Renderer)indicator).material = m8;
}
if (curNumber == 9)
{
((Renderer)indicator).material = m9;
}
if (curNumber == 10)
{
((Renderer)indicator).material = m10;
}
if (curNumber >= HopperCapacity && !isFull)
{
SM.PlayCoreSound((FVRPooledAudioType)41, full, ((Component)this).transform.position);
isFull = true;
}
else if (curNumber < HopperCapacity)
{
isFull = false;
}
curNumber = Mathf.Clamp(curNumber, 0, HopperCapacity);
ScrollValue = (float)curNumber * 0.1f;
ScrollValue = Mathf.Clamp(ScrollValue, 0f, 1f);
AnimS.SetFloat("Blend", ScrollValue);
if ((Object)(object)Gun != (Object)null)
{
if ((Object)(object)((FVRFireArm)Gun).Magazine != (Object)null)
{
Mag = ((FVRFireArm)Gun).Magazine;
}
else if ((Object)(object)((FVRFireArm)Gun).Magazine == (Object)null && (Object)(object)Mag != (Object)null)
{
Mag = null;
}
if (Gun.HasTiltingBarrel)
{
geo.transform.localEulerAngles = new Vector3(0f - ((Component)Gun.Barrel).transform.localEulerAngles.x, 0f, 0f);
}
else if (!Gun.HasTiltingBarrel)
{
geo.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
}
if ((Object)(object)Mag != (Object)null && Mag.m_numRounds <= 0 && curNumber > 0)
{
Gun.DropSlideRelease();
if (!Gun.Chamber.IsFull && (int)Gun.Slide.CurPos == 4)
{
curNumber--;
chamber = true;
SM.PlayCoreSound((FVRPooledAudioType)41, clip, ((Component)this).transform.position);
AnimG.SetTrigger("Load");
}
if (chamber)
{
Gun.Chamber.Autochamber(curClasses[curNumber]);
}
}
if ((int)Gun.Slide.CurPos == 0 || Gun.Chamber.IsFull)
{
chamber = false;
}
}
else if ((Object)(object)Gun == (Object)null)
{
geo.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
Mag = null;
}
if ((Object)(object)Mag != (Object)null && Gun.IsSlideLockUp && (Object)(object)((FVRInteractiveObject)Gun.Slide).m_hand == (Object)null && Mag.m_numRounds > 0 && curNumber < HopperCapacity && Mag.LoadedRounds[0] != null)
{
grabcd -= Time.deltaTime;
if (grabcd <= 0f)
{
SM.PlayCoreSound((FVRPooledAudioType)41, clip, ((Component)this).transform.position);
AnimG.SetTrigger("Grab");
curClass = Mag.LoadedRounds[0].LR_Class;
Mag.RemoveRound(0);
curNumber++;
curClasses[curNumber] = curClass;
grabcd = cd;
}
}
if (curNumber <= 0)
{
bullet1.SetActive(false);
bullet2.SetActive(false);
}
else if (curNumber > 0)
{
bullet1.SetActive(true);
bullet2.SetActive(true);
}
}
}
}
namespace Niko666.HLA_AlyxGun
{
[BepInPlugin("Niko666.HLA_AlyxGun", "HLA_AlyxGun", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
[BepInDependency("h3vr.cityrobo.ModularWorkshopManager", "1.0.0")]
[BepInDependency("nrgill28.Sodalite", "1.5.0")]
public class HLA_AlyxGunPlugin : 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(), "Niko666.HLA_AlyxGun");
OtherLoader.RegisterDirectLoad(BasePath, "Niko666.HLA_AlyxGun", "", "", "alyxgun", "");
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_hla_alyxgun"));
}
}
}
namespace ModularWorkshop
{
public class AlyxModulHopper : MonoBehaviour, IPartFireArmRequirement
{
public GameObject ObjectWhenEmpty;
public List<GameObject> Objects;
public float grabcd = 0f;
public float cd = 0.1f;
public Handgun Gun;
public List<FireArmRoundClass> curClasses;
public int HopperCapacity = 10;
public int curNumber = 0;
public FVRFireArmMagazine Mag;
public FireArmRoundClass curClass;
public Animator AnimG;
public Animator AnimS;
public float ScrollValue;
public float ScrollSpeed;
public GameObject bullet1;
public GameObject bullet2;
public AudioEvent clip;
public AudioEvent Completeclip;
public bool isFull = false;
public bool isLoading = false;
public bool chamber = false;
public FVRFireArm FireArm
{
set
{
if ((Object)(object)value != (Object)null)
{
Handgun val = (Handgun)(object)((value is Handgun) ? value : null);
if ((Object)(object)val != (Object)null)
{
Gun = val;
}
}
}
}
private void Start()
{
}
public void FixedUpdate()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0347: Unknown result type (might be due to invalid IL or missing references)
//IL_0370: Unknown result type (might be due to invalid IL or missing references)
//IL_0375: Unknown result type (might be due to invalid IL or missing references)
//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
if (curNumber >= HopperCapacity && !isFull)
{
SM.PlayCoreSound((FVRPooledAudioType)41, Completeclip, ((Component)this).transform.position);
isFull = true;
}
else if (curNumber < HopperCapacity)
{
isFull = false;
}
curNumber = Mathf.Clamp(curNumber, 0, HopperCapacity);
SetEnabledObjects(curNumber);
ScrollValue = (float)curNumber * 0.1f;
ScrollValue = Mathf.Clamp(ScrollValue, 0f, 1f);
AnimS.SetFloat("Blend", ScrollValue);
if ((Object)(object)Gun != (Object)null)
{
if ((Object)(object)((FVRFireArm)Gun).Magazine != (Object)null)
{
Mag = ((FVRFireArm)Gun).Magazine;
}
else if ((Object)(object)((FVRFireArm)Gun).Magazine == (Object)null && (Object)(object)Mag != (Object)null)
{
Mag = null;
}
if ((Object)(object)Mag != (Object)null && Mag.m_numRounds <= 0 && curNumber > 0)
{
Gun.DropSlideRelease();
if (!Gun.Chamber.IsFull && Gun.Slide.m_slideZ_current < Gun.Slide.m_slideZ_lock)
{
curNumber--;
chamber = true;
SM.PlayCoreSound((FVRPooledAudioType)41, clip, ((Component)this).transform.position);
AnimG.SetTrigger("Load");
}
if (chamber || Gun.Slide.m_slideZ_current > Gun.Slide.m_slideZ_lock)
{
Gun.Chamber.Autochamber(curClasses[curNumber]);
}
}
if ((int)Gun.Slide.CurPos == 0 || Gun.Chamber.IsFull)
{
chamber = false;
Gun.DropSlideRelease();
}
}
else if ((Object)(object)Gun == (Object)null)
{
Mag = null;
}
if ((Object)(object)Mag != (Object)null && Gun.IsSlideLockUp && (Object)(object)((FVRInteractiveObject)Gun.Slide).m_hand == (Object)null && Mag.m_numRounds > 0 && curNumber < HopperCapacity && Mag.LoadedRounds[0] != null)
{
grabcd -= Time.deltaTime;
if (grabcd <= 0f)
{
SM.PlayCoreSound((FVRPooledAudioType)41, clip, ((Component)this).transform.position);
AnimG.SetTrigger("Grab");
curClass = Mag.LoadedRounds[0].LR_Class;
Mag.RemoveRound(0);
curNumber++;
curClasses[curNumber] = curClass;
grabcd = cd;
}
}
if (curNumber <= 0)
{
bullet1.SetActive(false);
bullet2.SetActive(false);
}
else if (curNumber > 0)
{
bullet1.SetActive(true);
bullet2.SetActive(true);
}
}
public void SetEnabledObjects(int amt)
{
amt = Mathf.Clamp(amt, 0, Objects.Count);
for (int i = 0; i < Objects.Count; i++)
{
Objects[i].SetActive(false);
ObjectWhenEmpty.SetActive(false);
}
for (int j = 0; j < Objects.Count; j++)
{
if (j < amt)
{
Objects[j].SetActive(true);
}
}
}
}
[RequireComponent(typeof(ModularWeaponPart))]
public class AlyxModulSelector : MonoBehaviour, IPartFireArmRequirement
{
public enum FireSelectorModeType
{
Safe,
Single,
Burst,
FullAuto,
SuperFastBurst
}
[Serializable]
public class FireSelectorMode
{
public float SelectorPosition;
public FireSelectorModeType ModeType;
public int BurstAmount = 3;
[Tooltip("Only works for closed bolt weapons")]
public bool ARStyleBurst;
public float EngagementDelay;
}
public Transform ExternalSelector;
public FireSelectorMode[] FireSelectorModes;
private FVRFireArm _firearm;
private object[] _originalFireModes;
public FVRFireArm FireArm
{
get
{
return _firearm;
}
set
{
FVRFireArm firearm;
if (!((Object)(object)value != (Object)null))
{
if (!((Object)(object)value == (Object)null) || !((Object)(object)_firearm != (Object)null))
{
return;
}
_firearm = value;
firearm = _firearm;
ClosedBoltWeapon val = (ClosedBoltWeapon)(object)((firearm is ClosedBoltWeapon) ? firearm : null);
if ((Object)(object)val != (Object)null)
{
val.FireSelector_Modes = (FireSelectorMode[])_originalFireModes;
return;
}
OpenBoltReceiver val2 = (OpenBoltReceiver)(object)((firearm is OpenBoltReceiver) ? firearm : null);
if ((Object)(object)val2 != (Object)null)
{
val2.FireSelector_Modes = (FireSelectorMode[])_originalFireModes;
return;
}
Handgun val3 = (Handgun)(object)((firearm is Handgun) ? firearm : null);
if (!((Object)(object)val3 == (Object)null))
{
val3.FireSelectorModes = (FireSelectorMode[])_originalFireModes;
}
return;
}
_firearm = value;
firearm = _firearm;
ClosedBoltWeapon val4 = (ClosedBoltWeapon)(object)((firearm is ClosedBoltWeapon) ? firearm : null);
if ((Object)(object)val4 != (Object)null)
{
object[] fireSelector_Modes = val4.FireSelector_Modes;
_originalFireModes = fireSelector_Modes;
ModifyClosedBoltFireModes(val4);
return;
}
OpenBoltReceiver val5 = (OpenBoltReceiver)(object)((firearm is OpenBoltReceiver) ? firearm : null);
if ((Object)(object)val5 != (Object)null)
{
object[] fireSelector_Modes = val5.FireSelector_Modes;
_originalFireModes = fireSelector_Modes;
ModifyOpenBoltFireModes(val5);
return;
}
Handgun val6 = (Handgun)(object)((firearm is Handgun) ? firearm : null);
if (!((Object)(object)val6 == (Object)null))
{
object[] fireSelector_Modes = val6.FireSelectorModes;
_originalFireModes = fireSelector_Modes;
ModifyHandgunFireModes(val6);
}
}
}
private void ModifyClosedBoltFireModes(ClosedBoltWeapon w)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//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_003d: Unknown result type (might be due to invalid IL or missing references)
List<FireSelectorMode> list = new List<FireSelectorMode>();
FireSelectorMode[] fireSelectorModes = FireSelectorModes;
foreach (FireSelectorMode val in fireSelectorModes)
{
FireSelectorMode val2 = new FireSelectorMode();
val2.SelectorPosition = val.SelectorPosition;
val2.ModeType = FireModeEnumExtensions.ConvertToClosedBolt(val.ModeType);
val2.BurstAmount = val.BurstAmount;
val2.ARStyleBurst = val.ARStyleBurst;
val2.EngagementDelay = val.EngagementDelay;
list.Add(val2);
}
w.FireSelector_Modes = list.ToArray();
w.FireSelector_Modes2 = list.ToArray();
}
private void ModifyOpenBoltFireModes(OpenBoltReceiver w)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//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_003d: Unknown result type (might be due to invalid IL or missing references)
List<FireSelectorMode> list = new List<FireSelectorMode>();
FireSelectorMode[] fireSelectorModes = FireSelectorModes;
foreach (FireSelectorMode val in fireSelectorModes)
{
FireSelectorMode val2 = new FireSelectorMode();
val2.SelectorPosition = val.SelectorPosition;
val2.ModeType = FireModeEnumExtensions.ConvertToOpenBolt(val.ModeType);
val2.BurstAmount = val.BurstAmount;
val2.EngagementDelay = val.EngagementDelay;
list.Add(val2);
}
w.FireSelector_Modes = list.ToArray();
w.FireSelector_Modes2 = list.ToArray();
}
private void ModifyHandgunFireModes(Handgun w)
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//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_005e: Unknown result type (might be due to invalid IL or missing references)
if (w.FireSelectorModeIndex != 0 || w.FireSelectorModeIndex != 1)
{
w.SetFireSelectorByIndex(0);
}
List<FireSelectorMode> list = new List<FireSelectorMode>();
FireSelectorMode[] fireSelectorModes = FireSelectorModes;
foreach (FireSelectorMode val in fireSelectorModes)
{
FireSelectorMode val2 = new FireSelectorMode();
val2.SelectorPosition = val.SelectorPosition;
val2.ModeType = FireModeEnumExtensions.ConvertToHandgun(val.ModeType);
val2.BurstAmount = val.BurstAmount;
val2.EngagementDelay = val.EngagementDelay;
list.Add(val2);
}
w.FireSelectorModes = list.ToArray();
w.FireSelector = ExternalSelector;
}
}
}
namespace Niko666
{
public class AudioRecoilForDiffModes : MonoBehaviour
{
public ClosedBoltWeapon Weapon;
public int FireSelectorPosition1;
public int FireSelectorPosition2;
public FVRFireArmRecoilProfile Recoil1;
public FVRFireArmRecoilProfile Recoil2;
public FVRFirearmAudioSet AudioSet1;
public FVRFirearmAudioSet AudioSet2;
public bool _hasSetStartAudio = false;
public bool _hasSetStopAudio = false;
public void Update()
{
if (!((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null))
{
return;
}
if (Weapon.m_fireSelectorMode == FireSelectorPosition1)
{
_hasSetStartAudio = false;
if (!_hasSetStopAudio)
{
((FVRFireArm)Weapon).RecoilProfile = Recoil1;
((FVRFireArm)Weapon).AudioClipSet = AudioSet1;
}
_hasSetStopAudio = true;
}
else if (Weapon.m_fireSelectorMode == FireSelectorPosition2)
{
_hasSetStopAudio = false;
if (!_hasSetStartAudio)
{
((FVRFireArm)Weapon).RecoilProfile = Recoil2;
((FVRFireArm)Weapon).AudioClipSet = AudioSet2;
}
_hasSetStartAudio = true;
}
}
}
public class ConsumeMultipleAmmoPerShot : MonoBehaviour
{
public ClosedBoltWeapon Weapon;
public FVRFireArmChamber Chamber;
public int FireSelectorPosition;
public int AmountToConsume;
[HideInInspector]
public bool _hasConsumedAmmo = false;
public void Update()
{
if ((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null && Weapon.m_fireSelectorMode == FireSelectorPosition && !Chamber.IsFull)
{
if (!_hasConsumedAmmo && (Object)(object)((FVRFireArm)Weapon).Magazine != (Object)null && ((FVRFireArm)Weapon).Magazine.HasARound())
{
for (int i = 1; i < AmountToConsume; i++)
{
((FVRFireArm)Weapon).Magazine.RemoveRound();
}
}
_hasConsumedAmmo = true;
}
if ((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null && Chamber.IsFull && !Chamber.IsSpent)
{
_hasConsumedAmmo = false;
}
}
}
public class MuzzlePointForDiffModes : MonoBehaviour
{
public ClosedBoltWeapon Weapon;
public int FireSelectorPosition1;
public int FireSelectorPosition2;
public Transform Muzzle1;
public Transform Muzzle2;
public void Update()
{
if ((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null)
{
if (Weapon.m_fireSelectorMode == FireSelectorPosition1)
{
((FVRFireArm)Weapon).MuzzlePos = Muzzle1;
((FVRFireArm)Weapon).CurrentMuzzle = Muzzle1;
}
if (Weapon.m_fireSelectorMode == FireSelectorPosition2)
{
((FVRFireArm)Weapon).MuzzlePos = Muzzle2;
((FVRFireArm)Weapon).CurrentMuzzle = Muzzle2;
}
}
}
}
public class PistolRotateToChamber : FVRInteractiveObject
{
public Handgun Weapon;
public Transform RotPiece;
public AudioEvent HandleCrank;
private float m_curRot;
private Vector3 lastHandForward = Vector3.zero;
public override void BeginInteraction(FVRViveHand hand)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).BeginInteraction(hand);
lastHandForward = Vector3.ProjectOnPlane(((HandInput)(ref base.m_hand.Input)).Up, ((Component)this).transform.right);
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).EndInteraction(hand);
}
public override void FVRFixedUpdate()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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_003b: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
if (((FVRInteractiveObject)this).IsHeld)
{
float curRot = m_curRot;
Vector3 val = Vector3.ProjectOnPlane(((HandInput)(ref base.m_hand.Input)).Up, -((Component)this).transform.right);
Vector3 val2 = Vector3.ProjectOnPlane(lastHandForward, -((Component)this).transform.right);
float num = Mathf.Atan2(Vector3.Dot(-((Component)this).transform.right, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f;
if (num > 0f)
{
m_curRot -= num;
}
if (curRot > -45f && m_curRot <= -45f)
{
SM.PlayCoreSound((FVRPooledAudioType)10, HandleCrank, ((Component)this).transform.position);
}
if (m_curRot <= -90f)
{
RotPiece.localEulerAngles = new Vector3(0f, 0f, 0f);
Weapon.Slide.KnockToRear();
SM.PlayCoreSound((FVRPooledAudioType)10, HandleCrank, ((Component)this).transform.position);
m_curRot = 0f;
base.m_hand.EndInteractionIfHeld((FVRInteractiveObject)(object)this);
((FVRInteractiveObject)this).ForceBreakInteraction();
}
else
{
RotPiece.localEulerAngles = new Vector3(0f, 0f, m_curRot);
}
lastHandForward = val;
}
((FVRInteractiveObject)this).FVRFixedUpdate();
}
}
public class PlayAnimWhenModeChange : MonoBehaviour
{
public ClosedBoltWeapon Weapon;
public Animator Animator;
public string AnimationNode1Name = "animation1";
public string AnimationNode2Name = "animation2";
public int FireSelectorPosition1;
public int FireSelectorPosition2;
private Vector2 dir = Vector2.left;
public void Awake()
{
Animator.cullingMode = (AnimatorCullingMode)0;
}
public void Update()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null))
{
return;
}
if (!((FVRInteractiveObject)Weapon).m_hand.IsInStreamlinedMode && Vector2.Angle(((FVRInteractiveObject)Weapon).m_hand.Input.TouchpadAxes, dir) <= 45f && ((Vector2)(ref ((FVRInteractiveObject)Weapon).m_hand.Input.TouchpadAxes)).magnitude > 0.4f && ((FVRInteractiveObject)Weapon).m_hand.Input.TouchpadPressed)
{
if (Weapon.m_fireSelectorMode == FireSelectorPosition1)
{
Animator.Play(AnimationNode1Name);
}
else if (Weapon.m_fireSelectorMode == FireSelectorPosition2)
{
Animator.Play(AnimationNode2Name);
}
}
if (((FVRInteractiveObject)Weapon).m_hand.IsInStreamlinedMode && ((FVRInteractiveObject)Weapon).m_hand.Input.BYButtonPressed)
{
if (Weapon.m_fireSelectorMode == FireSelectorPosition1)
{
Animator.Play(AnimationNode1Name);
}
else if (Weapon.m_fireSelectorMode == FireSelectorPosition2)
{
Animator.Play(AnimationNode2Name);
}
}
}
}
public class PlayAudioWhenModeChange : MonoBehaviour
{
public ClosedBoltWeapon Weapon;
public int SemiAutoFireSelectorPosition;
public int FullAutoFireSelectorPosition;
public AudioClip FullAutoAudioClips;
public AudioClip SemiAutoAudioClips;
public AudioSource AudioSource;
private Vector2 dir = Vector2.left;
public void Update()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null))
{
return;
}
if (!((FVRInteractiveObject)Weapon).m_hand.IsInStreamlinedMode && Vector2.Angle(((FVRInteractiveObject)Weapon).m_hand.Input.TouchpadAxes, dir) <= 45f && ((Vector2)(ref ((FVRInteractiveObject)Weapon).m_hand.Input.TouchpadAxes)).magnitude > 0.4f && ((FVRInteractiveObject)Weapon).m_hand.Input.TouchpadPressed)
{
if (Weapon.m_fireSelectorMode == SemiAutoFireSelectorPosition)
{
AudioSource.clip = SemiAutoAudioClips;
if (!AudioSource.isPlaying)
{
AudioSource.Play();
}
}
else if (Weapon.m_fireSelectorMode == FullAutoFireSelectorPosition)
{
AudioSource.clip = FullAutoAudioClips;
if (!AudioSource.isPlaying)
{
AudioSource.Play();
}
}
}
if (!((FVRInteractiveObject)Weapon).m_hand.IsInStreamlinedMode || !((FVRInteractiveObject)Weapon).m_hand.Input.BYButtonPressed)
{
return;
}
if (Weapon.m_fireSelectorMode == SemiAutoFireSelectorPosition)
{
AudioSource.clip = SemiAutoAudioClips;
if (!AudioSource.isPlaying)
{
AudioSource.Play();
}
}
else if (Weapon.m_fireSelectorMode == FullAutoFireSelectorPosition)
{
AudioSource.clip = FullAutoAudioClips;
if (!AudioSource.isPlaying)
{
AudioSource.Play();
}
}
}
}
public class PlayAudioWhenTransform : MonoBehaviour
{
public enum dirtype
{
x,
y,
z,
w
}
public enum transformtype
{
position,
rotation,
scale,
quaternion,
quaternionPresentedEuler
}
[Header("Object Being Observed")]
public GameObject ObservedObject;
public dirtype DirectionOfObservation;
public transformtype TransformationTypeOfObservedObject;
public float StartOfObservation;
public float StopOfObservation;
[Header("Audio")]
public AudioClip AudioClipsStartOfObservation;
public AudioClip AudioClipsStopOfObservation;
public AudioSource AudioSource;
[HideInInspector]
public float observationpoint;
[HideInInspector]
public bool _isObservedObjectNotNull;
public bool _hasPlayedStartAudio = false;
public bool _hasPlayedStopAudio = false;
public void Start()
{
_isObservedObjectNotNull = (Object)(object)ObservedObject != (Object)null;
_hasPlayedStartAudio = false;
_hasPlayedStopAudio = false;
}
public void Update()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
if (_isObservedObjectNotNull)
{
switch (TransformationTypeOfObservedObject)
{
case transformtype.position:
{
Vector3 localPosition = ObservedObject.transform.localPosition;
observationpoint = ((Vector3)(ref localPosition))[(int)DirectionOfObservation];
break;
}
case transformtype.rotation:
{
Vector3 localEulerAngles = ObservedObject.transform.localEulerAngles;
observationpoint = ((Vector3)(ref localEulerAngles))[(int)DirectionOfObservation];
break;
}
case transformtype.scale:
{
Vector3 localScale = ObservedObject.transform.localScale;
observationpoint = ((Vector3)(ref localScale))[(int)DirectionOfObservation];
break;
}
case transformtype.quaternion:
{
Quaternion localRotation2 = ObservedObject.transform.localRotation;
observationpoint = ((Quaternion)(ref localRotation2))[(int)DirectionOfObservation];
break;
}
case transformtype.quaternionPresentedEuler:
{
Quaternion localRotation = ObservedObject.transform.localRotation;
observationpoint = ((Quaternion)(ref localRotation))[(int)DirectionOfObservation] * 180f;
break;
}
}
}
if (observationpoint == StopOfObservation)
{
_hasPlayedStartAudio = false;
if (!_hasPlayedStopAudio)
{
AudioSource.clip = AudioClipsStopOfObservation;
if (!AudioSource.isPlaying)
{
AudioSource.PlayOneShot(AudioClipsStopOfObservation, 0.4f);
}
}
_hasPlayedStopAudio = true;
}
if (observationpoint != StartOfObservation)
{
return;
}
_hasPlayedStopAudio = false;
if (!_hasPlayedStartAudio)
{
AudioSource.clip = AudioClipsStartOfObservation;
if (!AudioSource.isPlaying)
{
AudioSource.PlayOneShot(AudioClipsStartOfObservation, 0.4f);
}
_hasPlayedStartAudio = true;
}
}
}
public class RoundClassForDiffModes : MonoBehaviour
{
public ClosedBoltWeapon Weapon;
public int FireSelectorPosition1;
public int FireSelectorPosition2;
public FireArmRoundClass RoundClass1;
public FireArmRoundClass RoundClass2;
public void Update()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((FVRInteractiveObject)Weapon).m_hand != (Object)null)
{
if (Weapon.m_fireSelectorMode == FireSelectorPosition1 && (Object)(object)Weapon.Chamber != (Object)null && (Object)(object)Weapon.Chamber.m_round != (Object)null && Weapon.Chamber.m_round.RoundClass != RoundClass1)
{
Weapon.Chamber.m_round = ((AnvilAsset)AM.GetRoundSelfPrefab(Weapon.Chamber.m_round.RoundType, RoundClass1)).GetGameObject().GetComponent<FVRFireArmRound>();
Weapon.Chamber.UpdateProxyDisplay();
}
if (Weapon.m_fireSelectorMode == FireSelectorPosition2 && (Object)(object)Weapon.Chamber != (Object)null && (Object)(object)Weapon.Chamber.m_round != (Object)null && Weapon.Chamber.m_round.RoundClass != RoundClass2)
{
Weapon.Chamber.m_round = ((AnvilAsset)AM.GetRoundSelfPrefab(Weapon.Chamber.m_round.RoundType, RoundClass2)).GetGameObject().GetComponent<FVRFireArmRound>();
Weapon.Chamber.UpdateProxyDisplay();
}
}
}
}
}
public enum ControlMode
{
simple = 1,
touch
}
public class VehicleControl : MonoBehaviour
{
[Serializable]
public class CarWheels
{
public ConnectWheel wheels;
}
[Serializable]
public class ConnectWheel
{
public bool frontWheelDrive = true;
public Transform frontRight;
public Transform frontLeft;
public WheelSetting frontSetting;
public bool backWheelDrive = true;
public Transform backRight;
public Transform backLeft;
public WheelSetting rearSetting;
}
[Serializable]
public class WheelSetting
{
public float Radius = 0.4f;
public float Weight = 1000f;
public float Distance = 0.2f;
}
[Serializable]
public class CarLights
{
public Light[] brakeLights;
public Light[] reverseLights;
}
[Serializable]
public class CarSounds
{
public AudioSource IdleEngine;
public AudioSource LowEngine;
public AudioSource HighEngine;
public float minPitch = 1f;
public float maxPitch = 10f;
public AudioSource nitro;
public AudioSource switchGear;
}
[Serializable]
public class CarParticles
{
public GameObject brakeParticlePerfab;
public ParticleSystem shiftParticle1;
public ParticleSystem shiftParticle2;
private GameObject[] wheelParticle = (GameObject[])(object)new GameObject[4];
}
[Serializable]
public class CarSetting
{
public bool showNormalGizmos = false;
public Transform carSteer;
public HitGround[] hitGround;
public List<Transform> cameraSwitchView;
public float springs = 25000f;
public float dampers = 1500f;
public float carPower = 120f;
public float shiftPower = 150f;
public float brakePower = 8000f;
public Vector3 shiftCentre = new Vector3(0f, -0.8f, 0f);
public float maxSteerAngle = 25f;
public float shiftDownRPM = 1500f;
public float shiftUpRPM = 2500f;
public float idleRPM = 500f;
public float stiffness = 2f;
public bool automaticGear = true;
public float[] gears = new float[6] { -10f, 9f, 6f, 4.5f, 3f, 2.5f };
public float LimitBackwardSpeed = 60f;
public float LimitForwardSpeed = 220f;
}
[Serializable]
public class HitGround
{
public string tag = "street";
public bool grounded = false;
public AudioClip brakeSound;
public AudioClip groundSound;
public Color brakeColor;
}
private class WheelComponent
{
public Transform wheel;
public WheelCollider collider;
public Vector3 startPos;
public float rotation = 0f;
public float rotation2 = 0f;
public float maxSteer;
public bool drive;
public float pos_y = 0f;
public WheelSetting settings;
}
public ControlMode controlMode = ControlMode.simple;
public bool activeControl = false;
public CarWheels carWheels;
public CarLights carLights;
public CarSounds carSounds;
public CarParticles carParticles;
public CarSetting carSetting;
[HideInInspector]
public float steer = 0f;
[HideInInspector]
public float accel = 0f;
[HideInInspector]
public bool brake;
private bool shifmotor;
[HideInInspector]
public float curTorque = 100f;
[HideInInspector]
public float powerShift = 100f;
[HideInInspector]
public bool shift;
private float torque = 100f;
[HideInInspector]
public float speed = 0f;
private float lastSpeed = -10f;
private bool shifting = false;
private float[] efficiencyTable = new float[22]
{
0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1f, 0.95f,
0.8f, 0.7f, 0.6f, 0.5f, 0.45f, 0.4f, 0.36f, 0.33f, 0.3f, 0.2f,
0.1f, 0.05f
};
private float efficiencyTableStep = 250f;
private float Pitch;
private float PitchDelay;
private float shiftTime = 0f;
private float shiftDelay = 0f;
[HideInInspector]
public int currentGear = 0;
[HideInInspector]
public bool NeutralGear = true;
[HideInInspector]
public float motorRPM = 0f;
[HideInInspector]
public bool Backward = false;
[HideInInspector]
public float accelFwd = 0f;
[HideInInspector]
public float accelBack = 0f;
[HideInInspector]
public float steerAmount = 0f;
private float wantedRPM = 0f;
private float w_rotate;
private float slip;
private float slip2 = 0f;
private GameObject[] Particle = (GameObject[])(object)new GameObject[4];
private Vector3 steerCurAngle;
private Rigidbody myRigidbody;
private WheelComponent[] wheels;
public bool isOn = true;
public bool isForciblyOff = false;
private WheelComponent SetWheelComponent(Transform wheel, float maxSteer, bool drive, float pos_y, WheelSetting setting)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0035: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Expected O, but got Unknown
//IL_00b0: 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)
WheelComponent wheelComponent = new WheelComponent();
GameObject val = new GameObject(((Object)wheel).name + "WheelCollider");
val.transform.parent = ((Component)this).transform;
val.transform.position = wheel.position;
val.transform.eulerAngles = ((Component)this).transform.eulerAngles;
pos_y = val.transform.localPosition.y;
WheelCollider val2 = (WheelCollider)val.AddComponent(typeof(WheelCollider));
wheelComponent.wheel = wheel;
wheelComponent.collider = val.GetComponent<WheelCollider>();
wheelComponent.drive = drive;
wheelComponent.pos_y = pos_y;
wheelComponent.maxSteer = maxSteer;
wheelComponent.startPos = val.transform.localPosition;
wheelComponent.settings = setting;
return wheelComponent;
}
private void Awake()
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: 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_0223: 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_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_02be: 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)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
if (carSetting.automaticGear)
{
NeutralGear = false;
}
myRigidbody = ((Component)((Component)this).transform).GetComponent<Rigidbody>();
wheels = new WheelComponent[4];
wheels[0] = SetWheelComponent(carWheels.wheels.frontRight, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontRight.position.y, carWheels.wheels.frontSetting);
wheels[1] = SetWheelComponent(carWheels.wheels.frontLeft, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontLeft.position.y, carWheels.wheels.frontSetting);
wheels[2] = SetWheelComponent(carWheels.wheels.backRight, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backRight.position.y, carWheels.wheels.rearSetting);
wheels[3] = SetWheelComponent(carWheels.wheels.backLeft, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backLeft.position.y, carWheels.wheels.rearSetting);
if (Object.op_Implicit((Object)(object)carSetting.carSteer))
{
steerCurAngle = carSetting.carSteer.localEulerAngles;
}
WheelComponent[] array = wheels;
foreach (WheelComponent wheelComponent in array)
{
WheelCollider collider = wheelComponent.collider;
collider.suspensionDistance = wheelComponent.settings.Distance;
JointSpring suspensionSpring = collider.suspensionSpring;
suspensionSpring.spring = carSetting.springs;
suspensionSpring.damper = carSetting.dampers;
collider.suspensionSpring = suspensionSpring;
collider.radius = wheelComponent.settings.Radius;
collider.mass = wheelComponent.settings.Weight;
WheelFrictionCurve val = collider.forwardFriction;
((WheelFrictionCurve)(ref val)).asymptoteValue = 5000f;
((WheelFrictionCurve)(ref val)).extremumSlip = 2f;
((WheelFrictionCurve)(ref val)).asymptoteSlip = 20f;
((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness;
collider.forwardFriction = val;
val = collider.sidewaysFriction;
((WheelFrictionCurve)(ref val)).asymptoteValue = 7500f;
((WheelFrictionCurve)(ref val)).asymptoteSlip = 2f;
((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness;
collider.sidewaysFriction = val;
}
}
public void TurnOnEngine(bool forcibly)
{
if (!isForciblyOff)
{
isOn = true;
}
else if (forcibly)
{
isForciblyOff = false;
isOn = true;
}
}
public void TurnOffEngine(bool forcibly)
{
isForciblyOff = forcibly;
isOn = false;
}
public void ShiftTo(int newGear)
{
((Component)carSounds.switchGear).GetComponent<AudioSource>().Play();
currentGear = newGear;
if (currentGear == 0)
{
NeutralGear = true;
}
else
{
NeutralGear = false;
}
if (currentGear == -1)
{
currentGear = 0;
}
}
public void ShiftUp(bool ignoreDelay)
{
float timeSinceLevelLoad = Time.timeSinceLevelLoad;
if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || currentGear >= carSetting.gears.Length - 1)
{
return;
}
((Component)carSounds.switchGear).GetComponent<AudioSource>().Play();
if (!carSetting.automaticGear)
{
if (currentGear == 0)
{
if (NeutralGear)
{
currentGear++;
NeutralGear = false;
}
else
{
NeutralGear = true;
}
}
else
{
currentGear++;
}
}
else
{
currentGear++;
}
shiftDelay = timeSinceLevelLoad + 1f;
shiftTime = 1.5f;
}
public void ShiftDown(bool ignoreDelay)
{
float timeSinceLevelLoad = Time.timeSinceLevelLoad;
if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || (currentGear <= 0 && !NeutralGear))
{
return;
}
((Component)carSounds.switchGear).GetComponent<AudioSource>().Play();
if (!carSetting.automaticGear)
{
if (currentGear == 1)
{
if (!NeutralGear)
{
currentGear--;
NeutralGear = true;
}
}
else if (currentGear == 0)
{
NeutralGear = false;
}
else
{
currentGear--;
}
}
else
{
currentGear--;
}
shiftDelay = timeSinceLevelLoad + 0.1f;
shiftTime = 2f;
}
private void OnCollisionEnter(Collision collision)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: 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_00a1: 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_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>()))
{
VehicleControl component = ((Component)collision.transform.root).GetComponent<VehicleControl>();
Vector3 relativeVelocity = collision.relativeVelocity;
component.slip2 = Mathf.Clamp(((Vector3)(ref relativeVelocity)).magnitude, 0f, 10f);
myRigidbody.angularVelocity = new Vector3((0f - myRigidbody.angularVelocity.x) * 0.5f, myRigidbody.angularVelocity.y * 0.5f, (0f - myRigidbody.angularVelocity.z) * 0.5f);
myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, myRigidbody.velocity.y * 0.5f, myRigidbody.velocity.z);
}
}
private void OnCollisionStay(Collision collision)
{
if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>()))
{
((Component)collision.transform.root).GetComponent<VehicleControl>().slip2 = 5f;
}
}
private void Update()
{
}
private void FixedUpdate()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0704: Unknown result type (might be due to invalid IL or missing references)
//IL_0709: Unknown result type (might be due to invalid IL or missing references)
//IL_0751: Unknown result type (might be due to invalid IL or missing references)
//IL_075a: Unknown result type (might be due to invalid IL or missing references)
//IL_075f: Unknown result type (might be due to invalid IL or missing references)
//IL_079b: Unknown result type (might be due to invalid IL or missing references)
//IL_0acf: Unknown result type (might be due to invalid IL or missing references)
//IL_0ae0: Unknown result type (might be due to invalid IL or missing references)
//IL_0ae5: Unknown result type (might be due to invalid IL or missing references)
//IL_0fca: Unknown result type (might be due to invalid IL or missing references)
//IL_0fd4: Unknown result type (might be due to invalid IL or missing references)
//IL_0ee6: Unknown result type (might be due to invalid IL or missing references)
//IL_0eed: Unknown result type (might be due to invalid IL or missing references)
//IL_0ef2: Unknown result type (might be due to invalid IL or missing references)
//IL_0f0c: Unknown result type (might be due to invalid IL or missing references)
//IL_0f17: Unknown result type (might be due to invalid IL or missing references)
//IL_0f1c: Unknown result type (might be due to invalid IL or missing references)
//IL_0f25: Unknown result type (might be due to invalid IL or missing references)
//IL_0fec: Unknown result type (might be due to invalid IL or missing references)
//IL_0b3b: Unknown result type (might be due to invalid IL or missing references)
//IL_0b40: Unknown result type (might be due to invalid IL or missing references)
//IL_0d23: Unknown result type (might be due to invalid IL or missing references)
if (!isOn)
{
accel = 0f;
}
Vector3 velocity = myRigidbody.velocity;
speed = ((Vector3)(ref velocity)).magnitude * 2.7f;
if (speed < lastSpeed - 10f && slip < 10f)
{
slip = lastSpeed / 15f;
}
lastSpeed = speed;
if (slip2 != 0f)
{
slip2 = Mathf.MoveTowards(slip2, 0f, 0.1f);
}
myRigidbody.centerOfMass = carSetting.shiftCentre;
if (!carWheels.wheels.frontWheelDrive && !carWheels.wheels.backWheelDrive)
{
accel = 0f;
}
if (Object.op_Implicit((Object)(object)carSetting.carSteer))
{
carSetting.carSteer.localEulerAngles = new Vector3(steerCurAngle.x, steerCurAngle.y, steerCurAngle.z + steer * -120f);
}
if (carSetting.automaticGear && currentGear == 1 && accel < 0f)
{
if (speed < 5f)
{
ShiftDown(ignoreDelay: false);
}
}
else if (carSetting.automaticGear && currentGear == 0 && accel > 0f)
{
if (speed < 5f)
{
ShiftUp(ignoreDelay: false);
}
}
else if (carSetting.automaticGear && motorRPM > carSetting.shiftUpRPM && accel > 0f && speed > 10f && !brake)
{
ShiftUp(ignoreDelay: false);
}
else if (carSetting.automaticGear && motorRPM < carSetting.shiftDownRPM && currentGear > 1)
{
ShiftDown(ignoreDelay: false);
}
if (speed < 1f)
{
Backward = true;
}
if (currentGear != 0 || !Backward)
{
Backward = false;
}
Light[] brakeLights = carLights.brakeLights;
foreach (Light val in brakeLights)
{
if (brake || accel < 0f || speed < 1f)
{
val.intensity = Mathf.MoveTowards(val.intensity, 8f, 0.5f);
}
else
{
val.intensity = Mathf.MoveTowards(val.intensity, 0f, 0.5f);
}
((Behaviour)val).enabled = val.intensity != 0f;
}
Light[] reverseLights = carLights.reverseLights;
foreach (Light val2 in reverseLights)
{
if (speed > 2f && currentGear == 0)
{
val2.intensity = Mathf.MoveTowards(val2.intensity, 8f, 0.5f);
}
else
{
val2.intensity = Mathf.MoveTowards(val2.intensity, 0f, 0.5f);
}
((Behaviour)val2).enabled = val2.intensity != 0f;
}
wantedRPM = 5500f * accel * 0.1f + wantedRPM * 0.9f;
float num = 0f;
int num2 = 0;
bool flag = false;
int num3 = 0;
WheelComponent[] array = wheels;
WheelHit val4 = default(WheelHit);
foreach (WheelComponent wheelComponent in array)
{
WheelCollider collider = wheelComponent.collider;
if (wheelComponent.drive)
{
num = ((!NeutralGear && brake && currentGear < 2) ? (num + accel * carSetting.idleRPM) : (NeutralGear ? (num + carSetting.idleRPM * accel) : (num + collider.rpm)));
num2++;
}
if (brake || accel < 0f)
{
if (accel < 0f || (brake && (wheelComponent == wheels[2] || wheelComponent == wheels[3])))
{
if (brake && accel > 0f)
{
slip = Mathf.Lerp(slip, 5f, accel * 0.01f);
}
else if (speed > 1f)
{
slip = Mathf.Lerp(slip, 1f, 0.002f);
}
else
{
slip = Mathf.Lerp(slip, 1f, 0.02f);
}
wantedRPM = 0f;
collider.brakeTorque = carSetting.brakePower;
wheelComponent.rotation = w_rotate;
}
}
else
{
float brakeTorque;
if (accel == 0f || NeutralGear)
{
float num5 = (collider.brakeTorque = 1000f);
brakeTorque = num5;
}
else
{
float num5 = (collider.brakeTorque = 0f);
brakeTorque = num5;
}
collider.brakeTorque = brakeTorque;
slip = ((!(speed > 0f)) ? (slip = Mathf.Lerp(slip, 0.01f, 0.02f)) : ((!(speed > 100f)) ? (slip = Mathf.Lerp(slip, 1.5f, 0.02f)) : (slip = Mathf.Lerp(slip, 1f + Mathf.Abs(steer), 0.02f))));
w_rotate = wheelComponent.rotation;
}
WheelFrictionCurve val3 = collider.forwardFriction;
((WheelFrictionCurve)(ref val3)).asymptoteValue = 5000f;
((WheelFrictionCurve)(ref val3)).extremumSlip = 2f;
((WheelFrictionCurve)(ref val3)).asymptoteSlip = 20f;
((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2);
collider.forwardFriction = val3;
val3 = collider.sidewaysFriction;
((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2);
((WheelFrictionCurve)(ref val3)).extremumSlip = 0.2f + Mathf.Abs(steer);
collider.sidewaysFriction = val3;
if (shift && currentGear > 1 && speed > 50f && shifmotor && Mathf.Abs(steer) < 0.2f)
{
if (powerShift == 0f)
{
shifmotor = false;
}
powerShift = Mathf.MoveTowards(powerShift, 0f, Time.deltaTime * 10f);
carSounds.nitro.volume = Mathf.Lerp(carSounds.nitro.volume, 1f, Time.deltaTime * 10f);
if (!carSounds.nitro.isPlaying)
{
((Component)carSounds.nitro).GetComponent<AudioSource>().Play();
}
curTorque = ((!(powerShift > 0f)) ? carSetting.carPower : carSetting.shiftPower);
carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f);
carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f);
}
else
{
if (powerShift > 20f)
{
shifmotor = true;
}
carSounds.nitro.volume = Mathf.MoveTowards(carSounds.nitro.volume, 0f, Time.deltaTime * 2f);
if (carSounds.nitro.volume == 0f)
{
carSounds.nitro.Stop();
}
powerShift = Mathf.MoveTowards(powerShift, 100f, Time.deltaTime * 5f);
curTorque = carSetting.carPower;
carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, 0f, Time.deltaTime * 10f);
carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, 0f, Time.deltaTime * 10f);
}
wheelComponent.rotation = Mathf.Repeat(wheelComponent.rotation + Time.deltaTime * collider.rpm * 360f / 60f, 360f);
wheelComponent.rotation2 = Mathf.Lerp(wheelComponent.rotation2, collider.steerAngle, 0.1f);
wheelComponent.wheel.localRotation = Quaternion.Euler(wheelComponent.rotation, wheelComponent.rotation2, 0f);
Vector3 localPosition = wheelComponent.wheel.localPosition;
if (collider.GetGroundHit(ref val4))
{
if (Object.op_Implicit((Object)(object)carParticles.brakeParticlePerfab))
{
if ((Object)(object)Particle[num3] == (Object)null)
{
Particle[num3] = Object.Instantiate<GameObject>(carParticles.brakeParticlePerfab, wheelComponent.wheel.position, Quaternion.identity);
((Object)Particle[num3]).name = "WheelParticle";
Particle[num3].transform.parent = ((Component)this).transform;
Particle[num3].AddComponent<AudioSource>();
Particle[num3].GetComponent<AudioSource>().maxDistance = 50f;
Particle[num3].GetComponent<AudioSource>().spatialBlend = 1f;
Particle[num3].GetComponent<AudioSource>().dopplerLevel = 5f;
Particle[num3].GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)2;
}
ParticleSystem component = Particle[num3].GetComponent<ParticleSystem>();
bool flag2 = false;
for (int l = 0; l < carSetting.hitGround.Length; l++)
{
if (((Component)((WheelHit)(ref val4)).collider).CompareTag(carSetting.hitGround[l].tag))
{
flag2 = carSetting.hitGround[l].grounded;
if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.5f) && speed > 1f)
{
Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[l].brakeSound;
}
else if ((Object)(object)Particle[num3].GetComponent<AudioSource>().clip != (Object)(object)carSetting.hitGround[l].groundSound && !Particle[num3].GetComponent<AudioSource>().isPlaying)
{
Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[l].groundSound;
}
Particle[num3].GetComponent<ParticleSystem>().startColor = carSetting.hitGround[l].brakeColor;
}
}
if (flag2 && speed > 5f && !brake)
{
component.enableEmission = true;
Particle[num3].GetComponent<AudioSource>().volume = 0.5f;
if (!Particle[num3].GetComponent<AudioSource>().isPlaying)
{
Particle[num3].GetComponent<AudioSource>().Play();
}
}
else if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && speed > 1f)
{
if (accel < 0f || ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && (wheelComponent == wheels[2] || wheelComponent == wheels[3])))
{
if (!Particle[num3].GetComponent<AudioSource>().isPlaying)
{
Particle[num3].GetComponent<AudioSource>().Play();
}
component.enableEmission = true;
Particle[num3].GetComponent<AudioSource>().volume = 10f;
}
}
else
{
component.enableEmission = false;
Particle[num3].GetComponent<AudioSource>().volume = Mathf.Lerp(Particle[num3].GetComponent<AudioSource>().volume, 0f, Time.deltaTime * 10f);
}
}
localPosition.y -= Vector3.Dot(wheelComponent.wheel.position - ((WheelHit)(ref val4)).point, ((Component)this).transform.TransformDirection(0f, 1f, 0f) / ((Component)this).transform.lossyScale.x) - collider.radius;
localPosition.y = Mathf.Clamp(localPosition.y, -10f, wheelComponent.pos_y);
flag = flag || wheelComponent.drive;
}
else
{
if ((Object)(object)Particle[num3] != (Object)null)
{
ParticleSystem component2 = Particle[num3].GetComponent<ParticleSystem>();
component2.enableEmission = false;
}
localPosition.y = wheelComponent.startPos.y - wheelComponent.settings.Distance;
myRigidbody.AddForce(Vector3.down * 5000f);
}
num3++;
wheelComponent.wheel.localPosition = localPosition;
}
if (num2 > 1)
{
num /= (float)num2;
}
motorRPM = 0.95f * motorRPM + 0.05f * Mathf.Abs(num * carSetting.gears[currentGear]);
if (motorRPM > 5500f)
{
motorRPM = 5200f;
}
int num7 = (int)(motorRPM / efficiencyTableStep);
if (num7 >= efficiencyTable.Length)
{
num7 = efficiencyTable.Length - 1;
}
if (num7 < 0)
{
num7 = 0;
}
float num8 = curTorque * carSetting.gears[currentGear] * efficiencyTable[num7];
WheelComponent[] array2 = wheels;
foreach (WheelComponent wheelComponent2 in array2)
{
WheelCollider collider2 = wheelComponent2.collider;
if (wheelComponent2.drive)
{
if (Mathf.Abs(collider2.rpm) > Mathf.Abs(wantedRPM))
{
collider2.motorTorque = 0f;
}
else
{
float motorTorque = collider2.motorTorque;
if (!brake && accel != 0f && !NeutralGear)
{
if ((speed < carSetting.LimitForwardSpeed && currentGear > 0) || (speed < carSetting.LimitBackwardSpeed && currentGear == 0))
{
collider2.motorTorque = motorTorque * 0.9f + num8 * 1f;
}
else
{
collider2.motorTorque = 0f;
collider2.brakeTorque = 2000f;
}
}
else
{
collider2.motorTorque = 0f;
}
}
}
if (brake || slip2 > 2f)
{
collider2.steerAngle = Mathf.Lerp(collider2.steerAngle, steer * wheelComponent2.maxSteer, 0.02f);
continue;
}
float num9 = Mathf.Clamp(speed / carSetting.maxSteerAngle, 1f, carSetting.maxSteerAngle);
collider2.steerAngle = steer * (wheelComponent2.maxSteer / num9);
}
Pitch = Mathf.Clamp(1.2f + (motorRPM - carSetting.idleRPM) / (carSetting.shiftUpRPM - carSetting.idleRPM), 1f, 10f);
shiftTime = Mathf.MoveTowards(shiftTime, 0f, 0.1f);
if (Pitch == 1f)
{
carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1f, 0.1f);
carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f);
carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.1f);
}
else
{
carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1.8f - Pitch, 0.1f);
if ((Pitch > PitchDelay || accel > 0f) && shiftTime == 0f)
{
carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0f, 0.2f);
carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 1f, 0.1f);
}
else
{
carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f);
carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.2f);
}
carSounds.HighEngine.pitch = Pitch;
carSounds.LowEngine.pitch = Pitch;
PitchDelay = Pitch;
}
if (!isOn)
{
carSounds.IdleEngine.volume = 0f;
carSounds.LowEngine.volume = 0f;
carSounds.HighEngine.volume = 0f;
}
}
private void OnDrawGizmos()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
if (carSetting.showNormalGizmos && !Application.isPlaying)
{
Matrix4x4 matrix = Matrix4x4.TRS(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.lossyScale);
Gizmos.matrix = matrix;
Gizmos.color = new Color(1f, 0f, 0f, 0.5f);
Gizmos.DrawCube(Vector3.up / 1.5f, new Vector3(2.5f, 2f, 6f));
Gizmos.DrawSphere(carSetting.shiftCentre / ((Component)this).transform.lossyScale.x, 0.2f);
}
}
}
public class EnableOnSpecificUser : MonoBehaviour
{
public enum action
{
Enable,
Disable,
ModifyFirearm
}
public action Action;
public List<CSteamID> listofUsers;
[Header("Object Enable")]
public GameObject objectToEnable;
[Header("Firearm Modify")]
public Handgun Handgun;
public bool HasMagReleaseButton;
}
namespace H3VRUtils.MonoScripts.VisualModifiers
{
internal class AnimPlayOnGrab : MonoBehaviour
{
public Animation animation;
public FVRPhysicalObject Object;
public string AnimNameOnGrab;
public string AnimNameOnLetGo;
private bool isGrabbed;
public void Update()
{
if (animation.isPlaying)
{
return;
}
if ((Object)(object)((FVRInteractiveObject)Object).m_hand != (Object)null)
{
if (!isGrabbed)
{
animation.Play(AnimNameOnGrab);
isGrabbed = true;
}
}
else if (isGrabbed)
{
animation.Play(AnimNameOnLetGo);
isGrabbed = false;
}
}
}
internal class ConstantSpin : MonoBehaviour
{
public GameObject spinnything;
public float spinrate;
public ? directionofspeen;
public void FixedUpdate()
{
//IL_0003: 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_001c: Expected I4, but got Unknown
//IL_0027: 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_003d: 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_004b: Expected I4, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected I4, but got Unknown
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = default(Vector3);
((Vector3)(ref val))[(int)directionofspeen] = spinrate;
spinnything.transform.Rotate(val);
Vector3 localEulerAngles = spinnything.transform.localEulerAngles;
if (((Vector3)(ref localEulerAngles))[(int)directionofspeen] == 360f)
{
((Vector3)(ref val))[(int)directionofspeen] = 0f;
spinnything.transform.Rotate(val);
}
}
}
internal class CycleOnBoltRelease : MonoBehaviour
{
public FVRFireArmChamber chamber;
public GameObject muzzle;
public List<Transform> Locs;
private int pointer;
private bool wasFull;
public void Update()
{
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
if (wasFull && !chamber.IsFull)
{
pointer++;
if (pointer > Locs.Count)
{
pointer = 0;
}
muzzle.transform.position = Locs[pointer].position;
muzzle.transform.rotation = Locs[pointer].rotation;
}
wasFull = chamber.IsFull;
}
}
internal class FeedRamp : MonoBehaviour
{
public GameObject Carrier;
public FVRFireArm firearm;
public float CarrierDetectDistance;
public Vector2 CarrierRots;
public Transform CarrierComparePoint1;
public Transform CarrierComparePoint2;
private float m_curCarrierRot;
private float m_tarCarrierRot;
}
public class ManipulateObjectFixed : MonoBehaviour
{
public enum dirtype
{
x,
y,
z,
w
}
public enum transformtype
{
position,
rotation,
scale,
quaternion,
quaternionPresentedEuler
}
public enum dir
{
both,
towardsStop,
towardsStart
}
public enum StreamlinedDirType
{
AX_Button,
BY_Button,
Trigger
}
[Header("Object Being Observed")]
public GameObject ObservedObject;
public dirtype DirectionOfObservation;
public transformtype TransformationTypeOfObservedObject;
public float StartOfObservation;
public float StopOfObservation;
public dir ObservationDirection;
[Header("Object Being Affected")]
public GameObject AffectedObject;
public dirtype DirectionOfAffection;
public transformtype TransformationTypeOfAffectedObject;
public float StartOfAffected;
public float StopOfAffected;
[Header("General Modifiers")]
[Tooltip("Affected object will move itself over time to the expected position, instead of immediately. Recommended from 5-40. Defaults to 100 for effectively instant movement.")]
public float LerpAmount = 100f;
public bool usesCurve;
[Tooltip("X/Y axis must be 0 to 1.")]
public AnimationCurve Curve;
[Header("Debug Values")]
public float observationpoint;
public float observationDistancePc;
public float finalPoint;
public float previousObservationDistancePc;
public float previousFinalPoint;
public float finalLerpAmt;
private float rememberLerpPoint = -999f;
[Header("Special Observations")]
[Tooltip("When the observed object reaches or exceeds the stopofobservation, the affected object will snap back to the startofaffected, and will only reset when the observed object reaches the startofobserved.")]
[Header("Snap Forwards")]
public bool SnapForwardsOnMax;
public bool SnappedForwards;
public float SnapBackAt;
[Tooltip("If off, it will 'unsnap' when under the bounds of Start Of Observation, Stop Of Observation, and Snap Back At. When on, it will unsnap when above all of those.")]
public bool ResetIfOverBounds;
[Tooltip("When on, it will lock when at its max, rather than snapping forward.")]
public bool LockForward;
[Header("Move On Touch Pad")]
public bool ReadHandTouchpadMovement;
public FVRInteractiveObject ItemToReadFrom;
public ? DirToRead;
public StreamlinedDirType DirToReadStreamlined;
[Header("Move On Mag Loaded")]
public bool ReadIfGunIsLoaded;
public FVRFireArm FirearmToReadFrom;
[Header("Move If Bolt Locked - Closed Bolt Only")]
public bool ReadIfBoltIsLocked;
public ClosedBolt BoltToReadFrom;
[Header("Move If Specific Attachment Attached")]
public bool MoveIfSpecificAttachmentAttached;
public List<string> AttachmentIDs;
public FVRFireArmAttachmentMount AttachmentMount;
private int rememberAttached;
private float lastDecision;
[Header("Move If Object Held")]
public bool MoveIfObjectHeld;
public FVRInteractiveObject HeldObject;
private bool _isObservedObjectNotNull;
[Header("Move If Grenade Armed")]
public bool MoveIfGrenadeArmed;
public PinnedGrenade grenade;
[Header("Move If Disabled")]
public bool MoveIfDisabled;
[Header("Move If Chamber Full")]
public bool MoveIfChamberFull;
public FVRFireArmChamber Chamber;
public bool considerFullEvenIfRoundFired;
[Header("Special Affected Things")]
[Header("Move Attached Items")]
public bool MoveAttachedItems;
[Tooltip("NOTE: THIS ONLY APPLIES TO THE FIRST ATTACHMENT IN THE MOUNT.")]
public FVRFireArmAttachmentMount MAImount;
[Header("Disable If Observed Object Moved")]
public bool DisableIfMoved;
[Tooltip("The percentage (from 0-1, not 0-100) at which point it disables. NOTE: IF SCRIPT IS ON DISABLED OBJECT, WILL NOT REENABLE")]
[Range(0f, 1f)]
public float percentageCutoff;
private void Start()
{
_isObservedObjectNotNull = (Object)(object)ObservedObject != (Object)null;
}
public void Update()
{
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Invalid comparison between Unknown and I4
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Unknown result type (might be due to invalid IL or missing references)
//IL_0381: Invalid comparison between Unknown and I4
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Invalid comparison between Unknown and I4
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_038c: Unknown result type (might be due to invalid IL or missing references)
//IL_0392: Invalid comparison between Unknown and I4
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Invalid comparison between Unknown and I4
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Invalid comparison between Unknown and I4
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_0748: Unknown result type (might be due to invalid IL or missing references)
//IL_074d: Unknown result type (might be due to invalid IL or missing references)
//IL_076d: Unknown result type (might be due to invalid IL or missing references)
//IL_0784: Unknown result type (might be due to invalid IL or missing references)
//IL_0789: Unknown result type (might be due to invalid IL or missing references)
//IL_07a9: Unknown result type (might be due to invalid IL or missing references)
//IL_07c0: Unknown result type (might be due to invalid IL or missing references)
//IL_07c5: Unknown result type (might be due to invalid IL or missing references)
//IL_07e5: Unknown result type (might be due to invalid IL or missing references)
//IL_07fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0801: Unknown result type (might be due to invalid IL or missing references)
//IL_0821: Unknown result type (might be due to invalid IL or missing references)
//IL_0838: Unknown result type (might be due to invalid IL or missing references)
//IL_083d: Unknown result type (might be due to invalid IL or missing references)
//IL_085d: Unknown result type (might be due to invalid IL or missing references)
previousObservationDistancePc = observationDistancePc;
observationDistancePc = 0f;
if (_isObservedObjectNotNull)
{
switch (TransformationTypeOfObservedObject)
{
case transformtype.position:
{
Vector3 localPosition = ObservedObject.transform.localPosition;
observationpoint = ((Vector3)(ref localPosition))[(int)DirectionOfObservation];
break;
}
case transformtype.rotation:
{
Vector3 localEulerAngles = ObservedObject.transform.localEulerAngles;
observationpoint = ((Vector3)(ref localEulerAngles))[(int)DirectionOfObservation];
break;
}
case transformtype.scale:
{
Vector3 localScale = ObservedObject.transform.localScale;
observationpoint = ((Vector3)(ref localScale))[(int)DirectionOfObservation];
break;
}
case transformtype.quaternion:
{
Quaternion localRotation2 = ObservedObject.transform.localRotation;
observationpoint = ((Quaternion)(ref localRotation2))[(int)DirectionOfObservation];
break;
}
case transformtype.quaternionPresentedEuler:
{
Quaternion localRotation = ObservedObject.transform.localRotation;
observationpoint = ((Quaternion)(ref localRotation))[(int)DirectionOfObservation] * 180f;
break;
}
}
observationDistancePc = Mathf.InverseLerp(StartOfObservation, StopOfObservation, observationpoint);
}
if (SnapForwardsOnMax)
{
bool flag = observationpoint <= Math.Min(StopOfObservation, Math.Min(StartOfObservation, SnapBackAt));
bool flag2 = observationpoint >= Math.Max(StopOfObservation, Math.Max(StartOfObservation, SnapBackAt));
if (flag || flag2)
{
SnappedForwards = true;
}
if (SnappedForwards)
{
observationDistancePc = 0f;
}
if ((!flag && !ResetIfOverBounds) || (!flag2 && ResetIfOverBounds))
{
SnappedForwards = false;
}
if (SnappedForwards && LockForward)
{
observationDistancePc = 1f;
}
}
if (ReadHandTouchpadMovement)
{
Vector2 up = Vector2.up;
bool flag3 = false;
if ((int)DirToRead == 0)
{
up = Vector2.up;
}
if ((int)DirToRead == 1)
{
up = Vector2.down;
}
if ((int)DirToRead == 2)
{
up = Vector2.left;
}
if ((int)DirToRead == 3)
{
up = Vector2.right;
}
if ((int)DirToRead == 4)
{
flag3 = true;
}
if ((Object)(object)ItemToReadFrom.m_hand != (Object)null)
{
switch (DirToReadStreamlined)
{
case StreamlinedDirType.AX_Button:
if (ItemToReadFrom.m_hand.Input.AXButtonPressed)
{
observationDistancePc = 1f;
}
break;
case StreamlinedDirType.Trigger:
if (ItemToReadFrom.m_hand.Input.TriggerDown)
{
observationDistancePc = 1f;
}
break;
}
}
}
if (ReadIfGunIsLoaded)
{
if ((Object)(object)FirearmToReadFrom.Magazine != (Object)null)
{
observationDistancePc = 1f;
}
else
{
observationDistancePc = 0f;
}
}
if (ReadIfBoltIsLocked)
{
if ((int)BoltToReadFrom.CurPos == 2 && (int)BoltToReadFrom.LastPos == 2)
{
observationDistancePc = 1f;
}
else
{
observationDistancePc = 0f;
}
}
if (MoveIfSpecificAttachmentAttached)
{
foreach (FVRFireArmAttachment attachments in AttachmentMount.AttachmentsList)
{
foreach (string attachmentID in AttachmentIDs)
{
if (((FVRPhysicalObject)attachments).ObjectWrapper.ItemID == attachmentID)
{
observationDistancePc = 1f;
break;
}
}
}
}
if (MoveIfObjectHeld)
{
if ((Object)(object)HeldObject.m_hand != (Object)null)
{
observationDistancePc = 1f;
}
else
{
observationDistancePc = 0f;
}
}
if (MoveIfGrenadeArmed)
{
}
if (MoveIfDisabled)
{
if (!ObservedObject.activeSelf)
{
observationDistancePc = 1f;
}
else
{
observationDistancePc = 0f;
}
}
if (MoveIfChamberFull)
{
if (considerFullEvenIfRoundFired)
{
if (Chamber.IsFull)
{
observationDistancePc = 1f;
}
}
else if (Chamber.IsFull && !Chamber.IsSpent)
{
observationDistancePc = 1f;
}
else
{
observationDistancePc = 0f;
}
}
finalLerpAmt = Mathf.Lerp(previousObservationDistancePc, observationDistancePc, LerpAmount * Time.deltaTime);
if (usesCurve)
{
finalLerpAmt = Curve.Evaluate(finalLerpAmt);
}
previousFinalPoint = finalPoint;
finalPoint = Mathf.Lerp(StartOfAffected, StopOfAffected, finalLerpAmt);
finalPoint = Mathf.Lerp(previousFinalPoint, finalPoint, LerpAmount * Time.deltaTime);
bool flag4 = false;
if (Math.Abs(rememberLerpPoint - finalPoint) < float.Epsilon)
{
flag4 = true;
}
if (!SnappedForwards)
{
if (finalPoint - rememberLerpPoint < 0f && ObservationDirection == dir.towardsStop)
{
flag4 = true;
}
if (finalPoint - rememberLerpPoint > 0f && ObservationDirection == dir.towardsStart)
{
flag4 = true;
}
}
rememberLerpPoint = finalPoint;
if (flag4)
{
return;
}
if (MoveAttachedItems)
{
}
if (DisableIfMoved)
{
Debug.Log((object)(observationDistancePc + ", " + percentageCutoff));
if (observationDistancePc >= percentageCutoff)
{
Debug.Log((object)"Hi!");
AffectedObject.SetActive(false);
}
else
{
AffectedObject.SetActive(true);
}
}
if ((Object)(object)AffectedObject != (Object)null)
{
Vector3 val;
switch (TransformationTypeOfAffectedObject)
{
case transformtype.position:
val = AffectedObject.transform.localPosition;
((Vector3)(ref val))[(int)DirectionOfAffection] = finalPoint;
AffectedObject.transform.localPosition = val;
break;
case transformtype.rotation:
val = AffectedObject.transform.localEulerAngles;
((Vector3)(ref val))[(int)DirectionOfAffection] = finalPoint;
AffectedObject.transform.localEulerAngles = val;
break;
case transformtype.scale:
val = AffectedObject.transform.localScale;
((Vector3)(ref val))[(int)DirectionOfAffection] = finalPoint;
AffectedObject.transform.localScale = val;
break;
case transformtype.quaternion:
{
Quaternion rotation = AffectedObject.transform.rotation;
((Quaternion)(ref rotation))[(int)DirectionOfAffection] = finalPoint;
AffectedObject.transform.localRotation = rotation;
break;
}
case transformtype.quaternionPresentedEuler:
val = AffectedObject.transform.localEulerAngles;
((Vector3)(ref val))[(int)DirectionOfAffection] = finalPoint;
AffectedObject.transform.localEulerAngles = val;
break;
}
}
}
}
internal class laser : MonoBehaviour
{
public GameObject endpoint;
private LineRenderer lr;
private void Start()
{
lr = ((Component)this).GetComponent<LineRenderer>();
}
private void Update()
{
//IL_000e: 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_0029: 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_0056: Unknown result type (might be due to invalid IL or missing references)
lr.SetPosition(0, ((Component)this).transform.position);
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)this).transform.position, ((Component)this).transform.forward, ref val))
{
if (Object.op_Implicit((Object)(object)((RaycastHit)(ref val)).collider))
{
lr.SetPosition(1, ((RaycastHit)(ref val)).point);
}
}
else
{
lr.SetPosition(1, endpoint.transform.position);
}
}
}
public class RotateTowardsPlayer : MonoBehaviour
{
public bool rotateOnX;
public bool rotateOnY;
public bool rotateOnZ;
public void Start()
{
//IL_000c: 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_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_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_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
Vector3 localEulerAngles = ((Component)this).gameObject.transform.localEulerAngles;
if (rotateOnX)
{
localEulerAngles.x = ((Component)this).gameObject.transform.localEulerAngles.x;
}
if (rotateOnY)
{
localEulerAngles.y = ((Component)this).gameObject.transform.localEulerAngles.y;
}
if (rotateOnZ)
{
localEulerAngles.z = ((Component)this).gameObject.transform.localEulerAngles.z;
}
((Component)this).gameObject.transform.localEulerAngles = localEulerAngles;
}
}
}