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 OtherLoader;
using Sodalite.Api;
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 FistVR
{
public class Handcopter_custom : HandCopter
{
[Header("=== CUSTOM HANDCOPTER SETTINGS ===")]
[Tooltip("How strong the sideways force is when touching the ground.\nOriginal = 0.1")]
public float GroundLateralForceMultiplier = 0.1f;
public override void Start()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
((HandCopter)this).Start();
base.myDel = new TransformVelocity(TransformVel);
}
public void TransformVel(ref Vector3 vel, ref bool isGrounded, ref bool didChange)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected I4, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_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_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: 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_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_0233: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: 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)
if (base.motorPower <= 0f)
{
didChange = false;
return;
}
float num = 5f;
GravityMode playerGravityMode = GM.Options.SimulationOptions.PlayerGravityMode;
switch ((int)playerGravityMode)
{
case 0:
num = 9.81f;
break;
case 1:
num = 5f;
break;
case 2:
num = 1.62f;
break;
case 3:
num = 0.001f;
break;
}
float num2 = Vector3.Angle(((Component)this).transform.up, Vector3.up);
float num3 = Mathf.InverseLerp(45f, 20f, num2);
Vector3 val = Vector3.zero;
if (base.targetPower == 2)
{
float num4 = num * 1.05f;
num4 *= num3;
val += Vector3.up * num4;
}
else
{
float num5 = Mathf.Max(1f, num * 1.02f);
float num6 = Mathf.Max(1f, num);
if (base.targetPower == 3)
{
num5 += 10f;
num6 += 5f;
}
else if (base.targetPower == 1)
{
num5 = Mathf.Max(0.5f, num * 0.9f);
num6 = Mathf.Max(0.5f, num * 0.5f);
}
num5 *= num3;
num6 *= Mathf.InverseLerp(120f, 160f, num2);
if (num5 > 0f)
{
val += Vector3.up * num5;
}
if (num6 > 0f)
{
val += Vector3.down * num6;
}
}
Vector3 val2 = ((Component)this).transform.up;
val2 = Vector3.ProjectOnPlane(val2, Vector3.up);
if (((Vector3)(ref val2)).magnitude >= 0.1f)
{
float num7 = Mathf.Max(1f, num);
if (base.targetPower == 3)
{
num7 += 5f;
}
else if (base.targetPower == 1)
{
num7 = Mathf.Max(0.5f, num * 0.5f);
}
val2 *= num7;
val = ((!isGrounded) ? (val + val2) : (val + val2 * GroundLateralForceMultiplier));
}
vel = val;
didChange = true;
}
}
}
public class Handcopter_pro : HandCopter
{
[Header("=== HANDCOPTER PRO SETTINGS ===")]
[Tooltip("Base movement speed when Power Level = 2 (Normal)")]
public float BaseSpeed = 12f;
[Tooltip("Speed multiplier for Power Level 1 (Low)")]
public float LowPowerMultiplier = 0.6f;
[Tooltip("Speed multiplier for Power Level 3 (High)")]
public float HighPowerMultiplier = 2.2f;
[Header("=== CUSTOM BEHAVIOR ===")]
[Tooltip("When Power = 2 and tilt angle < this value, multiply horizontal speed by LowTiltHorizontalMultiplier")]
public float LowTiltAngleThreshold = 20f;
[Tooltip("When Power = 2 and tilt angle < LowTiltAngleThreshold, multiply horizontal speed by this value")]
public float LowTiltHorizontalMultiplier = 0.05f;
[Tooltip("When on ground, multiply vertical movement by this value (helps with takeoff)")]
public float GroundVerticalBoost = 10f;
private Vector3 lastPlayerPos;
public override void Start()
{
//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)
((HandCopter)this).Start();
lastPlayerPos = ((Component)GM.CurrentPlayerBody).transform.position;
}
public override void FVRFixedUpdate()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00a7: 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_008e: 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_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: 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_00fc: 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_00ff: 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_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
((HandCopter)this).FVRFixedUpdate();
HandleMotorAndAudio();
if (!base.m_isTriggerheld || !(base.motorPower > 0.05f))
{
return;
}
float num = BaseSpeed;
if (base.targetPower == 1)
{
num *= LowPowerMultiplier;
}
else if (base.targetPower == 3)
{
num *= HighPowerMultiplier;
}
Vector3 val = ((Component)this).transform.up;
val = Vector3.ProjectOnPlane(val, Vector3.up);
if (((Vector3)(ref val)).magnitude < 0.1f)
{
val = ((Component)this).transform.forward;
}
((Vector3)(ref val)).Normalize();
Vector3 val2 = val * num * Time.fixedDeltaTime;
if (base.targetPower == 2)
{
float num2 = Vector3.Angle(((Component)this).transform.up, Vector3.up);
if (num2 < LowTiltAngleThreshold)
{
val2 *= LowTiltHorizontalMultiplier;
}
Vector3 position = ((Component)GM.CurrentPlayerBody).transform.position;
Vector3 val3 = position + val2;
val3.y = position.y;
if (Physics.Raycast(position + Vector3.up * 0.1f, Vector3.down, 0.5f))
{
val3.y += GroundVerticalBoost * Time.fixedDeltaTime;
}
GM.CurrentMovementManager.TeleportToPoint(val3, true);
}
else
{
GM.CurrentMovementManager.TeleportToPoint(((Component)GM.CurrentPlayerBody).transform.position + val2, true);
}
lastPlayerPos = ((Component)GM.CurrentPlayerBody).transform.position;
}
private void HandleMotorAndAudio()
{
//IL_0072: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
if (base.m_isTriggerheld)
{
JointMotor motor = base.RotorHinge.motor;
((JointMotor)(ref motor)).targetVelocity = base.MaxSpeed;
((JointMotor)(ref motor)).force = base.MaxForce;
base.RotorHinge.motor = motor;
base.motorPower = Mathf.Clamp(base.RotorHinge.velocity / 1500f, 0f, 1f);
}
else
{
JointMotor motor2 = base.RotorHinge.motor;
((JointMotor)(ref motor2)).targetVelocity = 0f;
((JointMotor)(ref motor2)).force = 0f;
base.RotorHinge.motor = motor2;
base.motorPower = 0f;
}
if (base.motorPower > 0f)
{
if (!base.AudSource_Rotor.isPlaying)
{
base.AudSource_Rotor.Play();
}
float num = 0.8f;
if (base.targetPower == 3)
{
num = 1.1f;
}
else if (base.targetPower == 1)
{
num = 0.6f;
}
base.AudSource_Rotor.pitch = Mathf.Lerp(base.AudSource_Rotor.pitch, num, Time.deltaTime * 6f);
}
else
{
if (base.AudSource_Rotor.isPlaying)
{
base.AudSource_Rotor.Stop();
}
base.AudSource_Rotor.pitch = 0.8f;
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
((HandCopter)this).UpdateInteraction(hand);
}
}
namespace F_Fillet.Handcopter_Custom
{
[BepInPlugin("F_Fillet.Handcopter_Custom", "Handcopter_Custom", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
[BepInDependency("h3vr.cityrobo.prefab_replacer", "1.0.0")]
[BepInDependency("nrgill28.Sodalite", "1.4.1")]
public class Handcopter_CustomPlugin : 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()
{
OtherLoader.RegisterDirectLoad(BasePath, "F_Fillet.Handcopter_Custom", "", "", "handcopter custom", "");
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "pr_handcopter_custom"));
}
}
}