using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using BoneLib.Notifications;
using DynamicFlight;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.XR;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(DynamicFlightMod), "DynamicFlight", "1.0.0", "Astronoz", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("DynamicFlight")]
[assembly: AssemblyDescription("Dynamic flight mod for BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace DynamicFlight
{
public class DynamicFlightMod : MelonMod
{
private const string CategoryName = "DynamicFlight";
private MelonPreferences_Category _prefCat;
private MelonPreferences_Entry<bool> _prefEnabled;
private MelonPreferences_Entry<float> _prefMoveSpeed;
private MelonPreferences_Entry<float> _prefVerticalSpeed;
private MelonPreferences_Entry<float> _prefDamping;
private MelonPreferences_Entry<bool> _prefNoclipEnabled;
private MelonPreferences_Entry<float> _prefSpeedMultiplier;
private MelonPreferences_Entry<float> _prefSonicBoomSpeed;
private MelonPreferences_Entry<bool> _prefSonicBoomEnabled;
private bool _isFlying;
private Vector3 _currentVelocity = Vector3.zero;
private float _lastBPressTime;
private float _doubleTapDelay = 0.35f;
private bool _isSpeedBoosted;
private float _currentSpeedMultiplier = 1f;
private float _speedBuildUp;
private float _speedBuildUpRate = 2f;
private float _lastLeftTriggerPressTime;
private float _lastRightTriggerPressTime;
private bool _leftTriggerPressed;
private bool _rightTriggerPressed;
private bool _isNoclip;
private float _lastThumbstickPressTime;
private List<Collider> _disabledColliders = new List<Collider>();
private float[] _savedDrags;
private bool _physicsModified;
private float _currentSpeed;
private bool _hasTriggeredSonicBoom;
private float _sonicBoomCooldown;
private float _sonicBoomCooldownTime = 10f;
private float _repeatingShockwaveTimer;
private float _repeatingShockwaveInterval = 1f;
private bool _isInSonicBoomMode;
public override void OnInitializeMelon()
{
_prefCat = MelonPreferences.CreateCategory("DynamicFlight");
_prefEnabled = _prefCat.CreateEntry<bool>("Enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_prefMoveSpeed = _prefCat.CreateEntry<float>("MoveSpeed", 15f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_prefVerticalSpeed = _prefCat.CreateEntry<float>("VerticalSpeed", 10f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_prefDamping = _prefCat.CreateEntry<float>("Damping", 3f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_prefNoclipEnabled = _prefCat.CreateEntry<bool>("NoclipEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_prefSpeedMultiplier = _prefCat.CreateEntry<float>("SpeedMultiplier", 2f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_prefSonicBoomSpeed = _prefCat.CreateEntry<float>("SonicBoomSpeed", 100f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
_prefSonicBoomEnabled = _prefCat.CreateEntry<bool>("SonicBoomEnabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
try
{
SetupBoneMenu();
}
catch (Exception value)
{
((MelonBase)this).LoggerInstance.Error($"BoneMenu FAILED: {value}");
}
((MelonBase)this).LoggerInstance.Msg("DynamicFlight initialized! Double-tap B to fly. Double-tap BOTH triggers for speed boost.");
}
private void SetupBoneMenu()
{
//IL_000b: 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_0046: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: 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)
Page val = Menu.CurrentPage.CreatePage("Dynamic Flight", Color.cyan, 0, true);
val.CreateBool("Mod Enabled", Color.green, _prefEnabled.Value, (Action<bool>)delegate(bool flag)
{
_prefEnabled.Value = flag;
_prefCat.SaveToFile(true);
if (!flag && _isFlying)
{
StopFlying();
}
});
val.CreateFloat("Move Speed", Color.white, _prefMoveSpeed.Value, 5f, 5f, 100f, (Action<float>)delegate(float value)
{
_prefMoveSpeed.Value = value;
_prefCat.SaveToFile(true);
});
val.CreateFloat("Vertical Speed", Color.white, _prefVerticalSpeed.Value, 5f, 5f, 100f, (Action<float>)delegate(float value)
{
_prefVerticalSpeed.Value = value;
_prefCat.SaveToFile(true);
});
val.CreateFloat("Damping", Color.white, _prefDamping.Value, 1f, 0f, 30f, (Action<float>)delegate(float value)
{
_prefDamping.Value = value;
_prefCat.SaveToFile(true);
});
val.CreateFloat("Speed Multiplier", Color.magenta, _prefSpeedMultiplier.Value, 1f, 1f, 5f, (Action<float>)delegate(float value)
{
_prefSpeedMultiplier.Value = value;
_prefCat.SaveToFile(true);
});
val.CreateBool("Sonic Boom", Color.cyan, _prefSonicBoomEnabled.Value, (Action<bool>)delegate(bool flag)
{
_prefSonicBoomEnabled.Value = flag;
_prefCat.SaveToFile(true);
if (!flag)
{
_isInSonicBoomMode = false;
_repeatingShockwaveTimer = 0f;
}
});
val.CreateFloat("Sonic Boom Speed", Color.cyan, _prefSonicBoomSpeed.Value, 50f, 50f, 300f, (Action<float>)delegate(float value)
{
_prefSonicBoomSpeed.Value = value;
_prefCat.SaveToFile(true);
});
val.CreateBool("Noclip Enabled", Color.green, _prefNoclipEnabled.Value, (Action<bool>)delegate(bool flag)
{
_prefNoclipEnabled.Value = flag;
_prefCat.SaveToFile(true);
if (!flag && _isNoclip)
{
DisableNoclip();
}
});
((MelonBase)this).LoggerInstance.Msg("BoneMenu created!");
}
public override void OnUpdate()
{
SonicBoomShockwave.Tick();
if (!_prefEnabled.Value || !Player.HandsExist)
{
return;
}
if (Player.RightController.GetBButtonDown())
{
float unscaledTime = Time.unscaledTime;
if (unscaledTime - _lastBPressTime <= _doubleTapDelay)
{
if (_isFlying)
{
StopFlying();
}
else
{
StartFlying();
}
_lastBPressTime = 0f;
}
else
{
_lastBPressTime = unscaledTime;
}
}
if (_isFlying)
{
bool triggerPressed = GetTriggerPressed((XRNode)4);
bool triggerPressed2 = GetTriggerPressed((XRNode)5);
if (triggerPressed && !_leftTriggerPressed)
{
float unscaledTime2 = Time.unscaledTime;
if (unscaledTime2 - _lastLeftTriggerPressTime <= _doubleTapDelay)
{
if (triggerPressed2)
{
ToggleSpeedBoost();
}
_lastLeftTriggerPressTime = 0f;
}
else
{
_lastLeftTriggerPressTime = unscaledTime2;
}
_leftTriggerPressed = true;
}
else if (!triggerPressed)
{
_leftTriggerPressed = false;
}
if (triggerPressed2 && !_rightTriggerPressed)
{
float unscaledTime3 = Time.unscaledTime;
if (unscaledTime3 - _lastRightTriggerPressTime <= _doubleTapDelay)
{
if (triggerPressed)
{
ToggleSpeedBoost();
}
_lastRightTriggerPressTime = 0f;
}
else
{
_lastRightTriggerPressTime = unscaledTime3;
}
_rightTriggerPressed = true;
}
else if (!triggerPressed2)
{
_rightTriggerPressed = false;
}
}
if (!_prefNoclipEnabled.Value || !_isFlying || !Player.RightController.GetThumbStickDown())
{
return;
}
float unscaledTime4 = Time.unscaledTime;
if (unscaledTime4 - _lastThumbstickPressTime <= _doubleTapDelay)
{
if (_isNoclip)
{
DisableNoclip();
}
else
{
EnableNoclip();
}
_lastThumbstickPressTime = 0f;
}
else
{
_lastThumbstickPressTime = unscaledTime4;
}
}
private bool GetTriggerPressed(XRNode node)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
InputDevice deviceAtXRNode = InputDevices.GetDeviceAtXRNode(node);
float num = 0f;
if (((InputDevice)(ref deviceAtXRNode)).isValid && ((InputDevice)(ref deviceAtXRNode)).TryGetFeatureValue(CommonUsages.trigger, ref num))
{
return num > 0.5f;
}
return false;
}
public override void OnFixedUpdate()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_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)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_0099: 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_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_00b1: 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_00b5: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00d0: 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_00de: 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_00ef: 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_0105: 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)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Expected O, but got Unknown
//IL_01c7: 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)
if (!_isFlying)
{
return;
}
PhysicsRig physicsRig = Player.PhysicsRig;
if ((Object)physicsRig == (Object)null)
{
return;
}
Transform head = Player.Head;
Vector3 forward = head.forward;
Vector3 right = head.right;
Vector2 thumbStickAxis = Player.LeftController.GetThumbStickAxis();
Vector2 thumbStickAxis2 = Player.RightController.GetThumbStickAxis();
UpdateSpeedBoost();
float num = _prefMoveSpeed.Value * _currentSpeedMultiplier;
float num2 = _prefVerticalSpeed.Value * _currentSpeedMultiplier;
Vector3 zero = Vector3.zero;
zero += forward * thumbStickAxis.y * num;
zero += right * thumbStickAxis.x * num;
zero += Vector3.up * thumbStickAxis2.y * num2;
float value = _prefDamping.Value;
_currentVelocity = Vector3.Lerp(_currentVelocity, zero, Time.fixedDeltaTime * value * 2f);
_currentSpeed = ((Vector3)(ref _currentVelocity)).magnitude;
if (_prefSonicBoomEnabled.Value)
{
CheckSonicBoom();
if (_isInSonicBoomMode)
{
_repeatingShockwaveTimer += Time.fixedDeltaTime;
if (_repeatingShockwaveTimer >= _repeatingShockwaveInterval)
{
_repeatingShockwaveTimer = 0f;
TriggerRepeatingShockwave();
}
}
}
Rigidbody[] allBodyRigidbodies = GetAllBodyRigidbodies(physicsRig);
Rigidbody[] array = allBodyRigidbodies;
foreach (Rigidbody val in array)
{
if ((Object)val != (Object)null)
{
val.velocity = _currentVelocity;
val.useGravity = false;
val.angularVelocity = Vector3.zero;
}
}
}
private void CheckSonicBoom()
{
if (_sonicBoomCooldown > 0f)
{
_sonicBoomCooldown -= Time.fixedDeltaTime;
}
float value = _prefSonicBoomSpeed.Value;
if (_currentSpeed >= value && _sonicBoomCooldown <= 0f && !_hasTriggeredSonicBoom)
{
_hasTriggeredSonicBoom = true;
_sonicBoomCooldown = _sonicBoomCooldownTime;
_isInSonicBoomMode = true;
_repeatingShockwaveTimer = 0f;
TriggerSonicBoom();
}
else if (_currentSpeed < value && _isInSonicBoomMode)
{
_isInSonicBoomMode = false;
_repeatingShockwaveTimer = 0f;
}
else if (_currentSpeed < value)
{
_hasTriggeredSonicBoom = false;
}
}
private void TriggerSonicBoom()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_001c: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Transform head = Player.Head;
if (!((Object)head == (Object)null))
{
Vector3 position = head.position;
float radius = Mathf.Clamp(_currentSpeed / 10f, 5f, 30f) * 9f;
SonicBoomShockwave.Spawn(position, radius);
ApplyShockwaveForce(position, radius);
}
}
private void TriggerRepeatingShockwave()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_001c: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Transform head = Player.Head;
if (!((Object)head == (Object)null))
{
Vector3 position = head.position;
float radius = Mathf.Clamp(_currentSpeed / 12f, 4f, 25f) * 9f;
SonicBoomShockwave.Spawn(position, radius);
ApplyShockwaveForce(position, radius);
}
}
private void ApplyShockwaveForce(Vector3 position, float radius)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_00a4: 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_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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: 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_00ee: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Clamp(_currentSpeed * 0.5f, 50f, 500f);
Collider[] array = Il2CppArrayBase<Collider>.op_Implicit((Il2CppArrayBase<Collider>)(object)Physics.OverlapSphere(position, radius));
HashSet<int> hashSet = new HashSet<int>();
Collider[] array2 = array;
Collider[] array3 = array2;
foreach (Collider val in array3)
{
if (!((Object)val == (Object)null) && !val.isTrigger)
{
Rigidbody componentInParent = ((Component)val).GetComponentInParent<Rigidbody>();
if ((Object)componentInParent != (Object)null && !componentInParent.isKinematic && hashSet.Add(((Object)componentInParent).GetInstanceID()))
{
float num2 = Vector3.Distance(position, componentInParent.position);
float num3 = 1f - Mathf.Clamp01(num2 / radius);
float num4 = num * num3 * 2f;
Vector3 val2 = componentInParent.position - position;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
componentInParent.AddForce(normalized * num4, (ForceMode)1);
}
}
}
}
private void UpdateSpeedBoost()
{
float num = (_isSpeedBoosted ? _prefSpeedMultiplier.Value : 1f);
if (_isSpeedBoosted)
{
_speedBuildUp += Time.fixedDeltaTime * _speedBuildUpRate;
_speedBuildUp = Mathf.Min(_speedBuildUp, 1f);
_currentSpeedMultiplier = Mathf.Lerp(1f, num, _speedBuildUp);
}
else
{
_speedBuildUp -= Time.fixedDeltaTime * _speedBuildUpRate * 1.5f;
_speedBuildUp = Mathf.Max(_speedBuildUp, 0f);
_currentSpeedMultiplier = Mathf.Lerp(1f, num, _speedBuildUp);
}
_currentSpeedMultiplier = Mathf.Clamp(_currentSpeedMultiplier, 1f, _prefSpeedMultiplier.Value);
}
private void ToggleSpeedBoost()
{
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: 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)
//IL_011a: 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_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
//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_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)
//IL_0088: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
_isSpeedBoosted = !_isSpeedBoosted;
if (_isSpeedBoosted)
{
_speedBuildUp = 0f;
((MelonBase)this).LoggerInstance.Msg($"SPEED BOOST ON - Building up to {_prefSpeedMultiplier.Value}x");
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Speed Boost"),
Message = NotificationText.op_Implicit($"BOOSTING to {_prefSpeedMultiplier.Value}x!"),
ShowTitleOnPopup = true,
PopupLength = 1.5f,
Type = (NotificationType)3
});
}
else
{
((MelonBase)this).LoggerInstance.Msg("SPEED BOOST OFF - Returning to 1x");
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Speed Boost"),
Message = NotificationText.op_Implicit("Returning to normal speed"),
ShowTitleOnPopup = true,
PopupLength = 1.5f,
Type = (NotificationType)2
});
}
}
private Rigidbody[] GetAllBodyRigidbodies(PhysicsRig physRig)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
List<Rigidbody> list = new List<Rigidbody>();
if ((Object)physRig.torso != (Object)null)
{
AddIfNotNull(list, physRig.torso.rbPelvis);
AddIfNotNull(list, physRig.torso.rbSpine);
AddIfNotNull(list, physRig.torso.rbChest);
AddIfNotNull(list, physRig.torso.rbNeck);
AddIfNotNull(list, physRig.torso.rbHead);
}
if ((Object)physRig.softbody != (Object)null)
{
AddIfNotNull(list, physRig.softbody.rbArmUpperLf);
AddIfNotNull(list, physRig.softbody.rbArmUpperRt);
AddIfNotNull(list, physRig.softbody.rbForearmLf);
AddIfNotNull(list, physRig.softbody.rbForearmRt);
AddIfNotNull(list, physRig.softbody.rbSoftHandLf);
AddIfNotNull(list, physRig.softbody.rbSoftHandRt);
}
AddIfNotNull(list, physRig.rbKnee);
AddIfNotNull(list, physRig.rbFeet);
return list.ToArray();
}
private void AddIfNotNull(List<Rigidbody> list, Rigidbody rb)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
if ((Object)rb != (Object)null)
{
list.Add(rb);
}
}
private void StartFlying()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: 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_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_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_0109: 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: Expected O, but got Unknown
PhysicsRig physicsRig = Player.PhysicsRig;
if (!((Object)physicsRig == (Object)null))
{
_isFlying = true;
_currentVelocity = Vector3.zero;
_currentSpeedMultiplier = 1f;
_isSpeedBoosted = false;
_speedBuildUp = 0f;
_hasTriggeredSonicBoom = false;
_sonicBoomCooldown = 0f;
_isInSonicBoomMode = false;
_repeatingShockwaveTimer = 0f;
Rigidbody[] allBodyRigidbodies = GetAllBodyRigidbodies(physicsRig);
_savedDrags = new float[allBodyRigidbodies.Length];
for (int i = 0; i < allBodyRigidbodies.Length; i++)
{
_savedDrags[i] = allBodyRigidbodies[i].drag;
allBodyRigidbodies[i].useGravity = false;
allBodyRigidbodies[i].drag = 0f;
}
_physicsModified = true;
((MelonBase)this).LoggerInstance.Msg("FLY ON");
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Dynamic Flight"),
Message = NotificationText.op_Implicit("Flight ON"),
ShowTitleOnPopup = true,
PopupLength = 1.5f,
Type = (NotificationType)3
});
}
}
private void StopFlying()
{
//IL_0069: 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_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_007e: 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_0089: 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_0095: 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_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
_isFlying = false;
_isSpeedBoosted = false;
_currentSpeedMultiplier = 1f;
_speedBuildUp = 0f;
_hasTriggeredSonicBoom = false;
_isInSonicBoomMode = false;
_repeatingShockwaveTimer = 0f;
if (_isNoclip)
{
DisableNoclip();
}
RestorePhysics();
((MelonBase)this).LoggerInstance.Msg("FLY OFF");
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Dynamic Flight"),
Message = NotificationText.op_Implicit("Flight OFF"),
ShowTitleOnPopup = true,
PopupLength = 1.5f,
Type = (NotificationType)2
});
}
private void RestorePhysics()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
if (!_physicsModified)
{
return;
}
PhysicsRig physicsRig = Player.PhysicsRig;
if (!((Object)physicsRig == (Object)null))
{
Rigidbody[] allBodyRigidbodies = GetAllBodyRigidbodies(physicsRig);
for (int i = 0; i < allBodyRigidbodies.Length && i < _savedDrags.Length; i++)
{
allBodyRigidbodies[i].useGravity = true;
allBodyRigidbodies[i].drag = _savedDrags[i];
}
_physicsModified = false;
}
}
private void EnableNoclip()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: 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_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Expected O, but got Unknown
PhysicsRig physicsRig = Player.PhysicsRig;
if ((Object)physicsRig == (Object)null)
{
return;
}
_disabledColliders.Clear();
Collider[] array = Il2CppArrayBase<Collider>.op_Implicit(((Component)physicsRig).gameObject.GetComponentsInChildren<Collider>(true));
Collider[] array2 = array;
foreach (Collider val in array2)
{
if ((Object)val != (Object)null && val.enabled)
{
val.enabled = false;
_disabledColliders.Add(val);
}
}
_isNoclip = true;
((MelonBase)this).LoggerInstance.Msg($"NOCLIP ON - disabled {_disabledColliders.Count} colliders");
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Dynamic Flight"),
Message = NotificationText.op_Implicit("Noclip ON"),
ShowTitleOnPopup = true,
PopupLength = 1.5f,
Type = (NotificationType)3
});
}
private void DisableNoclip()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//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_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_0087: 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_0097: 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_00a9: 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_00b5: Expected O, but got Unknown
foreach (Collider disabledCollider in _disabledColliders)
{
if ((Object)disabledCollider != (Object)null)
{
disabledCollider.enabled = true;
}
}
_disabledColliders.Clear();
_isNoclip = false;
((MelonBase)this).LoggerInstance.Msg("NOCLIP OFF");
Notifier.Send(new Notification
{
Title = NotificationText.op_Implicit("Dynamic Flight"),
Message = NotificationText.op_Implicit("Noclip OFF"),
ShowTitleOnPopup = true,
PopupLength = 1.5f,
Type = (NotificationType)2
});
}
}
public static class SonicBoomShockwave
{
private static GameObject _obj = null;
private static float _timer = 0f;
private static float _scale = 0f;
private static float _targetRadius = 8f;
public static void Spawn(Vector3 pos, float radius)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//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)
//IL_006d: 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_008f: Expected O, but got Unknown
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Expected O, but got Unknown
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
if ((Object)_obj != (Object)null)
{
Object.Destroy((Object)_obj);
_obj = null;
}
_obj = GameObject.CreatePrimitive((PrimitiveType)0);
((Object)_obj).name = "SonicBoom_Shockwave";
_obj.transform.position = pos;
_obj.transform.localScale = Vector3.one * 0.1f;
Collider component = _obj.GetComponent<Collider>();
if ((Object)component != (Object)null)
{
Object.Destroy((Object)component);
}
MeshRenderer component2 = _obj.GetComponent<MeshRenderer>();
if ((Object)component2 != (Object)null)
{
Material val = new Material(Shader.Find("Sprites/Default"));
val.color = new Color(0.6f, 0.8f, 1f, 0.4f);
val.SetFloat("_Mode", 3f);
val.SetInt("_SrcBlend", 5);
val.SetInt("_DstBlend", 10);
val.SetInt("_ZWrite", 0);
val.EnableKeyword("_ALPHABLEND_ON");
val.renderQueue = 3000;
((Renderer)component2).material = val;
}
_scale = 0.1f;
_timer = 0.3f;
_targetRadius = radius;
}
public static void Tick()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_0065: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Expected O, but got Unknown
//IL_00c5: 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_0107: Expected O, but got Unknown
if (_timer <= 0f)
{
return;
}
_timer -= Time.deltaTime;
_scale += Time.deltaTime * _targetRadius * 3f;
if ((Object)_obj != (Object)null)
{
_obj.transform.localScale = Vector3.one * _scale;
MeshRenderer component = _obj.GetComponent<MeshRenderer>();
if ((Object)component != (Object)null)
{
float num = Mathf.Clamp01(_timer / 0.3f) * 0.4f;
((Renderer)component).material.color = new Color(0.6f, 0.8f, 1f, num);
}
}
if (_timer <= 0f && (Object)_obj != (Object)null)
{
Object.Destroy((Object)_obj);
_obj = null;
}
}
}
}