Decompiled source of AOTPack v1.0.0
AOTPack.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using AOTPack; using BoneLib; using BoneLib.BoneMenu; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSLZ.Data; using Il2CppSLZ.Marrow; using Il2CppSLZ.Marrow.AI; using Il2CppSLZ.Marrow.Combat; using Il2CppSLZ.Marrow.Data; using Il2CppSLZ.Marrow.Interaction; using Il2CppSLZ.Marrow.Pool; using Il2CppSLZ.Marrow.PuppetMasta; using Il2CppSLZ.Marrow.Utilities; using Il2CppSLZ.Marrow.Warehouse; using Il2CppSLZ.VFX; using Il2CppSLZ.VRMK; using LabFusion.Entities; using LabFusion.Network; using LabFusion.Network.Serialization; using LabFusion.Player; using LabFusion.SDK.Modules; using MelonLoader; using MelonLoader.Preferences; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(Main), "AOTPack", "2.5.10", "Coolguy", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: MelonOptionalDependencies(new string[] { "BoneLib", "LabFusion" })] [assembly: AssemblyFileVersion("2.5.10.0")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0")] [assembly: AssemblyVersion("2.5.10.0")] [module: RefSafetyRules(11)] namespace AOTPack; public class Main : MelonMod { private sealed class Bullet { public GameObject Go; public Transform T; public GunState Gun; public Transform IgnoreRoot; public Vector3 Pos; public Transform Trail; public Vector3 Dir; public float DamagePercent; public bool Visual; public float Radius = 0.02f; public float Traveled; public bool First = true; } private struct Push { public float At; public Collider Col; public PuppetMaster Puppet; public Vector3 Point; public Vector3 Dir; public bool Living; } private sealed class RemoteWire { public readonly Wire W = new Wire { Remote = true }; public float LastMessage; public ushort GunEntity; public bool Bound; } private sealed class Thunder { public GameObject Go; public Transform Trail; public Transform Wire; public Transform WireFrom; public Transform IgnoreRoot; public Transform FxFrom; public Vector3 Pos; public Vector3 Dir; public Vector3 HitNormal; public float Traveled; public bool First = true; public bool Stuck; public float FuseAt; } private sealed class Blast { public GameObject Fire; public GameObject Ring; public GameObject Smoke; public Vector3 Pos; public float Start; public float Size; } private const float BulletSpeed = 90f; private const float BulletRange = 60f; private const float PushDelay = 0.1f; private const float SelfHitDistance = 0.4f; private static readonly AttackType HitType = (AttackType)1; private readonly List<Bullet> _bullets = new List<Bullet>(); private readonly List<Push> _pushes = new List<Push>(); private readonly Dictionary<int, GunState> _guns = new Dictionary<int, GunState>(); private readonly List<ReloadZone> _reloadZones = new List<ReloadZone>(); private readonly List<ReloadZone> _s4Zones = new List<ReloadZone>(); private readonly Sfx _shoot = new Sfx("ODM_Shoot", "ODMGear_ShootSfx"); private readonly Sfx _gas = new Sfx("ODM_Gas", "ODMGear_GasSfx"); private AudioMixerGroup _mixerGroup; private float _nextMixerSearch; private float _nextGasErrorLog; private bool _gasActive; private bool _gasBoostHeld; private float _gasVol = 1f; private readonly Sfx _draw = new Sfx("ODM_Draw", "ODMGear_BladeDrawSfx") { GainScale = 0.5f }; private readonly Sfx _apShot = new Sfx("AP_Shot", "ODMGear_APShotSfx"); private readonly Sfx _s4Shot = new Sfx("S4_Shot", "ODMGear_S4ShotSfx") { GainScale = 0.5f }; private readonly Sfx _thunderBlast = new Sfx("Thunder_Blast", "ODMGear_ThunderBlastSfx") { GainScale = 0.5f }; private readonly Sfx _thunderLaunch = new Sfx("Thunder_Launch", "ODMGear_ThunderLaunchSfx") { GainScale = 0.5f }; private readonly Sfx _thunderClick = new Sfx("Thunder_Click", "ODMGear_ThunderClickSfx") { GainScale = 0.4f }; private readonly Sfx _barrelRelease = new Sfx("AP_BarrelRelease", "ODMGear_BarrelReleaseSfx"); private const float BladeBoxSizeMultiplier = 1.5f; private readonly Dictionary<int, SwordState> _swords = new Dictionary<int, SwordState>(); private readonly List<Debris> _debris = new List<Debris>(); private readonly List<Transform> _bladeBoxes = new List<Transform>(); private readonly List<BoxCollider> _bladeBoxColliders = new List<BoxCollider>(); private readonly List<BoxCollider> _resizedBladeBoxes = new List<BoxCollider>(); private readonly List<Vector3> _originalBladeBoxSizes = new List<Vector3>(); private readonly List<int> _deadSwordIds = new List<int>(); private float _nextSwordPrune; private Mesh _crossMesh; private Material _crossMat; private bool _flipActive; private float _flipStick; private float _flipTurn; private float _flipOmega; private float _turnOmega; private float _landedFor; private float _airTime; private Vector3 _flipAxis; private Rigidbody[] _flipBodies = Array.Empty<Rigidbody>(); private Rigidbody[] _flipCore = Array.Empty<Rigidbody>(); private bool _flipBaseShutdown; private const float FlashSeconds = 0.05f; private const float FlashBase = 0.03f; private const float TrailLength = 2.5f; private const float TrailThickness = 0.012f; private Material _fxMat; private readonly List<(GameObject go, float until)> _flashes = new List<(GameObject, float)>(); private Mesh _sphereMesh; private const string OriginL = "ODM_Origin_L"; private const string OriginR = "ODM_Origin_R"; private const string HookL = "ODM_Hook_L"; private const string HookR = "ODM_Hook_R"; private const string RopeL = "ODM_Rope_L"; private const string RopeR = "ODM_Rope_R"; private const float SteerMaxSpeed = 22f; private const float BladeBoxInterval = 1f / 30f; private const float LobbyBladeBoxInterval = 0.05f; private Prefs P; private RigManager _rig; private Rigidbody[] _bodyParts = Array.Empty<Rigidbody>(); private PropertyInfo _fusionLoggedInProperty; private bool _fusionNetworked; private bool _fusionPresent; private float _nextRigSearch; private float _nextPartSearch; private float _nextFusionCheck; private int _avatarKey; private float _nextPhysicsErrorLog; private readonly Wire _left = new Wire { IsLeft = true }; private readonly Wire _right = new Wire { IsLeft = false }; public static Main Instance; private bool _netReady; private float _nextNetRegister; private float _nextNetSync; private float _nextNetWarn; private readonly Dictionary<int, RemoteWire> _remoteWires = new Dictionary<int, RemoteWire>(); private PlayerDamageReceiver _localReceiver; private const float RopeStiffness = 12f; private const float RopeMaxCorrection = 15f; private const float RopeMaxStep = 30f; private const float PullDeadSpeed = 0.25f; private float _playerMass = 70f; private OpenControllerRig _openRig; private const float ThunderRange = 120f; private const float ThunderRadiusOfSpear = 0.08f; private const int BlastBufferSize = 96; private const float BlastKillDamage = 1000f; private const float SpearTrailLength = 3f; private const float WireThickness = 0.006f; private const float WireMaxLength = 80f; private readonly List<Thunder> _thunders = new List<Thunder>(); private readonly List<Blast> _blasts = new List<Blast>(); private readonly HashSet<int> _blastSeen = new HashSet<int>(); private readonly AudioSource[] _blastSources = (AudioSource[])(object)new AudioSource[3]; private int _blastSourceIndex; private Material _smokeMat; private Vector3 _lastBlastPos; private float _lastBlastTime = -10f; private const int MaxSegments = 16; private const int LobbyMaxSegments = 8; private const float MinSegmentLength = 2f; private const float LobbyMinSegmentLength = 4f; private readonly List<Vector3> _pts = new List<Vector3>(17); private bool HoldingGear { get { if (!_left.Holding) { return _right.Holding; } return true; } } private bool GearInUse { get { if (!_left.Holding && !_right.Holding && !_left.Active) { return _right.Active; } return true; } } private bool NetActive { get { if (_netReady && _fusionNetworked) { return P.NetSync.Value; } return false; } } private void FireBullet(Wire w, BaseController ctrl) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_00c5: 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_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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) GunState gun = w.Gun; if (gun == null || !gun.Ready) { Dbg((gun != null && gun.IsS4) ? "AP S4 shot ignored: out of rounds, reload at the leg zone" : $"AP shot ignored: barrel mounted={gun?.HasBarrel ?? false}, already fired={gun?.Fired ?? false}"); return; } if (gun.IsS4) { gun.Ammo--; PlayOneShotSfx(_s4Shot); } else { gun.Fired = true; PlayOneShotSfx(_apShot); } Vector3 position; Quaternion val; if ((Object)(object)gun.FireZone != (Object)null) { position = gun.FireZone.position; val = gun.FireZone.rotation; } else { position = ((Component)ctrl).transform.position; val = Quaternion.LookRotation(AimDirection(ctrl)); } FlashMuzzle(gun); Dbg("AP shot: firing from " + (((Object)(object)gun.FireZone != (Object)null) ? ((Object)gun.FireZone).name : "controller") + (gun.IsS4 ? $", {gun.Ammo} rounds left" : "")); NetSendShot(gun, position, val * Vector3.forward); ApplyRecoil(w, ctrl, val * Vector3.forward, gun.IsS4 ? P.S4Recoil.Value : 1f); LaunchBullet(gun, position, val, ((Object)(object)w.HeldGO != (Object)null) ? w.HeldGO.transform.root : null, gun.IsS4 ? P.S4Damage.Value : P.ApPelletDamage.Value); } private void ApplyRecoil(Wire w, BaseController ctrl, Vector3 forward, float scale) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00d4: Unknown result type (might be due to invalid IL or missing references) float num = P.ApRecoilTwist.Value * scale; if (num > 0f) { Vector3 val = -((Component)ctrl).transform.right * num; if ((Object)(object)w.Hand != (Object)null && (Object)(object)w.Hand.rb != (Object)null) { w.Hand.rb.AddTorque(val, (ForceMode)2); } if (w.Gun != null && (Object)(object)w.Gun.Rb != (Object)null) { w.Gun.Rb.AddTorque(val, (ForceMode)2); } } float num2 = P.ApRecoil.Value * scale; if (!(num2 > 0f)) { return; } Rigidbody[] bodyParts = _bodyParts; foreach (Rigidbody val2 in bodyParts) { if ((Object)(object)val2 != (Object)null) { val2.AddForce(-forward * num2, (ForceMode)2); } } } private void LaunchBullet(GunState gun, Vector3 origin, Quaternion rotation, Transform ignoreRoot, float damagePercent, bool visual = false) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0062: 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_009d: 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_00a4: 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_00b2: Unknown result type (might be due to invalid IL or missing references) Bullet obj = new Bullet { Gun = gun, IgnoreRoot = ignoreRoot, DamagePercent = damagePercent, Visual = visual, Pos = origin }; Vector3 val = rotation * Vector3.forward; obj.Dir = ((Vector3)(ref val)).normalized; Bullet bullet = obj; if ((Object)(object)gun.BulletRoot != (Object)null) { GameObject val2 = Object.Instantiate<GameObject>(((Component)gun.BulletRoot).gameObject, origin, rotation); val2.transform.localScale = gun.BulletRoot.lossyScale; val2.SetActive(true); SphereCollider componentInChildren = val2.GetComponentInChildren<SphereCollider>(true); CapsuleCollider componentInChildren2 = val2.GetComponentInChildren<CapsuleCollider>(true); Vector3 lossyScale = val2.transform.lossyScale; float num = Mathf.Max(lossyScale.x, Mathf.Max(lossyScale.y, lossyScale.z)); float num2 = (((Object)(object)componentInChildren != (Object)null) ? (componentInChildren.radius * num) : (((Object)(object)componentInChildren2 != (Object)null) ? (componentInChildren2.radius * num) : 0.02f)); bullet.Radius = Mathf.Clamp(num2, 0.005f, 0.1f); foreach (Collider componentsInChild in val2.GetComponentsInChildren<Collider>(true)) { if ((Object)(object)componentsInChild != (Object)null) { componentsInChild.enabled = false; } } bullet.Go = val2; bullet.T = val2.transform; } bullet.Trail = MakeTrail(gun); if ((Object)(object)bullet.Trail != (Object)null) { UpdateTrail(bullet); } _bullets.Add(bullet); } private void UpdateBullets() { float deltaTime = Time.deltaTime; for (int num = _bullets.Count - 1; num >= 0; num--) { Bullet bullet = _bullets[num]; if (!StepBullet(bullet, deltaTime)) { if ((Object)(object)bullet.Go != (Object)null) { Object.Destroy((Object)(object)bullet.Go); } if ((Object)(object)bullet.Trail != (Object)null) { Object.Destroy((Object)(object)((Component)bullet.Trail).gameObject); } _bullets.RemoveAt(num); } } } private bool StepBullet(Bullet b, float dt) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0090: 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_009c: 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_00a6: 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_00ce: Unknown result type (might be due to invalid IL or missing references) float num = 90f * dt; float num2 = (b.First ? 0.1f : 0f); b.First = false; bool flag = P.ApHurtsPlayer.Value && b.Traveled >= 0.4f; if (RaycastIgnoring(b.Pos - b.Dir * num2, b.Dir, num + num2, b.IgnoreRoot, out var result, b.Radius, !flag)) { OnBulletHit(b, result); return false; } b.Pos += b.Dir * num; b.Traveled += num; if ((Object)(object)b.T != (Object)null) { b.T.position = b.Pos; } UpdateTrail(b); return b.Traveled < 60f; } private void OnBulletHit(Bullet b, RaycastHit hit) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_00a1: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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) if (b.Visual) { return; } Vector3 dir = b.Dir; Collider collider = ((RaycastHit)(ref hit)).collider; if (!((Object)(object)collider == (Object)null)) { PuppetMaster puppet; bool flag = DealDamage(collider, ((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, dir, b.DamagePercent, P.ApHurtsPlayer.Value, out puppet); if (P.ApKnockback.Value > 0f) { _pushes.Add(new Push { At = Time.time + 0.1f, Col = collider, Puppet = puppet, Point = ((RaycastHit)(ref hit)).point, Dir = dir, Living = flag }); } if (flag) { SpawnBlood(collider, hit, dir); } } } private bool DealDamage(Collider col, Vector3 point, Vector3 normal, Vector3 dir, float damagePercent, bool hurtPlayer, out PuppetMaster puppet) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) puppet = null; try { float num = damagePercent / 100f; PlayerDamageReceiver componentInParent = ((Component)col).GetComponentInParent<PlayerDamageReceiver>(); if ((Object)(object)componentInParent != (Object)null) { RigManager componentInParent2 = ((Component)componentInParent).GetComponentInParent<RigManager>(); if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)componentInParent2 != (Object)(object)_rig) { if (P.NetDamage.Value) { NetSendDamage(componentInParent2, point, normal, dir, num); } return true; } if (!hurtPlayer) { return false; } float num2 = (((Object)(object)componentInParent.health != (Object)null && componentInParent.health.max_Health > 0f) ? componentInParent.health.max_Health : 100f); componentInParent.ReceiveAttack(MakeAttack(col, point, normal, dir, num * num2, HitType)); return true; } MuscleCollisionBroadcaster componentInParent3 = ((Component)col).GetComponentInParent<MuscleCollisionBroadcaster>(); puppet = (((Object)(object)componentInParent3 != (Object)null) ? componentInParent3.puppetMaster : ((Component)col).GetComponentInParent<PuppetMaster>()); AIBrain componentInParent4 = ((Component)col).GetComponentInParent<AIBrain>(); if ((Object)(object)componentInParent4 == (Object)null && (Object)(object)puppet != (Object)null) { componentInParent4 = ((Component)puppet).GetComponentInParent<AIBrain>(); } if ((Object)(object)componentInParent3 == (Object)null && (Object)(object)puppet == (Object)null && (Object)(object)componentInParent4 == (Object)null) { ObjectDestructible componentInParent5 = ((Component)col).GetComponentInParent<ObjectDestructible>(); if ((Object)(object)componentInParent5 != (Object)null) { componentInParent5.ReceiveAttack(MakeAttack(col, point, normal, dir, num * componentInParent5.maxHealth, HitType)); } return false; } SubBehaviourHealth val = (((Object)(object)componentInParent4 != (Object)null && (Object)(object)componentInParent4.behaviour != (Object)null) ? componentInParent4.behaviour.health : null); if ((Object)(object)componentInParent4 != (Object)null && componentInParent4.isDead) { return true; } float num3 = ((val != null && val.maxHitPoints > 0f) ? val.maxHitPoints : 1f); float num4 = num * num3; float num5 = ((val != null) ? val.cur_hp : 0f); bool flag = false; if ((Object)(object)componentInParent3 != (Object)null) { try { componentInParent3.ReceiveAttack(MakeAttack(col, point, normal, dir, num4, HitType)); flag = true; } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("In-game attack failed, applying damage directly: " + ex.Message); } } if (val != null && (!flag || val.cur_hp >= num5 - 0.0001f) && num4 > 0f) { val.cur_hp = num5 - num4; if (val.cur_hp <= 0f) { val.Kill(); } } else if (val == null && (Object)(object)puppet != (Object)null && num >= 1f) { puppet.Kill(); } return true; } catch (Exception ex2) { ((MelonBase)this).LoggerInstance.Warning("Couldn't damage the target: " + ex2.Message); } return (Object)(object)puppet != (Object)null; } private static Attack MakeAttack(Collider col, Vector3 point, Vector3 normal, Vector3 dir, float damage, AttackType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown return new Attack { damage = damage, normal = normal, origin = point, direction = dir, collider = col, attackType = type }; } private void ProcessPushes() { for (int num = _pushes.Count - 1; num >= 0; num--) { Push push = _pushes[num]; if (!(Time.time < push.At)) { _pushes.RemoveAt(num); try { ApplyPush(push); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Knockback failed: " + ex.Message); } } } } private void ApplyPush(Push push) { //IL_00cf: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) float value = P.ApKnockback.Value; if (value <= 0f) { return; } Rigidbody val = (((Object)(object)push.Col != (Object)null) ? push.Col.attachedRigidbody : null); if (push.Living) { if ((Object)(object)push.Puppet != (Object)null) { foreach (Rigidbody componentsInChild in ((Component)push.Puppet).GetComponentsInChildren<Rigidbody>(true)) { if ((Object)(object)componentsInChild != (Object)null) { componentsInChild.AddForce(push.Dir * value, (ForceMode)2); } } } if ((Object)(object)val != (Object)null) { val.AddForceAtPosition(push.Dir * (value * 0.5f), push.Point, (ForceMode)2); } } else if ((Object)(object)val != (Object)null) { val.AddForceAtPosition(push.Dir * (value * Mathf.Min(val.mass, 5f)), push.Point, (ForceMode)1); } } private void SpawnBlood(Collider col, RaycastHit hit, Vector3 dir) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) float value = P.ApBlood.Value; if (value <= 0.01f) { return; } int num = Mathf.FloorToInt(value); if (Random.value < value - (float)num) { num++; } if (num <= 0) { return; } try { ImpactProperties componentInParent = ((Component)col).GetComponentInParent<ImpactProperties>(); if (!((Object)(object)componentInParent == (Object)null)) { for (int i = 0; i < num; i++) { componentInParent.ReceiveAttack(MakeAttack(col, ((RaycastHit)(ref hit)).point, ((RaycastHit)(ref hit)).normal, dir, 1f, HitType)); } StainTarget(componentInParent, col, hit); } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Couldn't play the blood effect: " + ex.Message); } } private void StainTarget(ImpactProperties impact, Collider col, RaycastHit hit) { //IL_0037: 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_004d: 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_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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) SurfaceData surfaceData = impact.surfaceData; if ((Object)(object)surfaceData == (Object)null) { return; } SpawnableCrateReference crateRef = surfaceData.bulletDecalSpawnable.crateRef; if (crateRef == null) { return; } MaterialLevel level = impact.GetMaterialFromAttack(HitType); Color tint = surfaceData.ParicleColorTint; Vector3 normal = ((RaycastHit)(ref hit)).normal; Vector3 val; if (!(((Vector3)(ref normal)).sqrMagnitude > 0.0001f)) { val = Vector3.up; } else { normal = ((RaycastHit)(ref hit)).normal; val = ((Vector3)(ref normal)).normalized; } Vector3 val2 = val; BoneLibSpawn.Spawn(crateRef, ((RaycastHit)(ref hit)).point + val2 * 0.05f, Quaternion.LookRotation(-val2), delegate(GameObject go) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)go == (Object)null) && !((Object)(object)col == (Object)null)) { DecalProjector componentInChildren = go.GetComponentInChildren<DecalProjector>(); if (!((Object)(object)componentInChildren == (Object)null)) { componentInChildren.SetVariablesAndCreate(level, col, tint); go.transform.SetParent(((Component)col).transform, true); } } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Couldn't place the blood stain: " + ex.Message); } }); } private static bool IsApGun(GameObject held) { if ((Object)(object)held == (Object)null) { return false; } string text = ""; Poolee componentInParent = held.GetComponentInParent<Poolee>(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.SpawnableCrate != (Object)null && ((Scannable)componentInParent.SpawnableCrate).Barcode != (Barcode)null) { text = ((Scannable)componentInParent.SpawnableCrate).Barcode.ID ?? ""; } if (text.IndexOf("APGun", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } return Norm(((Object)held.transform.root).name + ((Object)held).name).Contains("apgun"); } private GunState GetGun(GameObject held) { Poolee componentInParent = held.GetComponentInParent<Poolee>(); return GetGunForRoot(((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).transform : held.transform.root); } private GunState GetGunForRoot(Transform root) { int instanceID = ((Object)root).GetInstanceID(); if (_guns.TryGetValue(instanceID, out var value) && (Object)(object)value.Root != (Object)null) { return value; } Poolee componentInParent = ((Component)root).GetComponentInParent<Poolee>(); bool s = (((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.SpawnableCrate != (Object)null && ((Scannable)componentInParent.SpawnableCrate).Barcode != (Barcode)null) ? (((Scannable)componentInParent.SpawnableCrate).Barcode.ID ?? "") : "").IndexOf("S4", StringComparison.OrdinalIgnoreCase) >= 0 || Norm(((Object)root).name).Contains("s4"); GunState gunState = CreateGun(root, s); _guns[instanceID] = gunState; return gunState; } private static Transform FindNorm(Transform parent, Func<string, bool> match) { if ((Object)(object)parent == (Object)null) { return null; } for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); if (match(Norm(((Object)child).name))) { return child; } Transform val = FindNorm(child, match); if ((Object)(object)val != (Object)null) { return val; } } return null; } private GunState CreateGun(Transform root, bool s4) { GunState gunState = new GunState { Root = root, IsS4 = s4 }; Transform parent = FindNorm(root, (string n) => n.StartsWith("odm", StringComparison.Ordinal) && n.EndsWith("function", StringComparison.Ordinal)) ?? root; gunState.Origin = FindNorm(parent, (string n) => n.Contains("origin") && !n.Contains("line") && !n.Contains("rope")); gunState.Hook = FindNorm(parent, (string n) => n.Contains("hook") && !n.Contains("line") && !n.Contains("rope")); gunState.Rope = FindNorm(parent, (string n) => n.Contains("line") || n.Contains("rope")) ?? FindNorm(parent, (string n) => n.Contains("cylinder")); gunState.Rb = ((Component)root).GetComponentInChildren<Rigidbody>(true); gunState.Barrel = FindNorm(root, (string n) => n == "apgunbarrel") ?? FindNorm(root, (string n) => n.Contains("barrel") && !n.Contains("zone") && !n.Contains("reload") && !n.Contains("muzzle")); gunState.BulletRoot = FindNorm(root, (string n) => n == "bullet"); gunState.BarrelZone = FindNorm(root, (string n) => n.Contains("barrelzone")) ?? FindNorm(root, (string n) => n.Contains("reloadingzone") || n.Contains("reloadzone")); if ((Object)(object)gunState.BarrelZone != (Object)null) { string text = Norm(((Object)gunState.BarrelZone).name); char c = ((text.Length > 0) ? text[text.Length - 1] : '\0'); if (c == 'l' || c == 'r') { gunState.Side = c; } } gunState.FireZone = FindNorm(root, (string n) => n == "barrelmuzzle" || n == "muzzle") ?? FindNorm(root, (string n) => n.Contains("bulletfire") || n.Contains("firezone")) ?? FindNorm(root, (string n) => n.Contains("bulletshoot") || n.Contains("shootzone") || n.Contains("bulletzone")); NoCollision(gunState.Hook); NoCollision(gunState.Rope); if ((Object)(object)gunState.Hook != (Object)null) { ((Component)gunState.Hook).gameObject.SetActive(false); } if ((Object)(object)gunState.Rope != (Object)null) { ((Component)gunState.Rope).gameObject.SetActive(false); } if (s4) { gunState.Ammo = Mathf.Max(0, Mathf.RoundToInt(P.S4MagSize.Value)); } else { SetBarrel(gunState, mounted: false); } ((MelonBase)this).LoggerInstance.Msg($"AP gun \"{((Object)root).name}\": origin={N(gunState.Origin)}, hook={N(gunState.Hook)}, rope={N(gunState.Rope)}, barrel={N(gunState.Barrel)}, barrelZone={N(gunState.BarrelZone)}, fireZone={N(gunState.FireZone)}, bullet={N(gunState.BulletRoot)}, S4={s4}, side={((gunState.Side == '\0') ? "any" : gunState.Side.ToString())}"); return gunState; static string N(Transform t) { if (!((Object)(object)t != (Object)null)) { return "MISSING"; } return ((Object)t).name; } } private static void SetBarrel(GunState gun, bool mounted) { gun.HasBarrel = mounted; gun.Fired = false; if ((Object)(object)gun.Barrel != (Object)null) { ((Component)gun.Barrel).gameObject.SetActive(mounted); } if ((Object)(object)gun.FireZone != (Object)null) { ((Component)gun.FireZone).gameObject.SetActive(mounted); } } private void HandleGunTrigger(Wire w, BaseController ctrl) { if (ctrl.GetBButtonDown()) { EjectBarrel(w); } bool primaryInteractionButton = ctrl.GetPrimaryInteractionButton(); if (ctrl.GetPrimaryInteractionButtonDown()) { w.TriggerStart = Time.time; w.TriggerArmed = true; Dbg(w.Gun.IsS4 ? $"AP S4 trigger pressed: {w.Gun.Ammo} rounds left" : $"AP trigger pressed: barrel mounted={w.Gun.HasBarrel}, already fired={w.Gun.Fired}"); } float value = P.ApTapSeconds.Value; if (primaryInteractionButton) { if (w.TriggerArmed && !w.Active && Time.time - w.TriggerStart >= value) { w.TriggerArmed = false; if (Fire(w, ctrl)) { PlayShoot(); } } } else { if (w.Active) { Release(w); } else if (w.TriggerArmed && Time.time - w.TriggerStart < value) { FireBullet(w, ctrl); } w.TriggerArmed = false; } } private void EjectBarrel(Wire w) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_005b: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) GunState gun = w.Gun; if (gun == null || !gun.HasBarrel || (Object)(object)gun.Barrel == (Object)null) { return; } bool fired = gun.Fired; if ((Object)(object)gun.Flash != (Object)null) { gun.Flash.SetActive(false); } Transform barrel = gun.Barrel; GameObject val = new GameObject("ODMGear_APBarrel"); val.transform.SetPositionAndRotation(barrel.position, barrel.rotation); val.transform.localScale = Vector3.one; Debris debris = new Debris { Go = val }; GameObject val2 = Object.Instantiate<GameObject>(((Component)barrel).gameObject, barrel.position, barrel.rotation); val2.transform.SetParent(val.transform, true); val2.transform.localScale = barrel.lossyScale; val2.SetActive(true); foreach (Rigidbody componentsInChild in val2.GetComponentsInChildren<Rigidbody>(true)) { if ((Object)(object)componentsInChild != (Object)null) { Object.Destroy((Object)(object)componentsInChild); } } AddDebrisColliders(val2.transform, debris); FinishDebris(gun.Root, gun.Rb, debris, barrel.position, 0.2f); SetBarrel(gun, mounted: false); if (fired) { PlayOneShotSfx(_barrelRelease); } } private void CollectReloadZones(Transform parent) { for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); string text = Norm(((Object)child).name); if (text.Contains("barrelreloadzone")) { AddReloadZone(_reloadZones, child, text); } else if (text.Contains("reload") && text.Contains("zone") && text.Contains("s4")) { AddReloadZone(_s4Zones, child, text); } CollectReloadZones(child); } } private static void AddReloadZone(List<ReloadZone> list, Transform t, string normName) { foreach (ReloadZone item in list) { if ((Object)(object)item.T == (Object)(object)t) { return; } } char c = normName[normName.Length - 1]; list.Add(new ReloadZone { T = t, Box = ((Component)t).GetComponentInChildren<BoxCollider>(true), Side = ((c == 'l' || c == 'r') ? c : '\0') }); } private void TryReload(Wire w) { //IL_0075: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) GunState gun = w.Gun; if (gun != null && gun.IsS4) { TryReloadS4(w, gun); } else { if (gun == null || gun.HasBarrel || (Object)(object)gun.Root == (Object)null || (Object)(object)gun.BarrelZone == (Object)null || _reloadZones.Count == 0 || Time.unscaledTime < w.ReloadNextCheck) { return; } w.ReloadNextCheck = Time.unscaledTime + 0.05f; Vector3 position = gun.BarrelZone.position; foreach (ReloadZone reloadZone in _reloadZones) { if (!((Object)(object)reloadZone.T == (Object)null)) { bool num; if (!((Object)(object)reloadZone.Box != (Object)null)) { Vector3 val = reloadZone.T.position - position; num = ((Vector3)(ref val)).sqrMagnitude < 0.04f; } else { num = PointInBox(reloadZone.Box, position); } if (num) { SetBarrel(gun, mounted: true); break; } } } } } private void TryReloadS4(Wire w, GunState gun) { //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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Max(0, Mathf.RoundToInt(P.S4MagSize.Value)); if (gun.Ammo >= num || (Object)(object)gun.Root == (Object)null || (Object)(object)gun.BarrelZone == (Object)null || _s4Zones.Count == 0 || Time.unscaledTime < w.ReloadNextCheck) { return; } w.ReloadNextCheck = Time.unscaledTime + 0.05f; Vector3 position = gun.BarrelZone.position; foreach (ReloadZone s4Zone in _s4Zones) { if (!((Object)(object)s4Zone.T == (Object)null) && (gun.Side == '\0' || s4Zone.Side == '\0' || s4Zone.Side == gun.Side)) { bool num2; if (!((Object)(object)s4Zone.Box != (Object)null)) { Vector3 val = s4Zone.T.position - position; num2 = ((Vector3)(ref val)).sqrMagnitude < 0.04f; } else { num2 = PointInBox(s4Zone.Box, position); } if (num2) { gun.Ammo = num; Dbg($"AP S4 reloaded: {gun.Ammo} rounds"); break; } } } } private static byte[] ReadResource(string name) { using Stream stream = typeof(Main).Assembly.GetManifestResourceStream(name); if (stream == null) { return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return memoryStream.ToArray(); } private void LoadWav(Sfx sfx, string resource) { try { byte[] array = ReadResource(resource); if (array == null) { ((MelonBase)this).LoggerInstance.Error("Missing embedded sound " + resource); } else { sfx.Raw = DecodeWav(array, out sfx.Channels, out sfx.Rate); } } catch (Exception ex) { sfx.Raw = null; ((MelonBase)this).LoggerInstance.Error("Failed to load sound " + resource + ": " + ex.Message); } } private static float[] DecodeWav(byte[] b, out int channels, out int rate) { channels = 0; rate = 0; if (b.Length < 12 || Encoding.ASCII.GetString(b, 0, 4) != "RIFF" || Encoding.ASCII.GetString(b, 8, 4) != "WAVE") { throw new InvalidDataException("Not a RIFF/WAVE file"); } int num = 0; int num2 = 0; int num3 = -1; uint num4 = 0u; int num5 = 12; while ((long)num5 + 8L <= b.Length) { string text = Encoding.ASCII.GetString(b, num5, 4); uint num6 = BitConverter.ToUInt32(b, num5 + 4); long num7 = (long)num5 + 8L; long num8 = num7 + num6; if (num8 > b.Length) { throw new InvalidDataException("A WAV chunk extends past the end of the file"); } if (text == "fmt ") { if (num6 < 16) { throw new InvalidDataException("The WAV format chunk is too short"); } num = BitConverter.ToUInt16(b, (int)num7); channels = BitConverter.ToUInt16(b, (int)num7 + 2); uint num9 = BitConverter.ToUInt32(b, (int)num7 + 4); rate = (int)((num9 <= int.MaxValue) ? num9 : 0); num2 = BitConverter.ToUInt16(b, (int)num7 + 14); } else if (text == "data" && num3 < 0) { num3 = (int)num7; num4 = num6; } long num10 = num8 + (num6 & 1); if (num10 > b.Length) { break; } num5 = (int)num10; } if (num != 1 || (channels != 1 && channels != 2) || rate < 8000 || rate > 192000 || num2 != 16 || num3 < 0 || num4 < 2 || num4 / 2 % channels != 0) { throw new InvalidDataException("Expected mono or stereo 16-bit PCM WAV data"); } int num11 = (int)(num4 / 2); float[] array = new float[num11]; for (int i = 0; i < num11; i++) { array[i] = (float)BitConverter.ToInt16(b, num3 + i * 2) / 32768f; } return array; } private static float SoftLimit(float x) { float num = Mathf.Abs(x); if (num <= 0.8f) { return x; } float num2 = 0.8f + 0.2f * (float)Math.Tanh((num - 0.8f) / 0.2f); if (!(x < 0f)) { return num2; } return 0f - num2; } private static AudioClip BuildClip(float[] raw, int channels, int rate, float gain, string name) { if (raw == null || channels < 1 || raw.Length % channels != 0 || rate < 8000) { return null; } float[] array = new float[raw.Length]; for (int i = 0; i < raw.Length; i++) { array[i] = SoftLimit(raw[i] * gain); } AudioClip val = AudioClip.Create(name, array.Length / channels, channels, rate, false); if ((Object)(object)val == (Object)null) { return null; } val.SetData(new Il2CppStructArray<float>(array), 0); return val; } private static AudioSource MakeSource(string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)val); AudioSource obj = val.AddComponent<AudioSource>(); obj.playOnAwake = false; obj.loop = false; obj.spatialBlend = 0f; obj.priority = 128; obj.dopplerLevel = 0f; obj.bypassReverbZones = true; obj.ignoreListenerPause = true; return obj; } private void FindMixerGroup() { if (!P.UseGameMixer.Value || (Object)(object)_mixerGroup != (Object)null || Time.time < _nextMixerSearch) { return; } _nextMixerSearch = Time.time + 10f; AudioMixerGroup mixerGroup = null; int num = 0; foreach (AudioSource item in Object.FindObjectsOfType<AudioSource>()) { if ((Object)(object)item == (Object)null) { continue; } AudioMixerGroup outputAudioMixerGroup = item.outputAudioMixerGroup; if (!((Object)(object)outputAudioMixerGroup == (Object)null)) { string text = ((Object)outputAudioMixerGroup).name.ToLowerInvariant(); int num2 = ((text.Contains("sfx") && text.Contains("2d")) ? 3 : (text.Contains("sfx") ? 2 : (text.Contains("effect") ? 1 : 0))); if (num2 > num) { num = num2; mixerGroup = outputAudioMixerGroup; } } } _mixerGroup = mixerGroup; } private void RouteToMixer(AudioSource src) { FindMixerGroup(); src.outputAudioMixerGroup = (P.UseGameMixer.Value ? _mixerGroup : null); } private AudioClip GetClip(Sfx sfx) { if (sfx.Raw == null) { return null; } float num = P.SfxLoudness.Value * sfx.GainScale; if ((Object)(object)sfx.Clip == (Object)null || Mathf.Abs(sfx.BuiltGain - num) > 0.001f) { if ((Object)(object)sfx.Clip != (Object)null) { Object.Destroy((Object)(object)sfx.Clip); } sfx.Clip = BuildClip(sfx.Raw, sfx.Channels, sfx.Rate, num, sfx.ClipName); sfx.BuiltGain = num; } return sfx.Clip; } private static void SetSynth(Sfx sfx, float[] data) { sfx.Raw = data; sfx.Channels = 1; sfx.Rate = 22050; } private AudioSource PrepareSource(Sfx sfx) { if ((Object)(object)GetClip(sfx) == (Object)null) { return null; } if ((Object)(object)sfx.Source == (Object)null) { sfx.Source = MakeSource(sfx.SourceName); } RouteToMixer(sfx.Source); if ((Object)(object)sfx.Clip == (Object)null) { return null; } sfx.Source.clip = sfx.Clip; return sfx.Source; } private void PlayShoot() { try { AudioSource val = PrepareSource(_shoot); if (!((Object)(object)val == (Object)null)) { val.loop = false; val.volume = 1f; val.Stop(); val.Play(); } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Sound error: " + ex); } } private void UpdateGasSound(bool held) { try { if (held) { if (_gasActive && ((Object)(object)_gas.Source == (Object)null || !_gas.Source.isPlaying)) { _gasActive = false; } if (!_gasActive) { AudioSource val = PrepareSource(_gas); if (!((Object)(object)val == (Object)null)) { val.loop = true; _gasVol = 1f; val.volume = 1f; val.Stop(); val.Play(); _gasActive = true; } } else { _gasVol = Mathf.Min(1f, _gasVol + Time.deltaTime / 0.05f); _gas.Source.volume = _gasVol; } } else { if (!_gasActive) { return; } if ((Object)(object)_gas.Source == (Object)null) { _gasActive = false; return; } _gasVol -= Time.deltaTime / 0.12f; if (_gasVol > 0f) { _gas.Source.volume = _gasVol; return; } _gas.Source.Stop(); _gasActive = false; } } catch (Exception e) { _gasActive = false; LogThrottled(ref _nextGasErrorLog, "Gas sound error: ", e); } } private void PlayOneShotSfx(Sfx sfx) { try { AudioSource val = PrepareSource(sfx); if (!((Object)(object)val == (Object)null)) { val.loop = false; val.volume = 1f; val.PlayOneShot(sfx.Clip, 1f); } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Sound error (" + sfx.ClipName + "): " + ex); } } private void EnlargeBladeBox(BoxCollider box) { //IL_004c: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)box == (Object)null)) { int num = _resizedBladeBoxes.IndexOf(box); if (num < 0) { num = _resizedBladeBoxes.Count; _resizedBladeBoxes.Add(box); _originalBladeBoxSizes.Add(box.size); } box.size = _originalBladeBoxSizes[num] * 1.5f; } } private void RestoreBladeBoxSizes() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _resizedBladeBoxes.Count; i++) { if ((Object)(object)_resizedBladeBoxes[i] != (Object)null) { _resizedBladeBoxes[i].size = _originalBladeBoxSizes[i]; } } _resizedBladeBoxes.Clear(); _originalBladeBoxSizes.Clear(); } private static bool PointInBox(BoxCollider box, Vector3 world) { //IL_0006: 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) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)box).transform.InverseTransformPoint(world) - box.center; Vector3 val2 = box.size * 0.5f; if (Mathf.Abs(val.x) <= val2.x && Mathf.Abs(val.y) <= val2.y) { return Mathf.Abs(val.z) <= val2.z; } return false; } private bool InAnyBladeBox(Vector3 p) { //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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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) for (int i = 0; i < _bladeBoxes.Count; i++) { Transform val = _bladeBoxes[i]; if ((Object)(object)val == (Object)null) { continue; } BoxCollider val2 = ((i < _bladeBoxColliders.Count) ? _bladeBoxColliders[i] : null); if ((Object)(object)val2 != (Object)null) { if (PointInBox(val2, p)) { return true; } continue; } Vector3 val3 = val.position - p; if (((Vector3)(ref val3)).sqrMagnitude < 0.04f) { return true; } } return false; } private void UpdateBladeBoxes() { if (_bladeBoxes.Count != 0) { UpdateBladeBoxForHand(_left); UpdateBladeBoxForHand(_right); } } private void UpdateBladeBoxForHand(Wire w) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) SwordState sword = w.Sword; if (!w.Holding || sword == null || (Object)(object)sword.Root == (Object)null || Time.unscaledTime < w.BladeBoxNextCheck) { return; } w.BladeBoxNextCheck = Time.unscaledTime + (_fusionNetworked ? 0.05f : (1f / 30f)); if (!InAnyBladeBox(HandlePoint(sword))) { sword.NeedExit = false; } else if (!sword.NeedExit) { sword.NeedExit = true; if (!sword.HasBlades && DrawBlades(sword)) { PlayOneShotSfx(_draw); } } } private static Vector3 HandlePoint(SwordState st) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)st.Handle != (Object)null)) { return st.Root.position; } return st.Handle.position; } private void OnActionButton(Wire w) { SwordState sword = w.Sword; if (sword != null) { if (sword.SpearCount > 0) { FireSpears(w); } else if (sword.HasBlades) { DetachAll(sword); } } } private SwordState GetSword(GameObject held) { Poolee componentInParent = held.GetComponentInParent<Poolee>(); Transform root = (((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).transform : held.transform.root); return GetSwordForRoot(root); } private SwordState GetSwordForRoot(Transform root) { int instanceID = ((Object)root).GetInstanceID(); if (_swords.TryGetValue(instanceID, out var value) && (Object)(object)value.Root != (Object)null) { return value; } SwordState swordState = CreateSwordState(root); _swords[instanceID] = swordState; return swordState; } private SwordState CreateSwordState(Transform root) { SwordState swordState = new SwordState { Root = root }; swordState.SS = ((Component)root).GetComponentInChildren<StabSlash>(true); if ((Object)(object)swordState.SS != (Object)null) { swordState.Rb = swordState.SS.rb; } if ((Object)(object)swordState.Rb == (Object)null) { swordState.Rb = ((Component)root).GetComponentInChildren<Rigidbody>(true); } CollectChunks(root, swordState); swordState.Chunks.Sort(delegate(Chunk a, Chunk b) { if (a.IsStub == b.IsStub) { return a.Index.CompareTo(b.Index); } return a.IsStub ? 1 : (-1); }); foreach (Chunk chunk in swordState.Chunks) { if (!chunk.IsStub) { swordState.Blades.Add(chunk); } } swordState.Handle = FindDeep(root, "ODM_Handle"); BuildBladeCols(swordState); swordState.SpearZone = FindNorm(root, (string n) => n.Contains("thunderspearzone")); if ((Object)(object)swordState.SpearZone != (Object)null) { swordState.SpearZoneBox = ((Component)swordState.SpearZone).GetComponentInChildren<BoxCollider>(true); swordState.Spears[0] = FindNorm(swordState.SpearZone, (string n) => n.Contains("primary")); swordState.Spears[1] = FindNorm(swordState.SpearZone, (string n) => n.Contains("secondary")); swordState.Spears[2] = FindNorm(swordState.SpearZone, (string n) => n.Contains("third")); Transform[] spears = swordState.Spears; foreach (Transform val in spears) { if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } } } foreach (Chunk chunk2 in swordState.Chunks) { if ((Object)(object)chunk2.T != (Object)null) { ((Component)chunk2.T).gameObject.SetActive(false); } } foreach (BladeCol bladeCol in swordState.BladeCols) { if ((Object)(object)bladeCol.Box != (Object)null) { ((Collider)bladeCol.Box).enabled = false; } } return swordState; } private static void CollectChunks(Transform parent, SwordState st) { for (int i = 0; i < parent.childCount; i++) { Transform child = parent.GetChild(i); string name = ((Object)child).name; int result; if (name == "ODM_Blade_Stub") { st.Chunks.Add(new Chunk { Index = 0, IsStub = true, T = child }); } else if (name.StartsWith("ODM_Blade_", StringComparison.Ordinal) && int.TryParse(name.Substring("ODM_Blade_".Length), out result)) { st.Chunks.Add(new Chunk { Index = result, T = child }); } CollectChunks(child, st); } } private void UpdateSwordBookkeeping() { if ((_swords.Count == 0 && _guns.Count == 0) || Time.time < _nextSwordPrune) { return; } _nextSwordPrune = Time.time + 10f; _deadSwordIds.Clear(); foreach (KeyValuePair<int, GunState> gun in _guns) { if ((Object)(object)gun.Value.Root == (Object)null || !((Component)gun.Value.Root).gameObject.activeInHierarchy) { _deadSwordIds.Add(gun.Key); } } foreach (int deadSwordId in _deadSwordIds) { _guns.Remove(deadSwordId); } _deadSwordIds.Clear(); foreach (KeyValuePair<int, SwordState> sword in _swords) { if ((Object)(object)sword.Value.Root == (Object)null || !((Component)sword.Value.Root).gameObject.activeInHierarchy) { _deadSwordIds.Add(sword.Key); } } foreach (int deadSwordId2 in _deadSwordIds) { _swords.Remove(deadSwordId2); } } private void BuildBladeCols(SwordState st) { if ((Object)(object)st.SS == (Object)null) { return; } Il2CppReferenceArray<StabPoint> stabPoints = st.SS.stabPoints; if (stabPoints != null) { foreach (StabPoint item in (Il2CppArrayBase<StabPoint>)(object)stabPoints) { if (item != null) { AddBladeCol(st, item.pointCollider, item.pointTran); } } } Il2CppReferenceArray<SlashBlade> slashBlades = st.SS.slashBlades; if (slashBlades == null) { return; } foreach (SlashBlade item2 in (Il2CppArrayBase<SlashBlade>)(object)slashBlades) { if (item2 != null) { AddBladeCol(st, item2.bladeCollider, item2.bladeTran); } } } private void AddBladeCol(SwordState st, Collider col, Transform tran) { //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_0068: 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_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_0085: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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) if ((Object)(object)col == (Object)null) { return; } BoxCollider val = ((Il2CppObjectBase)col).TryCast<BoxCollider>(); if ((Object)(object)val == (Object)null) { ((MelonBase)this).LoggerInstance.Warning("Stab/slash collider \"" + ((Object)col).name + "\" is not a Box Collider, it can't be shrunk."); return; } BladeCol bladeCol = new BladeCol { Box = val, Tran = tran, OrigCenter = val.center, OrigSize = val.size }; Vector3 val2 = Vector3.Scale(val.size, ((Component)val).transform.lossyScale); bladeCol.Axis = 0; if (Mathf.Abs(val2.y) > Mathf.Abs(((Vector3)(ref val2))[bladeCol.Axis])) { bladeCol.Axis = 1; } if (Mathf.Abs(val2.z) > Mathf.Abs(((Vector3)(ref val2))[bladeCol.Axis])) { bladeCol.Axis = 2; } if ((Object)(object)tran != (Object)null) { bladeCol.OrigTranLocal = ((Component)val).transform.InverseTransformPoint(tran.position); bladeCol.TipSign = ((!(((Vector3)(ref bladeCol.OrigTranLocal))[bladeCol.Axis] < ((Vector3)(ref bladeCol.OrigCenter))[bladeCol.Axis])) ? 1 : (-1)); } int count = st.Blades.Count; bladeCol.Min = new float[count]; bladeCol.Max = new float[count]; bool flag = true; for (int i = 0; i < count && flag; i++) { flag = ChunkInterval(st.Blades[i].T, ((Component)val).transform, bladeCol.Axis, out bladeCol.Min[i], out bladeCol.Max[i]); } if (!flag) { float num = ((Vector3)(ref bladeCol.OrigCenter))[bladeCol.Axis] - (float)bladeCol.TipSign * ((Vector3)(ref bladeCol.OrigSize))[bladeCol.Axis] * 0.5f; float num2 = ((Vector3)(ref bladeCol.OrigSize))[bladeCol.Axis] / (float)Mathf.Max(1, count); for (int j = 0; j < count; j++) { float num3 = num + (float)bladeCol.TipSign * num2 * (float)j; float num4 = num + (float)bladeCol.TipSign * num2 * (float)(j + 1); bladeCol.Min[j] = Mathf.Min(num3, num4); bladeCol.Max[j] = Mathf.Max(num3, num4); } } st.BladeCols.Add(bladeCol); } private static bool ChunkInterval(Transform chunk, Transform boxT, int axis, out float min, out float max) { float min2 = float.MaxValue; float max2 = float.MinValue; bool result = false; if ((Object)(object)chunk != (Object)null) { foreach (MeshFilter componentsInChild in ((Component)chunk).GetComponentsInChildren<MeshFilter>(true)) { if (!((Object)(object)componentsInChild == (Object)null) && !((Object)(object)componentsInChild.sharedMesh == (Object)null)) { ExtendRange(componentsInChild, boxT, axis, ref min2, ref max2); result = true; } } } min = min2; max = max2; return result; } private void ApplyColliders(SwordState st) { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) foreach (BladeCol bladeCol in st.BladeCols) { if ((Object)(object)bladeCol.Box == (Object)null) { continue; } int axis = bladeCol.Axis; float num = (float)bladeCol.TipSign * ((Vector3)(ref bladeCol.OrigSize))[axis] * 0.5f; float num2 = ((Vector3)(ref bladeCol.OrigCenter))[axis] - num; float num3 = ((Vector3)(ref bladeCol.OrigCenter))[axis] + num; bool flag = false; float num4 = 0f; for (int i = 0; i < st.Blades.Count; i++) { Chunk chunk = st.Blades[i]; if (chunk.Equipped && !((Object)(object)chunk.T == (Object)null)) { float num5 = ((bladeCol.TipSign > 0) ? bladeCol.Max[i] : bladeCol.Min[i]); num4 = ((!flag) ? num5 : ((bladeCol.TipSign > 0) ? Mathf.Max(num4, num5) : Mathf.Min(num4, num5))); flag = true; } } if (!flag) { ((Collider)bladeCol.Box).enabled = false; continue; } Vector3 origSize = bladeCol.OrigSize; ((Vector3)(ref origSize))[axis] = Mathf.Max(0.005f, Mathf.Abs(num4 - num2)); Vector3 origCenter = bladeCol.OrigCenter; ((Vector3)(ref origCenter))[axis] = (num4 + num2) * 0.5f; bladeCol.Box.size = origSize; bladeCol.Box.center = origCenter; if ((Object)(object)bladeCol.Tran != (Object)null) { Vector3 origTranLocal = bladeCol.OrigTranLocal; int num6 = axis; ((Vector3)(ref origTranLocal))[num6] = ((Vector3)(ref origTranLocal))[num6] + (num4 - num3); bladeCol.Tran.position = ((Component)bladeCol.Box).transform.TransformPoint(origTranLocal); } ((Collider)bladeCol.Box).enabled = true; } } private void EnsureStabSlashActive(SwordState st) { if ((Object)(object)st.SS != (Object)null) { ActivateChain(((Component)st.SS).transform, st.Root); } foreach (BladeCol bladeCol in st.BladeCols) { if ((Object)(object)bladeCol.Box != (Object)null) { ActivateChain(((Component)bladeCol.Box).transform, st.Root); } if ((Object)(object)bladeCol.Tran != (Object)null) { ActivateChain(bladeCol.Tran, st.Root); } } } private static void ActivateChain(Transform t, Transform stopAt) { while ((Object)(object)t != (Object)null && (Object)(object)t != (Object)(object)stopAt) { if (!((Component)t).gameObject.activeSelf) { ((Component)t).gameObject.SetActive(true); } t = t.parent; } } private void ReleaseImpales(SwordState st) { if (st == null || (Object)(object)st.Root == (Object)null) { return; } if ((Object)(object)st.SS == (Object)null) { st.SS = ((Component)st.Root).GetComponentInChildren<StabSlash>(true); } if ((Object)(object)st.SS == (Object)null) { return; } Il2CppReferenceArray<StabPoint> stabPoints = st.SS.stabPoints; if (stabPoints != null) { foreach (StabPoint sp in (Il2CppArrayBase<StabPoint>)(object)stabPoints) { if (sp != null) { ReleaseJoints<StabJoint>(sp.stabJoints, (Func<StabJoint, Object>)((StabJoint j) => (Object)(object)j.joint), (Action<int>)delegate(int i) { sp.UnStab(i, true); }, "Stab"); } } } Il2CppReferenceArray<SlashBlade> slashBlades = st.SS.slashBlades; if (slashBlades != null) { foreach (SlashBlade sb in (Il2CppArrayBase<SlashBlade>)(object)slashBlades) { if (sb != null) { ReleaseJoints<BladeJoint>(sb.bladeJoints, (Func<BladeJoint, Object>)((BladeJoint j) => (Object)(object)j.joint), (Action<int>)delegate(int i) { sb.UnSlash(i, true); }, "Slash"); } } } Physics.SyncTransforms(); } private void ReleaseJoints<T>(Il2CppReferenceArray<T> joints, Func<T, Object> jointOf, Action<int> unrelease, string what) where T : Il2CppObjectBase { if (joints == null) { return; } for (int num = ((Il2CppArrayBase<T>)(object)joints).Length - 1; num >= 0; num--) { try { T val = ((Il2CppArrayBase<T>)(object)joints)[num]; Object val2 = ((val != null) ? jointOf(val) : null); if (!(val2 == (Object)null)) { try { unrelease(num); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning(what + " release failed: " + ex.Message); } if (val2 != (Object)null) { Object.Destroy(val2); } } } catch (Exception ex2) { ((MelonBase)this).LoggerInstance.Warning("Couldn't release a " + what.ToLowerInvariant() + " joint: " + ex2.Message); } } } private bool DrawBlades(SwordState st) { if (st.HasBlades || st.Chunks.Count == 0) { return false; } foreach (Chunk chunk in st.Chunks) { if (!((Object)(object)chunk.T == (Object)null)) { ((Component)chunk.T).gameObject.SetActive(true); chunk.Equipped = true; } } EnsureStabSlashActive(st); ApplyColliders(st); return true; } private void DetachAll(SwordState st) { ReleaseImpales(st); if (st.HasBlades) { SpawnDebrisBundle(st, 0.4f); } foreach (Chunk chunk in st.Chunks) { if (chunk.Equipped && (Object)(object)chunk.T != (Object)null) { ((Component)chunk.T).gameObject.SetActive(false); } chunk.Equipped = false; } st.NeedExit = true; ApplyColliders(st); } private void SpawnDebrisBundle(SwordState st, float kick) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_00a9: 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_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ODMGear_BladeBundle"); val.transform.SetPositionAndRotation(st.Root.position, st.Root.rotation); val.transform.localScale = Vector3.one; Debris debris = new Debris { Go = val }; Vector3 val2 = Vector3.zero; int num = 0; foreach (Chunk chunk in st.Chunks) { if (!chunk.Equipped || (Object)(object)chunk.T == (Object)null) { continue; } GameObject val3 = Object.Instantiate<GameObject>(((Component)chunk.T).gameObject, chunk.T.position, chunk.T.rotation); val3.transform.SetParent(val.transform, true); val3.transform.localScale = chunk.T.lossyScale; val3.SetActive(true); foreach (Rigidbody componentsInChild in val3.GetComponentsInChildren<Rigidbody>(true)) { if ((Object)(object)componentsInChild != (Object)null) { Object.Destroy((Object)(object)componentsInChild); } } AddDebrisColliders(val3.transform, debris); val2 += chunk.T.position; num++; } if (num == 0) { Object.Destroy((Object)(object)val); } else { FinishDebris(st.Root, st.Rb, debris, val2 / (float)num, kick); } } private static void AddDebrisColliders(Transform root, Debris debris) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00bb: Unknown result type (might be due to invalid IL or missing references) int count = debris.Own.Count; foreach (Collider componentsInChild in ((Component)root).GetComponentsInChildren<Collider>(true)) { if (!((Object)(object)componentsInChild == (Object)null)) { componentsInChild.enabled = true; debris.Own.Add(componentsInChild); } } if (debris.Own.Count <= count) { MeshFilter componentInChildren = ((Component)root).GetComponentInChildren<MeshFilter>(true); if (!((Object)(object)componentInChildren == (Object)null) && !((Object)(object)componentInChildren.sharedMesh == (Object)null)) { BoxCollider val = ((Component)componentInChildren).gameObject.AddComponent<BoxCollider>(); Bounds bounds = componentInChildren.sharedMesh.bounds; val.center = ((Bounds)(ref bounds)).center; bounds = componentInChildren.sharedMesh.bounds; val.size = ((Bounds)(ref bounds)).size; debris.Own.Add((Collider)(object)val); } } } private void FinishDebris(Transform sourceRoot, Rigidbody sourceRb, Debris debris, Vector3 fromPosition, float kick) { //IL_004b: 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) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_005e: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) Rigidbody val = debris.Go.GetComponent<Rigidbody>(); if ((Object)(object)val == (Object)null) { val = debris.Go.AddComponent<Rigidbody>(); } val.isKinematic = false; val.mass = 0.4f; val.useGravity = true; Vector3 val2 = (((Object)(object)sourceRb != (Object)null) ? sourceRb.velocity : Vector3.zero); Vector3 val3 = fromPosition - sourceRoot.position; val3 = ((((Vector3)(ref val3)).sqrMagnitude > 0.0001f) ? ((Vector3)(ref val3)).normalized : Vector3.up); val.velocity = val2 + val3 * kick + Random.insideUnitSphere * 0.6f; val.angularVelocity = Random.insideUnitSphere * 5f; Il2CppArrayBase<Collider> componentsInChildren = ((Component)sourceRoot).GetComponentsInChildren<Collider>(true); foreach (Collider item in debris.Own) { foreach (Collider item2 in componentsInChildren) { if (!((Object)(object)item2 == (Object)null) && !debris.Own.Contains(item2)) { try { Physics.IgnoreCollision(item, item2, true); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Could not ignore debris/sword collision: " + ex.Message); } } } } if ((Object)(object)_rig != (Object)null) { foreach (Collider componentsInChild in ((Component)_rig).GetComponentsInChildren<Collider>(true)) { if ((Object)(object)componentsInChild == (Object)null) { continue; } bool flag = false; foreach (Collider item3 in debris.Own) { if (!((Object)(object)item3 == (Object)null)) { try { Physics.IgnoreCollision(item3, componentsInChild, true); flag = true; } catch (Exception ex2) { ((MelonBase)this).LoggerInstance.Warning("Could not ignore debris/player collision: " + ex2.Message); } } } if (flag && !debris.IgnoredRig.Contains(componentsInChild)) { debris.IgnoredRig.Add(componentsInChild); } } } float num = P.DebrisLifetime.Value; if (float.IsNaN(num)) { num = 8f; } debris.RestoreAt = Time.time + 1.5f; debris.DestroyAt = Time.time + num; _debris.Add(debris); } private static void RestoreDebrisCollisions(Debris d) { if (d == null) { return; } foreach (Collider item in d.Own) { if ((Object)(object)item == (Object)null) { continue; } foreach (Collider item2 in d.IgnoredRig) { if (!((Object)(object)item2 == (Object)null)) { try { Physics.IgnoreCollision(item, item2, false); } catch { } } } } d.IgnoredRig.Clear(); } private void UpdateDebris() { for (int num = _debris.Count - 1; num >= 0; num--) { Debris debris = _debris[num]; if ((Object)(object)debris.Go == (Object)null) { _debris.RemoveAt(num); } else { if (!debris.Restored && Time.time >= debris.RestoreAt) { RestoreDebrisCollisions(debris); debris.Restored = true; } if (Time.time >= debris.DestroyAt) { Object.Destroy((Object)(object)debris.Go); _debris.RemoveAt(num); } } } } private void UpdateCrosshair(Wire w) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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_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_00c5: 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_0102: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) if (!P.ApCrosshair.Value || !TryGetAim(w, out var origin, out var dir, out var from)) { HideCrosshair(w); return; } Transform ignoreRoot = (((Object)(object)w.HeldGO != (Object)null) ? w.HeldGO.transform.root : null); if (!RaycastIgnoring(origin, dir, 60f, ignoreRoot, out var result)) { HideCrosshair(w); return; } GameObject crosshair = GetCrosshair(w, from); if ((Object)(object)crosshair == (Object)null) { return; } Transform head = ((Rig)_rig.physicsRig).m_head; Vector3 val = (((Object)(object)head != (Object)null) ? head.position : origin); Vector3 val2 = ((RaycastHit)(ref result)).point + ((RaycastHit)(ref result)).normal * 0.01f; Vector3 val3 = val - val2; if (!(((Vector3)(ref val3)).sqrMagnitude < 1E-06f)) { float num = ((Vector3)(ref val3)).magnitude * 0.03f * P.ApCrosshairSize.Value; crosshair.transform.SetPositionAndRotation(val2, Quaternion.LookRotation(val3)); crosshair.transform.localScale = Vector3.one * num; if (!crosshair.activeSelf) { crosshair.SetActive(true); } } } private bool TryGetAim(Wire w, out Vector3 origin, out Vector3 dir, out Transform from) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_00e0: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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) origin = default(Vector3); dir = default(Vector3); from = null; GunState gun = w.Gun; if (gun != null) { if ((Object)(object)gun.Root == (Object)null || (Object)(object)gun.FireZone == (Object)null || !gun.Ready) { return false; } origin = gun.FireZone.position; dir = gun.FireZone.forward; from = gun.Root; return true; } SwordState sword = w.Sword; if (sword != null && (Object)(object)sword.Root != (Object)null && sword.SpearCount > 0) { Transform val = null; for (int i = 0; i < 3; i++) { if (!((Object)(object)val == (Object)null)) { break; } if (sword.SpearLoaded[i] && (Object)(object)sword.Spears[i] != (Object)null) { val = sword.Spears[i]; } } if ((Object)(object)val == (Object)null) { return false; } origin = val.position; dir = ((P.ThunderAimController.Value && (Object)(object)w.Ctrl != (Object)null) ? AimDirection(w.Ctrl) : val.forward); from = sword.Root; return true; } return false; } private static void HideCrosshair(Wire w) { if ((Object)(object)w.Crosshair != (Object)null && w.Crosshair.activeSelf) { w.Crosshair.SetActive(false); } } private GameObject GetCrosshair(Wire w, Transform from) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_006d: 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_0084: 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_00a0: 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_00bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)w.Crosshair != (Object)null) { return w.Crosshair; } Mesh crossMesh = GetCrossMesh(); Material crossMaterial = GetCrossMaterial(from); if ((Object)(object)crossMesh == (Object)null || (Object)(object)crossMaterial == (Object)null) { return null; } GameObject val = new GameObject("ODMGear_Crosshair"); float[] array = new float[2] { 45f, -45f }; foreach (float num in array) { GameObject val2 = new GameObject("Bar"); val2.transform.SetParent(val.transform, false); val2.transform.localRotation = Quaternion.Euler(0f, 0f, num); val2.transform.localScale = new Vector3(1f, 0.14f, 0.02f); val2.AddComponent<MeshFilter>().sharedMesh = crossMesh; MeshRenderer obj = val2.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = crossMaterial; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; } val.SetActive(false); w.Crosshair = val; return val; } private Mesh GetCrossMesh() { if ((Object)(object)_crossMesh != (Object)null) { return _crossMesh; } GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); _crossMesh = val.GetComponent<MeshFilter>().sharedMesh; Object.DestroyImmediate((Object)(object)val); return _crossMesh; } private Material GetCrossMaterial(Transform from) { //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_009e: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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) if ((Object)(object)_crossMat != (Object)null) { return _crossMat; } Material val = null; foreach (Renderer componentsInChild in ((Component)from).GetComponentsInChildren<Renderer>(true)) { if ((Object)(object)componentsInChild != (Object)null && (Object)(object)componentsInChild.sharedMaterial != (Object)null) { val = componentsInChild.sharedMaterial; break; } } if ((Object)(object)val == (Object)null) { return null; } Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.1f, 0.08f, 1f); _crossMat = new Material(val) { name = "ODMGear_Crosshair" }; _crossMat.mainTexture = null; _crossMat.SetColor("_BaseColor", val2); _crossMat.SetColor("_Color", val2); _crossMat.EnableKeyword("_EMISSION"); _crossMat.SetColor("_EmissionColor", val2 * 3f); _crossMat.SetFloat("_Smoothness", 0f); _crossMat.SetFloat("_Metallic", 0f); return _crossMat; } private void UpdateFlipInput(BaseController stick) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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) PhysGrounder val = (((Object)(object)_rig != (Object)null && (Object)(object)_rig.physicsRig != (Object)null) ? _rig.physicsRig.physG : null); _airTime = (((Object)(object)val != (Object)null && val.isGrounded) ? 0f : (_airTime + Time.deltaTime)); float num = 0f; float flipTurn = 0f; if ((Object)(object)stick != (Object)null && P.FlipEnabled.Value) { Vector2 thumbStickAxis = stick.GetThumbStickAxis(); num = ShapeStick(thumbStickAxis.y); flipTurn = ShapeStick(thumbStickAxis.x); } _flipStick = num; _flipTurn = flipTurn; if (!_flipActive && num != 0f && CanStartFlip()) { StartFlip(); } } private float ShapeStick(float raw) { float num = Mathf.Clamp(P.FlipDeadzone.Value, 0f, 0.95f); float num2 = Mathf.Abs(raw); if (!(num2 > num)) { return 0f; } return Mathf.Sign(raw) * (num2 - num) / (1f - num); } private bool CanStartFlip() { if (!P.FlipEnabled.Value || (Object)(object)_rig == (Object)null || !HoldingGear) { return false; } if ((Object)(object)_rig.activeSeat != (Object)null) { return false; } if (!P.FlipOnGround.Value && _airTime < 0.12f) { return false; } PhysicsRig physicsRig = _rig.physicsRig; if ((Object)(object)physicsRig == (Object)null || (Object)(object)physicsRig.torso == (Object)null) { return false; } if (!physicsRig.torso.shutdown) { return physicsRig.ballLocoEnabled; } return false; } private void StartFlip() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_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_0045: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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) try { PhysicsRig physicsRig = _rig.physicsRig; Vector3 val = Vector3.ProjectOnPlane(((Rig)physicsRig).m_head.forward, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.ProjectOnPlane(((Rig)physicsRig).m_head.up, Vector3.up); } if (((Vector3)(ref val)).sqrMagnitude < 0.0001f) { val = Vector3.forward; } Vector3 val2 = Vector3.Cross(Vector3.up, ((Vector3)(ref val)).normalized); _flipAxis = ((Vector3)(ref val2)).normalized; physicsRig.RagdollRig(); physicsRig.DisableBallLoco(); physicsRig.PhysicalLegs(); physicsRig.legLf.ShutdownLimb(); physicsRig.legRt.ShutdownLimb(); _flipBodies = Il2CppArrayBase<Rigidbody>.op_Implicit(((Component)physicsRig).GetComponentsInChildren<Rigidbody>(true)); _flipBaseShutdown = physicsRig.torso.shutdown; List<Rigidbody> list = new List<Rigidbody>(_bodyParts); PhysLimb[] array = (PhysLimb[])(object)new PhysLimb[2] { physicsRig.legLf, physicsRig.legRt }; foreach (PhysLimb val3 in array) { if (!((Object)(object)val3 == (Object)null)) { list.Add(val3.rbUpper); list.Add(val3.rbLower); list.Add(val3.rbEnd); } } _flipCore = list.ToArray(); _flipActive = true; _flipOmega = 0f; _turnOmega = 0f; _landedFor = 0f; Dbg($"Flip started ({_flipBodies.Length} bodies)"); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Couldn't start a flip: " + ex.Message); EndFlip(); } } private void EndFlip() { //IL_0043: 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_004d: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_00d2: Unknown result type (might be due to invalid IL or missing references) bool flipActive = _flipActive; ResetFlipState(); if (!flipActive || (Object)(object)_rig == (Object)null) { return; } try { PhysicsRig physicsRig = _rig.physicsRig; if ((Object)(object)physicsRig != (Object)null) { Transform transform = ((Component)((Rig)physicsRig).m_pelvis).transform; Quaternion val = Quaternion.FromToRotation(BodyUp(physicsRig), Vector3.up); physicsRig.TurnOnRig(); physicsRig.UnRagdollRig(); Quaternion val2 = val * transform.rotation; physicsRig.knee.transform.SetPositionAndRotation(transform.position, val2); physicsRig.feet.transform.SetPositionAndRotation(transform.position, val2); if (!physicsRig.ballLocoEnabled) { physicsRig.EnableBallLoco(); } foreach (Rigidbody componentsInChild in ((Component)physicsRig).GetComponentsInChildren<Rigidbody>(true)) { if ((Object)(object)componentsInChild != (Object)null && !componentsInChild.isKinematic) { componentsInChild.angularVelocity = Vector3.zero; } } } StandViewUp(); Dbg($"Flip ended (ball loco on={(Object)(object)physicsRig != (Object)null && physicsRig.ballLocoEnabled})"); } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Couldn't end the flip cleanly: " + ex.Message); } } private void ResetFlipState() { _flipActive = false; _flipOmega = 0f; _turnOmega = 0f; _flipStick = 0f; _flipTurn = 0f; _landedFor = 0f; _airTime = 0f; _flipBodies = Array.Empty<Rigidbody>(); _flipCore = Array.Empty<Rigidbody>(); } private void StepFlip(float dt) { //IL_00b2: 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_0235: 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_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_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: 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_0278: 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_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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) //IL_0164: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) if (!_flipActive) { return; } PhysicsRig val = (((Object)(object)_rig != (Object)null) ? _rig.physicsRig : null); if ((Object)(object)val == (Object)null || (Object)(object)val.torso == (Object)null) { ResetFlipState(); return; } if (val.ballLocoEnabled) { Dbg("Flip dropped: something else restored the rig"); ResetFlipState(); return; } if (val.torso.shutdown != _flipBaseShutdown) { Dbg("Flip dropped: something else ragdolled or restored the torso"); ResetFlipState(); return; } bool num = P.FlipEnabled.Value && HoldingGear && (Object)(object)_rig.activeSeat == (Object)null; Vector3 val2 = BodyUp(val); float num2 = (num ? (_flipStick * P.FlipMaxSpeed.Value) : 0f); float num3 = (num ? (_flipTurn * P.FlipTurnSpeed.Value) : 0f); bool num4 = num2 != 0f || num3 != 0f; _landedFor = (NearGround(val) ? (_landedFor + dt) : 0f); Vector3 val3; if (!num4 && _landedFor >= 0.12f) { float num5 = Vector3.Angle(val2, Vector3.up); if (num5 < 20f) { EndFlip(); return; } val3 = Vector3.Cross(val2, Vector3.up); Vector3 normalized = ((Vector3)(ref val3)).normalized; float num6 = Mathf.Clamp(num5 * 8f, 0f, 360f) * ((float)Math.PI / 180f); _flipOmega = 0f; _turnOmega = 0f; SpinBody(val, normalized * num6); return; } float num7 = Mathf.Max(1f, P.FlipResponse.Value) * dt; _flipOmega = Mathf.MoveTowards(_flipOmega, num2, num7); _turnOmega = Mathf.MoveTowards(_turnOmega, num3, num7); if (Mathf.Abs(_flipOmega) < 0.01f && Mathf.Abs(_turnOmega) < 0.01f) { HoldBody(val); return; } _flipAxis = Quaternion.AngleAxis(_turnOmega * dt, val2) * _flipAxis; val3 = Vector3.ProjectOnPlane(_flipAxis, val2); _flipAxis = ((Vector3)(ref val3)).normalized; Vector3 omega = _flipAxis * (_flipOmega * ((float)Math.PI / 180f)) + val2 * (_turnOmega * ((float)Math.PI / 180f)); SpinBody(val, omega); } private static Vector3 BodyUp(PhysicsRig phys) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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) Vector3 val = ((Rig)phys).m_head.position - phys.torso._pelvisRb.position; if (!(((Vector3)(ref val)).sqrMagnitude < 0.0001f)) { return ((Vector3)(ref val)).normalized; } return Vector3.up; } private bool NearGround(PhysicsRig phys) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Rigidbody pelvisRb = phys.torso._pelvisRb; if ((Object)(object)pelvisRb == (Object)null) { return false; } Transform ignoreRoot = (((Object)(object)_left.HeldGO != (Object)null) ? _left.HeldGO.transform.root : (((Object)(object)_right.HeldGO != (Object)null) ? _right.HeldGO.transform.root : null)); RaycastHit result; return RaycastIgnoring(pelvisRb.position, Vector3.down, 1.1f, ignoreRoot, out result, 0.12f); } private void HoldBody(PhysicsRig phys) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Rigidbody pelvisRb = phys.torso._pelvisRb; if (!((Object)(object)pelvisRb == (Object)null)) { Vector3 worldCenterOfMass = pelvisRb.worldCenterOfMass; Vector3 velocity = pelvisRb.velocity; Rigidbody[] flipCore = _flipCore; for (int i = 0; i < flipCore.Length; i++) { SpinOne(flipCore[i], worldCenterOfMass, velocity, Vector3.zero); } } } private void SpinBody(PhysicsRig phys, Vector3 omega) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be