Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of FNAF2Valuables v1.2.1
com.thunderstore.unbe.WGFHeadTrap.dll
Decompiled 11 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("Autodesk.Fbx")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")] [assembly: IgnoresAccessChecksTo("Klattersynth")] [assembly: IgnoresAccessChecksTo("Photon3Unity3D")] [assembly: IgnoresAccessChecksTo("PhotonChat")] [assembly: IgnoresAccessChecksTo("PhotonRealtime")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")] [assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")] [assembly: IgnoresAccessChecksTo("PhotonVoice.API")] [assembly: IgnoresAccessChecksTo("PhotonVoice")] [assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")] [assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")] [assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")] [assembly: IgnoresAccessChecksTo("Sirenix.Serialization")] [assembly: IgnoresAccessChecksTo("Sirenix.Utilities")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")] [assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("websocket-sharp")] [assembly: AssemblyCompany("Unbe")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WGFHeadTrap")] [assembly: AssemblyTitle("com.thunderstore.unbe.WGFHeadTrap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class TrapCameraMonitor : Trap { public GameObject TVScreen; public UnityEvent TVTimer; public float runTime = 10f; private float Timer; private float speedMulti = 1f; public GameObject VideoObject; public MeshRenderer TVStatic; public Light TVLight; public AnimationCurve TVStaticCurve; public float TVStaticTime = 0.5f; public float TVStaticTimer; private float updateInterval = 1f / 12f; private bool TVStaticIntro = true; public bool TVStaticOutro; [Space] [Header("___________________ TV Sounds ___________________")] public Sound VideoSound; public Sound StartSound; public Sound StopSound; [HideInInspector] public bool TrapDone; private bool TVStart = true; protected void Start() { ((Trap)this).Start(); TVStaticOutro = false; ((Renderer)TVStatic).enabled = false; TVStaticIntro = true; ((Behaviour)TVLight).enabled = false; VideoObject.SetActive(false); base.photonView = ((Component)this).GetComponent<PhotonView>(); if (GameManager.instance.gameMode == 0) { base.isLocal = true; } } public void TrapActivate() { if (!base.trapTriggered) { base.trapActive = true; base.trapTriggered = true; TVStart = true; TVTimer.Invoke(); } } public void TrapStop() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) TVStaticOutro = true; TVStaticTimer = 0f; StopSound.Play(base.physGrabObject.centerPoint, 1f, 1f, 1f, 1f); } protected void Update() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) ((Trap)this).Update(); VideoSound.PlayLoop(base.trapActive, 0f, 0f, 1f); if (base.trapStart) { TrapActivate(); } if (!base.trapActive) { return; } base.enemyInvestigate = true; if (TVStart) { ((Behaviour)TVLight).enabled = true; TVStart = false; StartSound.Play(base.physGrabObject.centerPoint, 1f, 1f, 1f, 1f); VideoObject.SetActive(true); } if (!TVStaticIntro && !TVStaticOutro) { return; } float num = TVStaticCurve.Evaluate(TVStaticTimer / TVStaticTime); TVStaticTimer += 1f * Time.deltaTime * speedMulti; if (num > 0.5f) { ((Renderer)TVStatic).enabled = true; } else { ((Renderer)TVStatic).enabled = false; } if (TVStaticTimer > TVStaticTime) { TVStaticIntro = false; TVStaticTimer = 0f; ((Renderer)TVStatic).enabled = false; if (TVStaticOutro) { base.trapActive = false; TVScreen.SetActive(false); } } } } public class GFHeadTrap : Trap { private PhysGrabObject physgrabobject; [Space] [Header("GFHead Components")] public GameObject GFHead; public GameObject GFHeadFeet; public GameObject GFHeadCrank; [Space] [Header("Sounds")] public Sound CrankStart; public Sound CrankEnd; public Sound CrankLoop; public Sound Jump; [Space] public AnimationCurve GFHeadJumpCurve; private float GFHeadJumpLerp; public float GFHeadJumpSpeed; private bool GFHeadJumpActive; public float GFHeadJumpIntensity; public float GFHeadJumpForce; private Quaternion initialGFHeadRotation; private Rigidbody rb; private bool LoopPlaying; private bool everPickedUp; private float GFHeadJumpTimer; private PhysGrabObjectImpactDetector impactDetector; private bool grabbedPrev; protected void Start() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ((Trap)this).Start(); impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>(); initialGFHeadRotation = GFHead.transform.localRotation; rb = ((Component)this).GetComponent<Rigidbody>(); physgrabobject = ((Component)this).GetComponent<PhysGrabObject>(); } protected void Update() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00db: 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_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) ((Trap)this).Update(); CrankLoop.PlayLoop(LoopPlaying, 0.8f, 0.8f, 1f); if (base.physGrabObject.grabbed) { if (!grabbedPrev) { CrankEnd.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f); grabbedPrev = true; if (base.physGrabObject.grabbedLocal) { PhysGrabber.instance.OverrideGrabDistance(0.8f); if (SemiFunc.IsMasterClientOrSingleplayer()) { Quaternion val = Quaternion.Euler(45f, 180f, 0f); Quaternion val2 = Quaternion.Euler(0f, 0f, 0f); Quaternion identity = Quaternion.identity; base.physGrabObject.TurnXYZ(val, val2, identity); } } } everPickedUp = true; LoopPlaying = false; if (base.trapActive) { TrapStop(); } } else { grabbedPrev = false; if (everPickedUp) { base.trapStart = true; } } if (base.trapStart && !impactDetector.inCart) { TrapActivate(); } if (!base.trapActive || base.physGrabObject.grabbed) { return; } base.enemyInvestigate = true; LoopPlaying = true; if (GFHeadJumpActive) { GFHeadJumpLerp += GFHeadJumpSpeed * Time.deltaTime; if (GFHeadJumpLerp >= 1f) { GFHeadJumpLerp = 0f; GFHeadJumpActive = false; } } GFHeadFeet.transform.localEulerAngles = new Vector3(0f, 0f, GFHeadJumpCurve.Evaluate(GFHeadJumpLerp) * GFHeadJumpIntensity); GFHeadCrank.transform.Rotate(0f, 0f, 80f * Time.deltaTime); float num = 40f; float num2 = 1f * Mathf.Sin(Time.time * num); float num3 = 1f * Mathf.Sin(Time.time * num + MathF.PI / 2f); GFHead.transform.localRotation = initialGFHeadRotation * Quaternion.Euler(num2, 0f, num3); GFHead.transform.localPosition = new Vector3(GFHead.transform.localPosition.x, GFHead.transform.localPosition.y - num2 * 0.005f * Time.deltaTime, GFHead.transform.localPosition.z); if (GFHeadJumpTimer > 0f) { GFHeadJumpTimer -= Time.deltaTime; } else if (SemiFunc.IsMultiplayer()) { if (SemiFunc.IsMasterClient()) { base.photonView.RPC("GFHeadJumpRPC", (RpcTarget)0, Array.Empty<object>()); } } else { GFHeadJump(); } } public void GFHeadJump() { //IL_0045: 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) //IL_0155: 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_016b: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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) if (impactDetector.inCart) { TrapStop(); return; } GFHeadJumpTimer = Random.Range(5f, 5f); base.enemyInvestigate = true; Jump.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f); GFHeadJumpActive = true; GFHeadJumpLerp = 0f; base.enemyInvestigateRange = 20f; if (base.isLocal) { Vector3 insideUnitSphere; if (Vector3.Dot(GFHead.transform.up, Vector3.up) > 0f) { rb.AddForce(Vector3.up * GFHeadJumpForce, (ForceMode)1); rb.AddForce(((Component)this).transform.forward * GFHeadJumpForce, (ForceMode)1); insideUnitSphere = Random.insideUnitSphere; Vector3 val = ((Vector3)(ref insideUnitSphere)).normalized * Random.Range(0f, 0f); val.z = 0f; val.x = 0f; rb.AddTorque(val * 0f, (ForceMode)1); } else { rb.AddForce(Vector3.up * 1f, (ForceMode)1); insideUnitSphere = Random.insideUnitSphere; Vector3 normalized = ((Vector3)(ref insideUnitSphere)).normalized; rb.AddTorque(normalized * 0f, (ForceMode)1); } } } [PunRPC] public void GFHeadJumpRPC() { GFHeadJump(); } public void TrapStop() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) base.trapActive = false; base.trapStart = false; LoopPlaying = false; base.trapTriggered = false; CrankEnd.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f); } public void TrapActivate() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!base.trapTriggered) { CrankStart.Play(physgrabobject.centerPoint, 1f, 1f, 1f, 1f); base.trapActive = true; base.trapTriggered = true; GFHeadJumpTimer = 0f; } } } namespace SpringBonesTool { public class SpringBones : MonoBehaviour { private enum Axis { X, Y, Z } private class Item { private readonly Transform bone; private readonly Transform parent; private readonly int axis; private readonly Vector3 pLookDir; private readonly Vector3 pSecDir; private Vector3 wBasePos; private Vector3 wMassPos; private Vector3 delta; private Vector3 speed; private Vector3 aMain; private Vector3 aSec; private Quaternion qrot; public int deep; public Item(Transform bone, int axis, float len) { //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_0028: 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_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_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_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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_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_007f: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_00b6: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) this.bone = bone; parent = bone.parent; this.axis = axis; Vector3 val = Vector3.forward; Vector3 val2 = Vector3.up; switch (axis) { case 0: val = bone.right; val2 = bone.up; break; case 1: val = bone.up; val2 = bone.forward; break; case 2: val = bone.forward; val2 = bone.right; break; } wBasePos = bone.position + val * len; wMassPos = wBasePos; if ((Object)(object)parent != (Object)null) { pLookDir = parent.InverseTransformDirection(val); pSecDir = parent.InverseTransformDirection(val2); } else { pLookDir = val; pSecDir = val2; } deep = 0; Transform val3 = bone; while ((Object)(object)val3.parent != (Object)null) { val3 = val3.parent; deep++; } } public void Tick(float rigid, float damping, float length, float impact) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_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_0046: 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_0051: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00a4: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) wBasePos = bone.position + (((Object)(object)parent != (Object)null) ? parent.TransformDirection(pLookDir) : pLookDir) * length; delta = wBasePos - wMassPos; if (((Vector3)(ref delta)).sqrMagnitude > length * length) { delta = ((Vector3)(ref delta)).normalized * length; if (length < 0f) { delta *= -1f; } wMassPos = wBasePos - delta; } speed += rigid * Time.deltaTime * delta; speed *= damping; wMassPos += speed * Time.deltaTime; Vector3 val = wMassPos - bone.position; aMain = ((Vector3)(ref val)).normalized; if (length < 0f) { aMain *= -1f; } aSec = (((Object)(object)parent == (Object)null) ? pSecDir : parent.TransformDirection(pSecDir)); qrot = Quaternion.LookRotation(aMain, aSec); bone.rotation = Quaternion.Lerp(bone.rotation, qrot * QRots[axis], impact); } } private static readonly Quaternion[] QRots = (Quaternion[])(object)new Quaternion[3] { new Quaternion(0f, -0.7071f, 0f, 0.7071f), new Quaternion(0f, 0.7071f, 0.7071f, 0f), new Quaternion(0f, 0f, 0.7071f, 0.7071f) }; [SerializeField] private float length = 1f; [SerializeField] private float rigid = 100f; [SerializeField] [Range(0f, 1f)] private float damping = 0.95f; [SerializeField] [Range(0f, 1f)] private float impact = 1f; [SerializeField] private Axis axis; private int iaxis; [SerializeField] private List<Transform> bones; private List<Item> items; public bool doUpdate = true; private void Awake() { Init(); } private void Init() { if (items == null) { items = new List<Item>(); } items.Clear(); iaxis = (int)axis; for (int i = 0; i < bones.Count; i++) { if (!((Object)(object)bones[i] == (Object)null)) { items.Add(new Item(bones[i], iaxis, length)); } } items.Sort((Item x, Item y) => x.deep.CompareTo(y.deep)); } private void LateUpdate() { for (int i = 0; i < items.Count; i++) { items[i].Tick(rigid, 1f - damping, length, impact); } } private void OnDrawGizmosSelected() { //IL_004e: 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_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_00ab: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (bones == null) { return; } iaxis = (int)axis; for (int i = 0; i < bones.Count; i++) { if (!((Object)(object)bones[i] == (Object)null)) { Vector3 val = bones[i].position + ((iaxis == 0) ? bones[i].right : ((iaxis == 1) ? bones[i].up : bones[i].forward)) * length; Gizmos.DrawLine(bones[i].position, val); Gizmos.DrawWireSphere(val, Mathf.Abs(length) / 10f); } } } } } namespace WGFHeadTrap { [HarmonyPatch(typeof(PlayerController))] internal static class ExamplePlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(PlayerController __instance) { WGFHeadTrap.Logger.LogDebug((object)$"{__instance} Start Prefix"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { WGFHeadTrap.Logger.LogDebug((object)$"{__instance} Start Postfix"); } } [BepInPlugin("Unbe.WGFHeadTrap", "WGFHeadTrap", "1.0")] public class WGFHeadTrap : BaseUnityPlugin { internal static WGFHeadTrap Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } }