Decompiled source of Modmas 2025 Day 0 v1.0.2
MeatFortCookieMercs.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using FistVR; using HarmonyLib; using OtherLoader; using UnityEngine; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] public class FlickerLight : MonoBehaviour { public float MinLightIntensity = 0.5f; public float MaxLightIntensity = 2.3f; public float AccelerateTime = 0.15f; private float _targetIntensity = 1f; private float _lastIntensity = 1f; private float _timePassed = 0f; private Light _lt; private const double Tolerance = 0.0001; private void Start() { _lt = ((Component)this).GetComponent<Light>(); _lastIntensity = _lt.intensity; FixedUpdate(); } private void FixedUpdate() { _timePassed += Time.deltaTime; _lt.intensity = Mathf.Lerp(_lastIntensity, _targetIntensity, _timePassed / AccelerateTime); if ((double)Mathf.Abs(_lt.intensity - _targetIntensity) < 0.0001) { _lastIntensity = _lt.intensity; _targetIntensity = Random.Range(MinLightIntensity, MaxLightIntensity); _timePassed = 0f; } } } [RequireComponent(typeof(MeshRenderer))] public class UVOffset : MonoBehaviour { public float scrollSpeed = 0.5f; public bool scrollY = true; private MeshRenderer renderer; private void Start() { renderer = ((Component)this).GetComponent<MeshRenderer>(); } private void Update() { //IL_003f: 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) float num = Time.time * scrollSpeed; ((Renderer)renderer).material.SetTextureOffset("_MainTex", (!scrollY) ? new Vector2(0f, num) : new Vector2(num, 0f)); } } namespace Storymods.MeatFortCookieMercs; [BepInPlugin("Storymods.MeatFortCookieMercs", "MeatFortCookieMercs", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class MeatFortCookieMercsPlugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; LoadAssets(); } private void LoadAssets() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Storymods.MeatFortCookieMercs"); OtherLoader.RegisterDirectLoad(BasePath, "Storymods.MeatFortCookieMercs", "", "", "storymods_meatfortcookiemercs", ""); } } public class Cabernade : MonoBehaviour { public GameObject caberUnexploded; public GameObject caberExploded; public bool isCaberKablooey; public void OnCollisionEnter(Collision col) { if (!isCaberKablooey) { CaberBlowUp(); } } public void CaberBlowUp() { caberUnexploded.SetActive(false); caberExploded.SetActive(true); isCaberKablooey = true; } } public class SosigRangeEditor : MonoBehaviour { public GameObject sosigParent; public float modifierNumber = 1f; public bool doesHavePerfectFOV = false; private void Start() { sosigParent = ((Component)((Component)this).transform.root).gameObject; Sosig component = ((Component)((Component)this).transform).GetComponent<Sosig>(); component.MaxSightRange *= modifierNumber; if (doesHavePerfectFOV) { component.MaxFOV = 360f; } else { component.MaxFOV *= modifierNumber; } } } public class CuttableMesh { private MeshRenderer inputMeshRenderer; private bool hasUvs; private bool hasUv1s; private bool hasColours; private List<CuttableSubMesh> subMeshes; public CuttableMesh(Mesh inputMesh) { Init(inputMesh, ((Object)inputMesh).name); } public CuttableMesh(MeshRenderer input) { inputMeshRenderer = input; MeshFilter component = ((Component)input).GetComponent<MeshFilter>(); Mesh sharedMesh = component.sharedMesh; Init(sharedMesh, ((Object)input).name); } public CuttableMesh(CuttableMesh inputMesh, List<CuttableSubMesh> newSubMeshes) { inputMeshRenderer = inputMesh.inputMeshRenderer; hasUvs = inputMesh.hasUvs; hasUv1s = inputMesh.hasUv1s; hasColours = inputMesh.hasColours; subMeshes = new List<CuttableSubMesh>(); subMeshes.AddRange(newSubMeshes); } private void Init(Mesh inputMesh, string debugName) { subMeshes = new List<CuttableSubMesh>(); if (inputMesh.isReadable) { Vector3[] vertices = inputMesh.vertices; Vector3[] normals = inputMesh.normals; Vector2[] uv = inputMesh.uv; Vector2[] uv2 = inputMesh.uv2; Color32[] colors = inputMesh.colors32; hasUvs = uv != null && uv.Length > 0; hasUv1s = uv2 != null && uv2.Length > 0; hasColours = colors != null && colors.Length > 0; for (int i = 0; i < inputMesh.subMeshCount; i++) { int[] indices = inputMesh.GetIndices(i); CuttableSubMesh item = new CuttableSubMesh(indices, vertices, normals, colors, uv, uv2); subMeshes.Add(item); } } else { Debug.LogError((object)("CuttableMesh's input mesh is not readable: " + debugName), (Object)(object)inputMesh); } } public void Add(CuttableMesh other) { if (subMeshes.Count != other.subMeshes.Count) { throw new Exception("Mismatched submesh count"); } for (int i = 0; i < subMeshes.Count; i++) { subMeshes[i].Add(other.subMeshes[i]); } } public int NumSubMeshes() { return subMeshes.Count; } public bool HasUvs() { return hasUvs; } public bool HasColours() { return hasColours; } public List<CuttableSubMesh> GetSubMeshes() { return subMeshes; } public CuttableSubMesh GetSubMesh(int index) { return subMeshes[index]; } public Transform GetTransform() { if ((Object)(object)inputMeshRenderer != (Object)null) { return ((Component)inputMeshRenderer).transform; } return null; } public MeshRenderer ConvertToRenderer(string newObjectName) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_003d: 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_005d: 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_0097: 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) Mesh val = CreateMesh(); if (val.vertexCount == 0) { return null; } GameObject val2 = new GameObject(newObjectName); val2.transform.SetParent(((Component)inputMeshRenderer).transform); val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.identity; val2.transform.localScale = Vector3.one; MeshFilter val3 = val2.AddComponent<MeshFilter>(); val3.mesh = val; MeshRenderer val4 = val2.AddComponent<MeshRenderer>(); ((Renderer)val4).shadowCastingMode = ((Renderer)inputMeshRenderer).shadowCastingMode; ((Renderer)val4).reflectionProbeUsage = ((Renderer)inputMeshRenderer).reflectionProbeUsage; ((Renderer)val4).lightProbeUsage = ((Renderer)inputMeshRenderer).lightProbeUsage; ((Renderer)val4).sharedMaterials = ((Renderer)inputMeshRenderer).sharedMaterials; return val4; } public Mesh CreateMesh() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown Mesh val = new Mesh(); int num = 0; for (int i = 0; i < subMeshes.Count; i++) { num += subMeshes[i].NumIndices(); } List<Vector3> list = new List<Vector3>(); List<Vector3> list2 = new List<Vector3>(); List<Color32> list3 = ((!hasColours) ? null : new List<Color32>()); List<Vector2> list4 = ((!hasUvs) ? null : new List<Vector2>()); List<Vector2> list5 = ((!hasUv1s) ? null : new List<Vector2>()); List<int> list6 = new List<int>(); foreach (CuttableSubMesh subMesh in subMeshes) { list6.Add(list.Count); subMesh.AddTo(list, list2, list3, list4, list5); } val.vertices = list.ToArray(); val.normals = list2.ToArray(); val.colors32 = ((!hasColours) ? null : list3.ToArray()); val.uv = ((!hasUvs) ? null : list4.ToArray()); val.uv2 = ((!hasUv1s) ? null : list5.ToArray()); val.subMeshCount = subMeshes.Count; for (int j = 0; j < subMeshes.Count; j++) { CuttableSubMesh cuttableSubMesh = subMeshes[j]; int num2 = list6[j]; int[] array = cuttableSubMesh.GenIndices(); for (int k = 0; k < array.Length; k++) { array[k] += num2; } val.SetTriangles(array, j, true); } return val; } } public class CuttableSubMesh { private List<Vector3> vertices; private List<Vector3> normals; private List<Color32> colours; private List<Vector2> uvs; private List<Vector2> uv1s; public CuttableSubMesh(bool hasNormals, bool hasColours, bool hasUvs, bool hasUv1) { vertices = new List<Vector3>(); if (hasNormals) { normals = new List<Vector3>(); } if (hasColours) { colours = new List<Color32>(); } if (hasUvs) { uvs = new List<Vector2>(); } if (hasUv1) { uv1s = new List<Vector2>(); } } public CuttableSubMesh(int[] indices, Vector3[] inputVertices, Vector3[] inputNormals, Color32[] inputColours, Vector2[] inputUvs, Vector2[] inputUv1) { //IL_0099: 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_00de: 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_0124: Unknown result type (might be due to invalid IL or missing references) vertices = new List<Vector3>(); if (inputNormals != null && inputNormals.Length > 0) { normals = new List<Vector3>(); } if (inputColours != null && inputColours.Length > 0) { colours = new List<Color32>(); } if (inputUvs != null && inputUvs.Length > 0) { uvs = new List<Vector2>(); } if (inputUv1 != null && inputUv1.Length > 0) { uv1s = new List<Vector2>(); } foreach (int num in indices) { vertices.Add(inputVertices[num]); if (normals != null) { normals.Add(inputNormals[num]); } if (colours != null) { colours.Add(inputColours[num]); } if (uvs != null) { uvs.Add(inputUvs[num]); } if (uv1s != null) { uv1s.Add(inputUv1[num]); } } } public void Add(CuttableSubMesh other) { for (int i = 0; i < other.vertices.Count; i++) { CopyVertex(i, other); } } public int NumVertices() { return vertices.Count; } public Vector3 GetVertex(int index) { //IL_0008: 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_0013: Unknown result type (might be due to invalid IL or missing references) return vertices[index]; } public bool HasNormals() { return normals != null; } public bool HasColours() { return colours != null; } public bool HasUvs() { return uvs != null; } public bool HasUv1() { return uv1s != null; } public void CopyVertex(int srcIndex, CuttableSubMesh srcMesh) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0096: Unknown result type (might be due to invalid IL or missing references) vertices.Add(srcMesh.vertices[srcIndex]); if (normals != null) { normals.Add(srcMesh.normals[srcIndex]); } if (colours != null) { colours.Add(srcMesh.colours[srcIndex]); } if (uvs != null) { uvs.Add(srcMesh.uvs[srcIndex]); } if (uv1s != null) { uv1s.Add(srcMesh.uv1s[srcIndex]); } } public void AddInterpolatedVertex(int i0, int i1, float weight, CuttableSubMesh srcMesh) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_003f: 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_0052: 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_005a: 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_008a: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) Vector3 vertex = srcMesh.GetVertex(i0); Vector3 vertex2 = srcMesh.GetVertex(i1); vertices.Add(Vector3.Lerp(vertex, vertex2, weight)); if (normals != null) { List<Vector3> list = normals; Vector3 val = Vector3.Lerp(srcMesh.normals[i0], srcMesh.normals[i1], weight); list.Add(((Vector3)(ref val)).normalized); } if (colours != null) { colours.Add(Color32.Lerp(srcMesh.colours[i0], srcMesh.colours[i1], weight)); } if (uvs != null) { uvs.Add(Vector2.Lerp(srcMesh.uvs[i0], srcMesh.uvs[i1], weight)); } if (uv1s != null) { uv1s.Add(Vector2.Lerp(srcMesh.uv1s[i0], srcMesh.uv1s[i1], weight)); } } public void AddTo(List<Vector3> destVertices, List<Vector3> destNormals, List<Color32> destColours, List<Vector2> destUvs, List<Vector2> destUv1s) { destVertices.AddRange(vertices); if (normals != null) { destNormals.AddRange(normals); } if (colours != null) { destColours.AddRange(colours); } if (uvs != null) { destUvs.AddRange(uvs); } if (uv1s != null) { destUv1s.AddRange(uv1s); } } public int NumIndices() { return vertices.Count; } public int[] GenIndices() { int[] array = new int[vertices.Count]; for (int i = 0; i < array.Length; i++) { array[i] = i; } return array; } } public enum VertexClassification { Front = 1, Back = 2, OnPlane = 4 } public class MeshCutter { private CuttableMesh inputMesh; private List<CuttableSubMesh> outputFrontSubMeshes; private List<CuttableSubMesh> outputBackSubMeshes; public void Cut(CuttableMesh input, Plane worldCutPlane) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0048: 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_0059: 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_008a: Unknown result type (might be due to invalid IL or missing references) inputMesh = input; outputFrontSubMeshes = new List<CuttableSubMesh>(); outputBackSubMeshes = new List<CuttableSubMesh>(); Transform transform = inputMesh.GetTransform(); Plane cutPlane = default(Plane); if ((Object)(object)transform != (Object)null) { Vector3 val = transform.InverseTransformPoint(ClosestPointOnPlane(worldCutPlane, Vector3.zero)); Vector3 val2 = transform.InverseTransformDirection(((Plane)(ref worldCutPlane)).normal); ((Plane)(ref cutPlane))..ctor(val2, val); } else { cutPlane = worldCutPlane; } foreach (CuttableSubMesh subMesh in input.GetSubMeshes()) { Cut(subMesh, cutPlane); } } private static Vector3 ClosestPointOnPlane(Plane plane, Vector3 point) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_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_0018: 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_0021: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) float distanceToPoint = ((Plane)(ref plane)).GetDistanceToPoint(point); if (((Plane)(ref plane)).GetSide(point)) { return point - ((Plane)(ref plane)).normal * distanceToPoint; } return point + ((Plane)(ref plane)).normal * distanceToPoint; } public CuttableMesh GetFrontOutput() { return new CuttableMesh(inputMesh, outputFrontSubMeshes); } public CuttableMesh GetBackOutput() { return new CuttableMesh(inputMesh, outputBackSubMeshes); } private void Cut(CuttableSubMesh inputSubMesh, Plane cutPlane) { //IL_004f: 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_0063: 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_006b: 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_0076: 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_0081: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: 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_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) bool hasNormals = inputSubMesh.HasNormals(); bool hasColours = inputSubMesh.HasColours(); bool hasUvs = inputSubMesh.HasUvs(); bool hasUv = inputSubMesh.HasUv1(); CuttableSubMesh cuttableSubMesh = new CuttableSubMesh(hasNormals, hasColours, hasUvs, hasUv); CuttableSubMesh cuttableSubMesh2 = new CuttableSubMesh(hasNormals, hasColours, hasUvs, hasUv); for (int i = 0; i < inputSubMesh.NumVertices(); i += 3) { int num = i; int num2 = i + 1; int num3 = i + 2; Vector3 vertex = inputSubMesh.GetVertex(num); Vector3 vertex2 = inputSubMesh.GetVertex(num2); Vector3 vertex3 = inputSubMesh.GetVertex(num3); VertexClassification vertexClassification = Classify(vertex, cutPlane); VertexClassification vertexClassification2 = Classify(vertex2, cutPlane); VertexClassification vertexClassification3 = Classify(vertex3, cutPlane); int numFront = 0; int numBehind = 0; CountSides(vertexClassification, ref numFront, ref numBehind); CountSides(vertexClassification2, ref numFront, ref numBehind); CountSides(vertexClassification3, ref numFront, ref numBehind); if (numFront > 0 && numBehind == 0) { KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh); } else if (numFront == 0 && numBehind > 0) { KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh2); } else if (numFront == 2 && numBehind == 1) { if (vertexClassification == VertexClassification.Back) { SplitA(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh); } else if (vertexClassification2 == VertexClassification.Back) { SplitA(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh); } else { SplitA(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh2, cuttableSubMesh); } } else if (numFront == 1 && numBehind == 2) { if (vertexClassification == VertexClassification.Front) { SplitA(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2); } else if (vertexClassification2 == VertexClassification.Front) { SplitA(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2); } else { SplitA(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2); } } else if (numFront == 1 && numBehind == 1) { if (vertexClassification == VertexClassification.OnPlane) { if (vertexClassification3 == VertexClassification.Front) { SplitB(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2); } else { SplitBFlipped(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2); } continue; } switch (vertexClassification2) { case VertexClassification.OnPlane: if (vertexClassification == VertexClassification.Front) { SplitB(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2); } else { SplitBFlipped(num3, num, num2, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2); } break; case VertexClassification.Front: SplitB(num2, num3, num, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2); break; default: SplitBFlipped(num, num2, num3, inputSubMesh, cutPlane, cuttableSubMesh, cuttableSubMesh2); break; } } else if (numFront == 0 && numBehind == 0) { Vector3 val = vertex2 - vertex; Vector3 val2 = vertex3 - vertex; Vector3 val3 = Vector3.Cross(val, val2); if (Vector3.Dot(val3, ((Plane)(ref cutPlane)).normal) > 0f) { KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh2); } else { KeepTriangle(num, num2, num3, inputSubMesh, cuttableSubMesh); } } } outputFrontSubMeshes.Add(cuttableSubMesh); outputBackSubMeshes.Add(cuttableSubMesh2); } private VertexClassification Classify(Vector3 vertex, Plane cutPlane) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(vertex.x, vertex.y, vertex.z); float distanceToPoint = ((Plane)(ref cutPlane)).GetDistanceToPoint(val); double num = 9.999999747378752E-06; if ((double)distanceToPoint > 0.0 - num && (double)distanceToPoint < num) { return VertexClassification.OnPlane; } if (distanceToPoint > 0f) { return VertexClassification.Front; } return VertexClassification.Back; } private void CountSides(VertexClassification c, ref int numFront, ref int numBehind) { switch (c) { case VertexClassification.Front: numFront++; break; case VertexClassification.Back: numBehind++; break; } } private void KeepTriangle(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, CuttableSubMesh destSubMesh) { destSubMesh.CopyVertex(i0, inputSubMesh); destSubMesh.CopyVertex(i1, inputSubMesh); destSubMesh.CopyVertex(i2, inputSubMesh); } private void SplitA(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, Plane cutPlane, CuttableSubMesh frontSubMesh, CuttableSubMesh backSubMesh) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_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_001d: 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_001f: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) Vector3 vertex = inputSubMesh.GetVertex(i0); Vector3 vertex2 = inputSubMesh.GetVertex(i1); Vector3 vertex3 = inputSubMesh.GetVertex(i2); CalcIntersection(vertex, vertex2, cutPlane, out var weight); CalcIntersection(vertex3, vertex, cutPlane, out var weight2); frontSubMesh.CopyVertex(i0, inputSubMesh); frontSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh); frontSubMesh.AddInterpolatedVertex(i2, i0, weight2, inputSubMesh); backSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh); backSubMesh.CopyVertex(i1, inputSubMesh); backSubMesh.CopyVertex(i2, inputSubMesh); backSubMesh.CopyVertex(i2, inputSubMesh); backSubMesh.AddInterpolatedVertex(i2, i0, weight2, inputSubMesh); backSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh); } private void SplitB(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, Plane cutPlane, CuttableSubMesh frontSubMesh, CuttableSubMesh backSubMesh) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Vector3 vertex = inputSubMesh.GetVertex(i0); Vector3 vertex2 = inputSubMesh.GetVertex(i2); CalcIntersection(vertex2, vertex, cutPlane, out var weight); frontSubMesh.CopyVertex(i0, inputSubMesh); frontSubMesh.CopyVertex(i1, inputSubMesh); frontSubMesh.AddInterpolatedVertex(i2, i0, weight, inputSubMesh); backSubMesh.CopyVertex(i1, inputSubMesh); backSubMesh.CopyVertex(i2, inputSubMesh); backSubMesh.AddInterpolatedVertex(i2, i0, weight, inputSubMesh); } private void SplitBFlipped(int i0, int i1, int i2, CuttableSubMesh inputSubMesh, Plane cutPlane, CuttableSubMesh frontSubMesh, CuttableSubMesh backSubMesh) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Vector3 vertex = inputSubMesh.GetVertex(i0); Vector3 vertex2 = inputSubMesh.GetVertex(i1); CalcIntersection(vertex, vertex2, cutPlane, out var weight); frontSubMesh.CopyVertex(i0, inputSubMesh); frontSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh); frontSubMesh.CopyVertex(i2, inputSubMesh); backSubMesh.CopyVertex(i1, inputSubMesh); backSubMesh.CopyVertex(i2, inputSubMesh); backSubMesh.AddInterpolatedVertex(i0, i1, weight, inputSubMesh); } private Vector3 CalcIntersection(Vector3 v0, Vector3 v1, Plane plane, out float weight) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: 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_0013: 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_0016: 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_002d: 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_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_0044: 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_004e: 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) Vector3 val = v1 - v0; float magnitude = ((Vector3)(ref val)).magnitude; Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(v0, val / magnitude); float num = default(float); ((Plane)(ref plane)).Raycast(val2, ref num); Vector3 result = ((Ray)(ref val2)).origin + ((Ray)(ref val2)).direction * num; weight = num / magnitude; return result; } }
Modmas2025Scripts.dll
Decompiled a week agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using Atlas; using BepInEx.Bootstrap; using FistVR; using Microsoft.CodeAnalysis; using UnityEngine; using Valve.VR; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyCompany("Modmas2025Scripts")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Modmas2025Scripts")] [assembly: AssemblyTitle("Modmas2025Scripts")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] 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; } } } namespace Modmas2025 { public class AtlasPortal : MonoBehaviour { private bool teleporting; public string sceneFileName; private CustomSceneInfo? sceneInfo; private void OnTriggerEnter(Collider other) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) if (teleporting) { return; } Debug.Log((object)((Object)((Component)other).gameObject).name); if ((Object)(object)((Component)other).GetComponent<HeadTriggerDetect>() != (Object)null) { sceneInfo = AtlasPlugin.GetCustomScene(sceneFileName); if (sceneInfo != null) { teleporting = true; SteamVR_Fade.Start(Color.black, 0.5f, false); ((MonoBehaviour)this).Invoke("DelayedSceneLoad", 0.5f); } } } public void DelayedSceneLoad() { AtlasPlugin.LoadCustomScene(sceneInfo); } } public class CrankHandle : FVRInteractiveObject { public MagicMirror mirror; [NonSerialized] public float lastrot; [NonSerialized] public float currot; [NonSerialized] public float m_rotTilShot = 180f; [NonSerialized] public int date = 1; [Header("Dials Related")] public GameObject crankobjroot; public AudioEvent ding; public float[] rot1; public float[] rot2; public GameObject wheel1; public GameObject wheel2; [HideInInspector] public bool isDateAvailable; public GameObject lightOff; public GameObject lightOn; public override void Awake() { ((FVRInteractiveObject)this).Awake(); } public override void OnDestroy() { ((FVRInteractiveObject)this).OnDestroy(); } private void FixedUpdate() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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 (((FVRInteractiveObject)this).IsHeld) { AxisLookAt(((Component)this).gameObject.transform, ((Component)base.m_hand).gameObject.transform.position, Vector3.forward); } currot = ((Component)this).gameObject.transform.localEulerAngles.y; float num = Mathf.DeltaAngle(lastrot, currot); lastrot = currot; m_rotTilShot -= num; if (m_rotTilShot < 0f) { SM.PlayCoreSound((FVRPooledAudioType)0, ding, ((Component)this).transform.position); if ((Object)(object)base.m_hand != (Object)null) { base.m_hand.Buzz(base.m_hand.Buzzer.Buzz_BeginInteraction); } if (date < 24) { date++; } else if (date >= 24) { date = 1; } m_rotTilShot = 360f; } if (m_rotTilShot > 360f) { SM.PlayCoreSound((FVRPooledAudioType)41, ding, ((Component)this).gameObject.transform.position); if ((Object)(object)base.m_hand != (Object)null) { base.m_hand.Buzz(base.m_hand.Buzzer.Buzz_BeginInteraction); } if (date > 1) { date--; } else if (date <= 1) { date = 24; } m_rotTilShot = 0f; } wheel1.transform.localEulerAngles = new Vector3(Mathf.Lerp(wheel1.transform.localEulerAngles.x, rot1[date - 1], 1f), 0f, 0f); wheel2.transform.localEulerAngles = new Vector3(Mathf.Lerp(wheel2.transform.localEulerAngles.x, rot2[date - 1], 1f), 0f, 0f); isDateAvailable = date <= mirror.GetDateCount(); if (isDateAvailable && !mirror.isBroken) { lightOn.SetActive(true); lightOff.SetActive(false); } else { lightOn.SetActive(false); lightOff.SetActive(true); } } private void AxisLookAt(Transform tr_self, Vector3 lookPos, Vector3 directionAxis) { //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_0013: 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_001a: 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_0021: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0041: 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_0061: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = tr_self.rotation; Vector3 val = lookPos - tr_self.position; Vector3 val2 = tr_self.rotation * directionAxis; Vector3 val3 = Vector3.Cross(val2, val); Vector3 normalized = ((Vector3)(ref val3)).normalized; float num = Vector3.Angle(val2, val); tr_self.rotation = Quaternion.AngleAxis(num, normalized) * rotation; tr_self.localEulerAngles = new Vector3(0f, tr_self.localEulerAngles.y, 0f); } } public static class JsonHelper { [Serializable] private class Wrapper<T> { public T[] items; } public static T[] FromJson<T>(string json) { return JsonUtility.FromJson<Wrapper<T>>(json).items; } public static string ToJson<T>(T[] array) { return JsonUtility.ToJson((object)new Wrapper<T> { items = array }); } public static string ToJson<T>(T[] array, bool prettyPrint) { return JsonUtility.ToJson((object)new Wrapper<T> { items = array }, prettyPrint); } } public class MagicMirror : MonoBehaviour, IFVRDamageable { [Serializable] public struct MirrorParticles { public ParticleSystem particles_Shatter; public ParticleSystem particles_ColdAir; public ParticleSystem particles_Repairing; public ParticleSystem particles_FinishRepair; } [Serializable] public struct MirrorAudio { public AudioSource loop_PortalHum; public AudioEvent sound_Shatter; public AudioEvent sound_SpawnItem; public AudioEvent sound_ActivateShard; public AudioEvent sound_AttachShard; public AudioEvent sound_RepairMirror; } [Serializable] internal class Date { public bool isMapTransition; public MirrorItemSpawnData[] itemsToSpawn; public int mapProbeAnchorIndex = -1; public string mapName = ""; } [Serializable] internal class MirrorItemSpawnData { public string itemName; public uint itemCount = 1u; [Tooltip("Time until the item after this one spawns.")] public float spawnDelay = 0.5f; } [CompilerGenerated] private sealed class <AddItemsToQueue>d__78 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public MagicMirror <>4__this; public int _adjustedDate; private float <prevSpawnDelay>5__2; private int <i>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AddItemsToQueue>d__78(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { int num = <>1__state; MagicMirror magicMirror = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; if (magicMirror.dates[_adjustedDate].isMapTransition) { return false; } magicMirror.isLoadingAssets = true; if (magicMirror.dates[_adjustedDate] == null || magicMirror.dates[_adjustedDate].itemsToSpawn.Count() == 0) { Debug.LogError((object)"Current date is missing or has no items to spawn!"); } <prevSpawnDelay>5__2 = 0f; <i>5__3 = 0; break; case 1: { <>1__state = -1; for (int i = 0; i < magicMirror.dates[_adjustedDate].itemsToSpawn[<i>5__3].itemCount; i++) { magicMirror.itemSpawnQueue.Enqueue(new KeyValuePair<GameObject, float>(magicMirror.itemLoader.Result, <prevSpawnDelay>5__2)); <prevSpawnDelay>5__2 = magicMirror.dates[_adjustedDate].itemsToSpawn[<i>5__3].spawnDelay; } <i>5__3++; break; } } if (<i>5__3 < magicMirror.dates[_adjustedDate].itemsToSpawn.Length) { magicMirror.itemLoader = ((AnvilAsset)IM.OD[magicMirror.dates[_adjustedDate].itemsToSpawn[<i>5__3].itemName]).GetGameObjectAsync(); <>2__current = magicMirror.itemLoader; <>1__state = 1; return true; } magicMirror.isLoadingAssets = false; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <MirrorRepairBuildup>d__80 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public MagicMirror <>4__this; private float <repairTimer>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <MirrorRepairBuildup>d__80(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0033: 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) int num = <>1__state; MagicMirror magicMirror = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; if (!(<repairTimer>5__2 < magicMirror.mirrorRepairDelay)) { magicMirror.RepairMirror(); return false; } } else { <>1__state = -1; SM.PlayCoreSound((FVRPooledAudioType)0, magicMirror.mirrorAudio.sound_RepairMirror, ((Component)magicMirror).transform.position); EmissionModule emission = magicMirror.mirrorParticles.particles_ColdAir.emission; ((EmissionModule)(ref emission)).enabled = false; <repairTimer>5__2 = 0f; } <repairTimer>5__2 += Time.deltaTime; magicMirror.mirrorLight.intensity = Mathf.Lerp(magicMirror.lightIntensity_broken, magicMirror.lightIntensity_repairing, <repairTimer>5__2 / magicMirror.mirrorRepairDelay); <>2__current = null; <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PrewarmItems>d__69 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public MagicMirror <>4__this; private List<string>.Enumerator <>7__wrap1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PrewarmItems>d__69(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 2) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = default(List<string>.Enumerator); <>1__state = -2; } private bool MoveNext() { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) try { int num = <>1__state; MagicMirror magicMirror = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = null; <>1__state = 1; return true; case 1: { <>1__state = -1; magicMirror.isPrewarming = true; List<string> list = new List<string>(); for (int i = 0; i < magicMirror.dates.Length; i++) { for (int j = 0; j < magicMirror.dates[i].itemsToSpawn.Length; j++) { if (!list.Contains(magicMirror.dates[i].itemsToSpawn[j].itemName)) { list.Add(magicMirror.dates[i].itemsToSpawn[j].itemName.Trim()); } } } <>7__wrap1 = list.GetEnumerator(); <>1__state = -3; break; } case 2: <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { string current = <>7__wrap1.Current; if (IM.OD.TryGetValue(current, out var _)) { magicMirror.itemLoader = ((AnvilAsset)IM.OD[current]).GetGameObjectAsync(); Object.Destroy((Object)(object)Object.Instantiate<GameObject>(magicMirror.itemLoader.Result, new Vector3(0f, -100f, 0f), Quaternion.identity)); } else { Debug.LogError((object)("Key " + current + " does not correspond to a value!")); } <>2__current = magicMirror.itemLoader; <>1__state = 2; return true; } <>m__Finally1(); <>7__wrap1 = default(List<string>.Enumerator); magicMirror.isPrewarming = false; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>7__wrap1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public CrankHandle crank; private int curDate; public GameObject mirrorCollider; public GameObject playerOnlyCollider; [Header("Shard Params")] public GameObject IntactMirror; [SerializeField] private MirrorShardSet[] mirrorShardSets; public Material glassMaterial; private int currentShardSet; private int shardsSnappedToMirror; public float timeUntilAntiOrbit = 3f; public float timeUntilMassIncrease = 10f; public float timeUntilNoColShards = 20f; public float timeUntilForceReset = 30f; [Header("Physics Params")] [Tooltip("The backwards force applied to every shard on shattering")] public float baseShardPushForceMult = 1f; [Tooltip("Adds variety to the base push force applied to each shard")] public float baseShardPushForceVariance = 0.2f; [Tooltip("Moves impact point inwards a set amount for a better looking shatter effect")] public float impactPointInwardShift = 0.5f; [Tooltip("The radius of the explosion force added to the mirror on shatter")] public float impactExplosionForceRadius = 2f; [Tooltip("How long the mirror waits after the last gift before the mirror shards activate")] public float shardActivationDelay = 3f; [Tooltip("Special case: how long the mirror waits for the player to enter the map")] public float shardActivationDelay_Map = 30f; [Tooltip("Adds variance for when the shards activate")] public float shardActivationDelayVariance = 0.3f; [Tooltip("The force applied to the shards per physics tick when activated")] public float shardConstantPushForce = 50f; [Tooltip("The force that pushes the shards up when they're activated")] public float shardActivationAscentForce = 1f; [Tooltip("Adds a slight delay to the push force after ascending for visual flair")] public float shardDelayAfterAscent = 0.5f; [Tooltip("How aggressively the shard will redirect towards its origin point")] public float shardVectorDampeningMult = 2f; [Tooltip("How quickly the shard rotates towards its starting angle")] public float shardRotationMult = 1f; [Tooltip("If shard is closer than this to its origin, snap to it")] public float shardSnapDistanceThreshold = 0.15f; [Header("Damage Params")] public float debugDamage = 1000f; public Transform debugImpactPoint; public float mirrorDamageThreshold = 2f; public float maxMirrorDamage = 10f; public float minDamagePushForce = 100f; public float maxDamagePushForce = 500f; [Header("Gift Params")] public Transform objectSpawnPoint; [Tooltip("The time between the mirror being broken and the first item being dispensed")] public float timeBeforeGiftsStartSpawning = 2f; public Vector3 giftEjectionSpeed; public float giftSpinSpeed = 20f; [SerializeField] private Date[] dates; private AnvilCallback<GameObject> itemLoader; private Queue<KeyValuePair<GameObject, float>> itemSpawnQueue = new Queue<KeyValuePair<GameObject, float>>(); private bool isPrewarming; private bool isLoadingAssets; private bool isSpawningItems; [Header("Map Transition Params")] [Tooltip("The reflection probe that the mirror anchors to")] public ReflectionProbe anchorProbe; [Tooltip("The cubemap that the anchor probe uses by default")] public Cubemap defaultCubemap; [Tooltip("0 on a date's mapProbeAnchorIndex is the zeroth object in this array")] public Cubemap[] cubemaps; public AtlasPortal mapTeleporter; public MeshRenderer reflectionRenderer; public MeshRenderer portalRenderer; public Material portalMaterial; public Material portalMaterial_half; [Header("FX Params")] public MirrorParticles mirrorParticles; [Tooltip("The time between all shards reaching the mirror and the mirror repairing itself.")] public float mirrorRepairDelay = 1f; public Light mirrorLight; public float lightIntensity_broken = 1f; public float lightIntensity_repairing = 4f; public MirrorAudio mirrorAudio; [Header("BepInEx Params")] public string jsonFileName = "modmas2025items.json"; public string pluginDictionaryString = "Modmas2025.Modmas_2025"; public bool debugDoLoadFromJson; public bool debugDoSaveToJson; public bool isBroken { get; private set; } private void Awake() { if (debugDoSaveToJson) { SaveToJson(); } LoadFromJson(); if (!Application.isEditor) { ((MonoBehaviour)this).StartCoroutine(PrewarmItems()); } for (int i = 0; i < mirrorShardSets.Length; i++) { mirrorShardSets[i].InitShardSet(this); mirrorShardSets[i].setParent.SetActive(false); } } private void LoadFromJson() { if (Application.isEditor) { if (debugDoLoadFromJson) { string json = File.ReadAllText(Application.dataPath + jsonFileName); dates = JsonHelper.FromJson<Date>(json); } return; } Chainloader.PluginInfos.TryGetValue(pluginDictionaryString, out var value); string directoryName = Path.GetDirectoryName(value.Location); Debug.Log((object)("Current file path is " + directoryName + jsonFileName)); if (File.Exists(directoryName + jsonFileName)) { string json2 = File.ReadAllText(directoryName + jsonFileName); dates = JsonHelper.FromJson<Date>(json2); } else { Debug.LogError((object)"Modmas item .json missing, please reinstall!"); dates = new Date[0]; } } private void SaveToJson() { if (Application.isEditor) { string contents = JsonHelper.ToJson(dates, prettyPrint: true); File.WriteAllText(Application.dataPath + "/modmas2025items.json", contents); } } private IEnumerator PrewarmItems() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PrewarmItems>d__69(0) { <>4__this = this }; } private void Update() { if (isPrewarming) { return; } if (Application.isEditor && Input.GetKeyDown((KeyCode)98)) { if (isBroken) { RepairMirror(); } else { DestroyMirrorDebug(debugDamage, 1); } } if (isBroken && itemSpawnQueue.Count > 0 && !isLoadingAssets && !isSpawningItems) { ((MonoBehaviour)this).Invoke("SpawnGift", timeBeforeGiftsStartSpawning); isSpawningItems = true; } } private void SpawnGift() { //IL_002f: 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_00b9: 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_009c: Unknown result type (might be due to invalid IL or missing references) if (itemSpawnQueue.Count > 0) { Rigidbody component = Object.Instantiate<GameObject>(itemSpawnQueue.Dequeue().Key, ((Component)objectSpawnPoint).transform.position, ((Component)objectSpawnPoint).transform.rotation).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.AddForce(giftEjectionSpeed, (ForceMode)2); component.AddTorque(new Vector3(Random.Range(0f - giftSpinSpeed, giftSpinSpeed), Random.Range(0f - giftSpinSpeed, giftSpinSpeed), Random.Range(0f - giftSpinSpeed, giftSpinSpeed)), (ForceMode)2); } SM.PlayCoreSound((FVRPooledAudioType)0, mirrorAudio.sound_SpawnItem, ((Component)this).transform.position); if (itemSpawnQueue.Count > 0) { ((MonoBehaviour)this).Invoke("SpawnGift", itemSpawnQueue.Peek().Value); return; } } StartCountdown(); } public void Damage(Damage _dam) { if (crank.isDateAvailable && _dam.Dam_TotalKinetic + _dam.Dam_TotalEnergetic >= mirrorDamageThreshold) { DestroyMirror(_dam, crank.date); } } private void DestroyMirrorDebug(float _debugDamage, int _date) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0014: 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) Damage val = new Damage(); val.Dam_TotalKinetic = _debugDamage; val.point = debugImpactPoint.position; DestroyMirror(val, _date); } public void DestroyMirror(Damage _dam, int _date) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if (isBroken) { return; } isBroken = true; IntactMirror.SetActive(false); curDate = _date; currentShardSet = Random.Range(0, mirrorShardSets.Length); mirrorShardSets[currentShardSet].setParent.SetActive(true); mirrorShardSets[currentShardSet].EnableShards(); foreach (MirrorShard mirrorShard in mirrorShardSets[currentShardSet].mirrorShards) { mirrorShard.AddPushForce(_dam.Dam_TotalKinetic, _dam.point); } mirrorParticles.particles_Shatter.Play(); EmissionModule emission = mirrorParticles.particles_ColdAir.emission; ((EmissionModule)(ref emission)).enabled = true; mirrorParticles.particles_ColdAir.Play(); SM.PlayCoreSound((FVRPooledAudioType)5, mirrorAudio.sound_Shatter, ((Component)this).transform.position); mirrorAudio.loop_PortalHum.Play(); ((Component)mirrorLight).gameObject.SetActive(true); mirrorLight.intensity = lightIntensity_broken; int num = _date - 1; if (dates[num].isMapTransition) { if (dates[num].mapProbeAnchorIndex > -1) { ((Component)reflectionRenderer).gameObject.SetActive(true); if (cubemaps.Length != 0 && dates[num].mapProbeAnchorIndex > -1) { anchorProbe.bakedTexture = (Texture)(object)cubemaps[dates[num].mapProbeAnchorIndex]; anchorProbe.customBakedTexture = (Texture)(object)cubemaps[dates[num].mapProbeAnchorIndex]; } ((Renderer)portalRenderer).material = portalMaterial_half; ((Component)mapTeleporter).GetComponent<Collider>().enabled = true; mapTeleporter.sceneFileName = dates[num].mapName; } StartCountdown(); } else if (dates[num].itemsToSpawn.Count() == 0 || Application.isEditor) { StartCountdown(); } else { AnvilManager.Run(AddItemsToQueue(num)); } } private void StartCountdown() { isSpawningItems = false; foreach (MirrorShard mirrorShard in mirrorShardSets[currentShardSet].mirrorShards) { mirrorShard.SetShardState(MirrorShard.ShardState.Countdown); } } public int GetDateCount() { return dates.Length; } public bool isCurDateAMap() { return dates[(curDate > 0) ? (curDate - 1) : (crank.date - 1)].isMapTransition; } private IEnumerator AddItemsToQueue(int _adjustedDate) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AddItemsToQueue>d__78(0) { <>4__this = this, _adjustedDate = _adjustedDate }; } public void CheckMirrorIntegrity() { //IL_0019: 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) shardsSnappedToMirror++; EmissionModule emission = mirrorParticles.particles_ColdAir.emission; ((EmissionModule)(ref emission)).enabled = false; if (shardsSnappedToMirror >= mirrorShardSets[currentShardSet].mirrorShards.Count) { if (!Application.isEditor) { AnvilManager.Run(MirrorRepairBuildup()); } else { ((MonoBehaviour)this).StartCoroutine(MirrorRepairBuildup()); } } } private IEnumerator MirrorRepairBuildup() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <MirrorRepairBuildup>d__80(0) { <>4__this = this }; } private void RepairMirror() { if (isBroken) { isBroken = false; mirrorShardSets[currentShardSet].DebugResetShards(); mirrorShardSets[currentShardSet].setParent.SetActive(false); IntactMirror.SetActive(true); shardsSnappedToMirror = 0; mirrorAudio.loop_PortalHum.Pause(); ((Component)mirrorLight).gameObject.SetActive(false); if ((Object)(object)defaultCubemap != (Object)null) { anchorProbe.bakedTexture = (Texture)(object)defaultCubemap; anchorProbe.customBakedTexture = (Texture)(object)defaultCubemap; } else { anchorProbe.bakedTexture = null; anchorProbe.customBakedTexture = null; } ((Component)reflectionRenderer).gameObject.SetActive(false); mapTeleporter.sceneFileName = ""; ((Component)mapTeleporter).GetComponent<Collider>().enabled = false; ((Renderer)portalRenderer).material = portalMaterial; curDate = 0; } } private void OnTriggerEnter(Collider other) { if ((Object)(object)((Component)other).GetComponent<MirrorShard>() != (Object)null) { MirrorShard component = ((Component)other).GetComponent<MirrorShard>(); if (component.curShardState == MirrorShard.ShardState.Activated) { component.SetShardState(MirrorShard.ShardState.Reset); CheckMirrorIntegrity(); } } } } public class MirrorShard : MonoBehaviour { private struct ShardOriginalPosRot { public Vector3 origPos; public Quaternion origRot; } public enum ShardState { Reset, Enabled, Countdown, Activated } private enum FallbackMode { None, AntiOrbit, MassIncrease, Noclip, ForceReset } private MagicMirror mirror; private float timeUntilActivation; private float timeSpentActivated; private ShardOriginalPosRot shardOriginalTransform; private FallbackMode fallbackMode; private float orbitStrength = 1f; public Rigidbody rigidbody { get; private set; } public ShardState curShardState { get; private set; } public void InitShard(MagicMirror _mirror, Vector3 _position, Quaternion _rotation) { //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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) mirror = _mirror; shardOriginalTransform.origPos = _position; shardOriginalTransform.origRot = _rotation; rigidbody = ((Component)this).GetComponent<Rigidbody>(); if (Application.isEditor) { ((Behaviour)((Component)this).GetComponent<AudioImpactController>()).enabled = false; } } private void Update() { //IL_0113: Unknown result type (might be due to invalid IL or missing references) switch (curShardState) { case ShardState.Countdown: timeUntilActivation -= Time.deltaTime; if (timeUntilActivation <= 0f) { SetShardState(ShardState.Activated); } break; case ShardState.Activated: timeSpentActivated += Time.deltaTime; switch (fallbackMode) { case FallbackMode.None: if (timeSpentActivated >= mirror.timeUntilAntiOrbit) { orbitStrength = 3f; fallbackMode = FallbackMode.AntiOrbit; } break; case FallbackMode.AntiOrbit: if (timeSpentActivated >= mirror.timeUntilMassIncrease) { rigidbody.mass = 100f; fallbackMode = FallbackMode.MassIncrease; } break; case FallbackMode.MassIncrease: if (timeSpentActivated >= mirror.timeUntilNoColShards) { ((Component)this).GetComponent<Collider>().enabled = false; fallbackMode = FallbackMode.Noclip; } break; case FallbackMode.Noclip: if (timeSpentActivated >= mirror.timeUntilForceReset) { fallbackMode = FallbackMode.ForceReset; } break; case FallbackMode.ForceReset: ((Component)this).transform.localPosition = shardOriginalTransform.origPos; timeSpentActivated = 0f; orbitStrength = 1f; rigidbody.mass = 1f; ((Component)this).GetComponent<Collider>().enabled = true; fallbackMode = FallbackMode.None; break; } break; } } private void FixedUpdate() { //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_0038: 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_0044: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00b5: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_0102: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) if (curShardState == ShardState.Activated && timeSpentActivated >= 1f) { Vector3 val = ((Component)mirror).transform.TransformPoint(shardOriginalTransform.origPos); Vector3 val2 = val - ((Component)this).transform.position; Vector3 normalized = ((Vector3)(ref val2)).normalized; rigidbody.AddForce(normalized * mirror.shardConstantPushForce * Time.deltaTime, (ForceMode)5); rigidbody.velocity = Vector3.RotateTowards(rigidbody.velocity, normalized, mirror.shardVectorDampeningMult * Time.deltaTime * orbitStrength, 0f); Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(val.x, val.y, ((Component)this).transform.position.z); rigidbody.AddForce((val3 - ((Component)this).transform.position) * mirror.shardConstantPushForce * Time.deltaTime * 2f, (ForceMode)5); Quaternion val4 = Quaternion.Slerp(Quaternion.identity, ((Component)this).transform.rotation, Time.deltaTime * mirror.shardRotationMult); rigidbody.AddTorque(((Quaternion)(ref val4)).eulerAngles, (ForceMode)5); if (Vector3.Distance(((Component)this).transform.position, val) <= mirror.shardSnapDistanceThreshold && curShardState == ShardState.Activated) { SM.PlayCoreSound((FVRPooledAudioType)0, mirror.mirrorAudio.sound_AttachShard, ((Component)this).transform.position); SetShardState(ShardState.Reset); mirror.CheckMirrorIntegrity(); } } } public void SetShardState(ShardState _state) { //IL_002a: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) switch (_state) { case ShardState.Reset: curShardState = ShardState.Reset; ((Component)this).transform.localPosition = shardOriginalTransform.origPos; ((Component)this).transform.localRotation = shardOriginalTransform.origRot; rigidbody.isKinematic = true; ((Collider)((Component)this).GetComponent<MeshCollider>()).enabled = false; break; case ShardState.Enabled: curShardState = ShardState.Enabled; rigidbody.isKinematic = false; rigidbody.useGravity = true; if (mirror.isCurDateAMap()) { mirror.mirrorCollider.SetActive(false); mirror.playerOnlyCollider.SetActive(false); } else { mirror.mirrorCollider.SetActive(false); } ((Collider)((Component)this).GetComponent<MeshCollider>()).enabled = true; break; case ShardState.Countdown: curShardState = ShardState.Countdown; timeUntilActivation = (mirror.isCurDateAMap() ? mirror.shardActivationDelay_Map : mirror.shardActivationDelay) + Random.Range(0f - mirror.shardActivationDelayVariance, mirror.shardActivationDelayVariance); break; case ShardState.Activated: curShardState = ShardState.Activated; rigidbody.AddForce(Vector3.up * mirror.shardActivationAscentForce, (ForceMode)2); rigidbody.AddRelativeTorque(Vector3.left, (ForceMode)2); timeSpentActivated = 0f; rigidbody.useGravity = false; mirror.mirrorCollider.SetActive(true); mirror.playerOnlyCollider.SetActive(true); SM.PlayCoreSound((FVRPooledAudioType)0, mirror.mirrorAudio.sound_ActivateShard, ((Component)this).transform.position); mirror.mirrorParticles.particles_Repairing.Play(); break; } } public void AddPushForce(float _damage, Vector3 impactPoint) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) rigidbody.AddForce(((Component)mirror).transform.forward * (mirror.baseShardPushForceMult + Random.Range(mirror.baseShardPushForceVariance, 0f - mirror.baseShardPushForceVariance)), (ForceMode)1); float num = Mathf.Lerp(mirror.minDamagePushForce, mirror.maxDamagePushForce, Mathf.InverseLerp(mirror.mirrorDamageThreshold, mirror.maxMirrorDamage, Mathf.Min(_damage, mirror.maxMirrorDamage))); rigidbody.AddExplosionForce(num, impactPoint - ((Component)this).transform.forward * mirror.impactPointInwardShift, mirror.impactExplosionForceRadius); } } [Serializable] public class MirrorShardSet { [Tooltip("The parent object of all the shards. This is to make setup less tedious.")] public GameObject setParent; private MagicMirror mirror; public List<MirrorShard> mirrorShards { get; private set; } public void InitShardSet(MagicMirror _mirror) { //IL_00db: 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) mirror = _mirror; mirrorShards = new List<MirrorShard>(); for (int i = 0; i < setParent.transform.childCount; i++) { GameObject gameObject = ((Component)setParent.transform.GetChild(i)).gameObject; if ((Object)(object)gameObject.GetComponent<MeshCollider>() == (Object)null) { gameObject.AddComponent<MeshCollider>(); } gameObject.GetComponent<MeshCollider>().convex = true; if ((Object)(object)gameObject.GetComponent<MeshRenderer>() != (Object)null) { ((Renderer)gameObject.GetComponent<MeshRenderer>()).material = mirror.glassMaterial; } Rigidbody val = null; val = ((!((Object)(object)gameObject.GetComponent<Rigidbody>() == (Object)null)) ? gameObject.GetComponent<Rigidbody>() : gameObject.AddComponent<Rigidbody>()); val.angularDrag = 0f; val.isKinematic = true; val.useGravity = false; MirrorShard mirrorShard = null; mirrorShard = ((!((Object)(object)gameObject.GetComponent<MirrorShard>() == (Object)null)) ? gameObject.GetComponent<MirrorShard>() : gameObject.AddComponent<MirrorShard>()); mirrorShard.InitShard(mirror, gameObject.transform.localPosition, gameObject.transform.localRotation); mirrorShards.Add(mirrorShard); } } public void EnableShards() { for (int i = 0; i < mirrorShards.Count; i++) { mirrorShards[i].SetShardState(MirrorShard.ShardState.Enabled); } } public void DebugResetShards() { for (int i = 0; i < mirrorShards.Count; i++) { mirrorShards[i].SetShardState(MirrorShard.ShardState.Reset); } } } internal static class PluginInfo { internal const string NAME = "Modmas2025 Scripts"; internal const string GUID = "modmas2025.modmas2025scripts"; internal const string VERSION = "1.0.1"; } }
Fingolian_Sosigs.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using OtherLoader; using UnityEngine; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace Billiam_J_McHooligan.Fingolian_Sosigs; [BepInPlugin("Billiam_J_McHooligan.Fingolian_Sosigs", "Fingolian_Sosigs", "1.0.0")] [BepInProcess("h3vr.exe")] [Description("Built with MeatKit")] [BepInDependency("h3vr.otherloader", "1.3.0")] public class Fingolian_SosigsPlugin : BaseUnityPlugin { private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); internal static ManualLogSource Logger; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; LoadAssets(); } private void LoadAssets() { Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Billiam_J_McHooligan.Fingolian_Sosigs"); OtherLoader.RegisterDirectLoad(BasePath, "Billiam_J_McHooligan.Fingolian_Sosigs", "", "", "fingolia", ""); } } public enum ControlMode { simple = 1, touch } public class VehicleControl : MonoBehaviour { [Serializable] public class CarWheels { public ConnectWheel wheels; } [Serializable] public class ConnectWheel { public bool frontWheelDrive = true; public Transform frontRight; public Transform frontLeft; public WheelSetting frontSetting; public bool backWheelDrive = true; public Transform backRight; public Transform backLeft; public WheelSetting rearSetting; } [Serializable] public class WheelSetting { public float Radius = 0.4f; public float Weight = 1000f; public float Distance = 0.2f; } [Serializable] public class CarLights { public Light[] brakeLights; public Light[] reverseLights; } [Serializable] public class CarSounds { public AudioSource IdleEngine; public AudioSource LowEngine; public AudioSource HighEngine; public float minPitch = 1f; public float maxPitch = 10f; public AudioSource nitro; public AudioSource switchGear; } [Serializable] public class CarParticles { public GameObject brakeParticlePerfab; public ParticleSystem shiftParticle1; public ParticleSystem shiftParticle2; private GameObject[] wheelParticle = (GameObject[])(object)new GameObject[4]; } [Serializable] public class CarSetting { public bool showNormalGizmos = false; public Transform carSteer; public HitGround[] hitGround; public List<Transform> cameraSwitchView; public float springs = 25000f; public float dampers = 1500f; public float carPower = 120f; public float shiftPower = 150f; public float brakePower = 8000f; public Vector3 shiftCentre = new Vector3(0f, -0.8f, 0f); public float maxSteerAngle = 25f; public float shiftDownRPM = 1500f; public float shiftUpRPM = 2500f; public float idleRPM = 500f; public float stiffness = 2f; public bool automaticGear = true; public float[] gears = new float[6] { -10f, 9f, 6f, 4.5f, 3f, 2.5f }; public float LimitBackwardSpeed = 60f; public float LimitForwardSpeed = 220f; } [Serializable] public class HitGround { public string tag = "street"; public bool grounded = false; public AudioClip brakeSound; public AudioClip groundSound; public Color brakeColor; } private class WheelComponent { public Transform wheel; public WheelCollider collider; public Vector3 startPos; public float rotation = 0f; public float rotation2 = 0f; public float maxSteer; public bool drive; public float pos_y = 0f; public WheelSetting settings; } public ControlMode controlMode = ControlMode.simple; public bool activeControl = false; public CarWheels carWheels; public CarLights carLights; public CarSounds carSounds; public CarParticles carParticles; public CarSetting carSetting; [HideInInspector] public float steer = 0f; [HideInInspector] public float accel = 0f; [HideInInspector] public bool brake; private bool shifmotor; [HideInInspector] public float curTorque = 100f; [HideInInspector] public float powerShift = 100f; [HideInInspector] public bool shift; private float torque = 100f; [HideInInspector] public float speed = 0f; private float lastSpeed = -10f; private bool shifting = false; private float[] efficiencyTable = new float[22] { 0.6f, 0.65f, 0.7f, 0.75f, 0.8f, 0.85f, 0.9f, 1f, 1f, 0.95f, 0.8f, 0.7f, 0.6f, 0.5f, 0.45f, 0.4f, 0.36f, 0.33f, 0.3f, 0.2f, 0.1f, 0.05f }; private float efficiencyTableStep = 250f; private float Pitch; private float PitchDelay; private float shiftTime = 0f; private float shiftDelay = 0f; [HideInInspector] public int currentGear = 0; [HideInInspector] public bool NeutralGear = true; [HideInInspector] public float motorRPM = 0f; [HideInInspector] public bool Backward = false; [HideInInspector] public float accelFwd = 0f; [HideInInspector] public float accelBack = 0f; [HideInInspector] public float steerAmount = 0f; private float wantedRPM = 0f; private float w_rotate; private float slip; private float slip2 = 0f; private GameObject[] Particle = (GameObject[])(object)new GameObject[4]; private Vector3 steerCurAngle; private Rigidbody myRigidbody; private WheelComponent[] wheels; public bool isOn = true; public bool isForciblyOff = false; private WheelComponent SetWheelComponent(Transform wheel, float maxSteer, bool drive, float pos_y, WheelSetting setting) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) WheelComponent wheelComponent = new WheelComponent(); GameObject val = new GameObject(((Object)wheel).name + "WheelCollider"); val.transform.parent = ((Component)this).transform; val.transform.position = wheel.position; val.transform.eulerAngles = ((Component)this).transform.eulerAngles; pos_y = val.transform.localPosition.y; WheelCollider val2 = (WheelCollider)val.AddComponent(typeof(WheelCollider)); wheelComponent.wheel = wheel; wheelComponent.collider = val.GetComponent<WheelCollider>(); wheelComponent.drive = drive; wheelComponent.pos_y = pos_y; wheelComponent.maxSteer = maxSteer; wheelComponent.startPos = val.transform.localPosition; wheelComponent.settings = setting; return wheelComponent; } private void Awake() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) if (carSetting.automaticGear) { NeutralGear = false; } myRigidbody = ((Component)((Component)this).transform).GetComponent<Rigidbody>(); wheels = new WheelComponent[4]; wheels[0] = SetWheelComponent(carWheels.wheels.frontRight, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontRight.position.y, carWheels.wheels.frontSetting); wheels[1] = SetWheelComponent(carWheels.wheels.frontLeft, carSetting.maxSteerAngle, carWheels.wheels.frontWheelDrive, carWheels.wheels.frontLeft.position.y, carWheels.wheels.frontSetting); wheels[2] = SetWheelComponent(carWheels.wheels.backRight, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backRight.position.y, carWheels.wheels.rearSetting); wheels[3] = SetWheelComponent(carWheels.wheels.backLeft, 0f, carWheels.wheels.backWheelDrive, carWheels.wheels.backLeft.position.y, carWheels.wheels.rearSetting); if (Object.op_Implicit((Object)(object)carSetting.carSteer)) { steerCurAngle = carSetting.carSteer.localEulerAngles; } WheelComponent[] array = wheels; foreach (WheelComponent wheelComponent in array) { WheelCollider collider = wheelComponent.collider; collider.suspensionDistance = wheelComponent.settings.Distance; JointSpring suspensionSpring = collider.suspensionSpring; suspensionSpring.spring = carSetting.springs; suspensionSpring.damper = carSetting.dampers; collider.suspensionSpring = suspensionSpring; collider.radius = wheelComponent.settings.Radius; collider.mass = wheelComponent.settings.Weight; WheelFrictionCurve val = collider.forwardFriction; ((WheelFrictionCurve)(ref val)).asymptoteValue = 5000f; ((WheelFrictionCurve)(ref val)).extremumSlip = 2f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 20f; ((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness; collider.forwardFriction = val; val = collider.sidewaysFriction; ((WheelFrictionCurve)(ref val)).asymptoteValue = 7500f; ((WheelFrictionCurve)(ref val)).asymptoteSlip = 2f; ((WheelFrictionCurve)(ref val)).stiffness = carSetting.stiffness; collider.sidewaysFriction = val; } } public void TurnOnEngine(bool forcibly) { if (!isForciblyOff) { isOn = true; } else if (forcibly) { isForciblyOff = false; isOn = true; } } public void TurnOffEngine(bool forcibly) { isForciblyOff = forcibly; isOn = false; } public void ShiftTo(int newGear) { ((Component)carSounds.switchGear).GetComponent<AudioSource>().Play(); currentGear = newGear; if (currentGear == 0) { NeutralGear = true; } else { NeutralGear = false; } if (currentGear == -1) { currentGear = 0; } } public void ShiftUp(bool ignoreDelay) { float timeSinceLevelLoad = Time.timeSinceLevelLoad; if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || currentGear >= carSetting.gears.Length - 1) { return; } ((Component)carSounds.switchGear).GetComponent<AudioSource>().Play(); if (!carSetting.automaticGear) { if (currentGear == 0) { if (NeutralGear) { currentGear++; NeutralGear = false; } else { NeutralGear = true; } } else { currentGear++; } } else { currentGear++; } shiftDelay = timeSinceLevelLoad + 1f; shiftTime = 1.5f; } public void ShiftDown(bool ignoreDelay) { float timeSinceLevelLoad = Time.timeSinceLevelLoad; if ((timeSinceLevelLoad < shiftDelay && !ignoreDelay) || (currentGear <= 0 && !NeutralGear)) { return; } ((Component)carSounds.switchGear).GetComponent<AudioSource>().Play(); if (!carSetting.automaticGear) { if (currentGear == 1) { if (!NeutralGear) { currentGear--; NeutralGear = true; } } else if (currentGear == 0) { NeutralGear = false; } else { currentGear--; } } else { currentGear--; } shiftDelay = timeSinceLevelLoad + 0.1f; shiftTime = 2f; } private void OnCollisionEnter(Collision collision) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>())) { VehicleControl component = ((Component)collision.transform.root).GetComponent<VehicleControl>(); Vector3 relativeVelocity = collision.relativeVelocity; component.slip2 = Mathf.Clamp(((Vector3)(ref relativeVelocity)).magnitude, 0f, 10f); myRigidbody.angularVelocity = new Vector3((0f - myRigidbody.angularVelocity.x) * 0.5f, myRigidbody.angularVelocity.y * 0.5f, (0f - myRigidbody.angularVelocity.z) * 0.5f); myRigidbody.velocity = new Vector3(myRigidbody.velocity.x, myRigidbody.velocity.y * 0.5f, myRigidbody.velocity.z); } } private void OnCollisionStay(Collision collision) { if (Object.op_Implicit((Object)(object)((Component)collision.transform.root).GetComponent<VehicleControl>())) { ((Component)collision.transform.root).GetComponent<VehicleControl>().slip2 = 5f; } } private void Update() { } private void FixedUpdate() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0704: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_075a: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Unknown result type (might be due to invalid IL or missing references) //IL_079b: Unknown result type (might be due to invalid IL or missing references) //IL_0acf: Unknown result type (might be due to invalid IL or missing references) //IL_0ae0: Unknown result type (might be due to invalid IL or missing references) //IL_0ae5: Unknown result type (might be due to invalid IL or missing references) //IL_0fca: Unknown result type (might be due to invalid IL or missing references) //IL_0fd4: Unknown result type (might be due to invalid IL or missing references) //IL_0ee6: Unknown result type (might be due to invalid IL or missing references) //IL_0eed: Unknown result type (might be due to invalid IL or missing references) //IL_0ef2: Unknown result type (might be due to invalid IL or missing references) //IL_0f0c: Unknown result type (might be due to invalid IL or missing references) //IL_0f17: Unknown result type (might be due to invalid IL or missing references) //IL_0f1c: Unknown result type (might be due to invalid IL or missing references) //IL_0f25: Unknown result type (might be due to invalid IL or missing references) //IL_0fec: Unknown result type (might be due to invalid IL or missing references) //IL_0b3b: Unknown result type (might be due to invalid IL or missing references) //IL_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_0d23: Unknown result type (might be due to invalid IL or missing references) if (!isOn) { accel = 0f; } Vector3 velocity = myRigidbody.velocity; speed = ((Vector3)(ref velocity)).magnitude * 2.7f; if (speed < lastSpeed - 10f && slip < 10f) { slip = lastSpeed / 15f; } lastSpeed = speed; if (slip2 != 0f) { slip2 = Mathf.MoveTowards(slip2, 0f, 0.1f); } myRigidbody.centerOfMass = carSetting.shiftCentre; if (!carWheels.wheels.frontWheelDrive && !carWheels.wheels.backWheelDrive) { accel = 0f; } if (Object.op_Implicit((Object)(object)carSetting.carSteer)) { carSetting.carSteer.localEulerAngles = new Vector3(steerCurAngle.x, steerCurAngle.y, steerCurAngle.z + steer * -120f); } if (carSetting.automaticGear && currentGear == 1 && accel < 0f) { if (speed < 5f) { ShiftDown(ignoreDelay: false); } } else if (carSetting.automaticGear && currentGear == 0 && accel > 0f) { if (speed < 5f) { ShiftUp(ignoreDelay: false); } } else if (carSetting.automaticGear && motorRPM > carSetting.shiftUpRPM && accel > 0f && speed > 10f && !brake) { ShiftUp(ignoreDelay: false); } else if (carSetting.automaticGear && motorRPM < carSetting.shiftDownRPM && currentGear > 1) { ShiftDown(ignoreDelay: false); } if (speed < 1f) { Backward = true; } if (currentGear != 0 || !Backward) { Backward = false; } Light[] brakeLights = carLights.brakeLights; foreach (Light val in brakeLights) { if (brake || accel < 0f || speed < 1f) { val.intensity = Mathf.MoveTowards(val.intensity, 8f, 0.5f); } else { val.intensity = Mathf.MoveTowards(val.intensity, 0f, 0.5f); } ((Behaviour)val).enabled = val.intensity != 0f; } Light[] reverseLights = carLights.reverseLights; foreach (Light val2 in reverseLights) { if (speed > 2f && currentGear == 0) { val2.intensity = Mathf.MoveTowards(val2.intensity, 8f, 0.5f); } else { val2.intensity = Mathf.MoveTowards(val2.intensity, 0f, 0.5f); } ((Behaviour)val2).enabled = val2.intensity != 0f; } wantedRPM = 5500f * accel * 0.1f + wantedRPM * 0.9f; float num = 0f; int num2 = 0; bool flag = false; int num3 = 0; WheelComponent[] array = wheels; WheelHit val4 = default(WheelHit); foreach (WheelComponent wheelComponent in array) { WheelCollider collider = wheelComponent.collider; if (wheelComponent.drive) { num = ((!NeutralGear && brake && currentGear < 2) ? (num + accel * carSetting.idleRPM) : (NeutralGear ? (num + carSetting.idleRPM * accel) : (num + collider.rpm))); num2++; } if (brake || accel < 0f) { if (accel < 0f || (brake && (wheelComponent == wheels[2] || wheelComponent == wheels[3]))) { if (brake && accel > 0f) { slip = Mathf.Lerp(slip, 5f, accel * 0.01f); } else if (speed > 1f) { slip = Mathf.Lerp(slip, 1f, 0.002f); } else { slip = Mathf.Lerp(slip, 1f, 0.02f); } wantedRPM = 0f; collider.brakeTorque = carSetting.brakePower; wheelComponent.rotation = w_rotate; } } else { float brakeTorque; if (accel == 0f || NeutralGear) { float num5 = (collider.brakeTorque = 1000f); brakeTorque = num5; } else { float num5 = (collider.brakeTorque = 0f); brakeTorque = num5; } collider.brakeTorque = brakeTorque; slip = ((!(speed > 0f)) ? (slip = Mathf.Lerp(slip, 0.01f, 0.02f)) : ((!(speed > 100f)) ? (slip = Mathf.Lerp(slip, 1.5f, 0.02f)) : (slip = Mathf.Lerp(slip, 1f + Mathf.Abs(steer), 0.02f)))); w_rotate = wheelComponent.rotation; } WheelFrictionCurve val3 = collider.forwardFriction; ((WheelFrictionCurve)(ref val3)).asymptoteValue = 5000f; ((WheelFrictionCurve)(ref val3)).extremumSlip = 2f; ((WheelFrictionCurve)(ref val3)).asymptoteSlip = 20f; ((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2); collider.forwardFriction = val3; val3 = collider.sidewaysFriction; ((WheelFrictionCurve)(ref val3)).stiffness = carSetting.stiffness / (slip + slip2); ((WheelFrictionCurve)(ref val3)).extremumSlip = 0.2f + Mathf.Abs(steer); collider.sidewaysFriction = val3; if (shift && currentGear > 1 && speed > 50f && shifmotor && Mathf.Abs(steer) < 0.2f) { if (powerShift == 0f) { shifmotor = false; } powerShift = Mathf.MoveTowards(powerShift, 0f, Time.deltaTime * 10f); carSounds.nitro.volume = Mathf.Lerp(carSounds.nitro.volume, 1f, Time.deltaTime * 10f); if (!carSounds.nitro.isPlaying) { ((Component)carSounds.nitro).GetComponent<AudioSource>().Play(); } curTorque = ((!(powerShift > 0f)) ? carSetting.carPower : carSetting.shiftPower); carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f); carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, (float)((powerShift > 0f) ? 50 : 0), Time.deltaTime * 10f); } else { if (powerShift > 20f) { shifmotor = true; } carSounds.nitro.volume = Mathf.MoveTowards(carSounds.nitro.volume, 0f, Time.deltaTime * 2f); if (carSounds.nitro.volume == 0f) { carSounds.nitro.Stop(); } powerShift = Mathf.MoveTowards(powerShift, 100f, Time.deltaTime * 5f); curTorque = carSetting.carPower; carParticles.shiftParticle1.emissionRate = Mathf.Lerp(carParticles.shiftParticle1.emissionRate, 0f, Time.deltaTime * 10f); carParticles.shiftParticle2.emissionRate = Mathf.Lerp(carParticles.shiftParticle2.emissionRate, 0f, Time.deltaTime * 10f); } wheelComponent.rotation = Mathf.Repeat(wheelComponent.rotation + Time.deltaTime * collider.rpm * 360f / 60f, 360f); wheelComponent.rotation2 = Mathf.Lerp(wheelComponent.rotation2, collider.steerAngle, 0.1f); wheelComponent.wheel.localRotation = Quaternion.Euler(wheelComponent.rotation, wheelComponent.rotation2, 0f); Vector3 localPosition = wheelComponent.wheel.localPosition; if (collider.GetGroundHit(ref val4)) { if (Object.op_Implicit((Object)(object)carParticles.brakeParticlePerfab)) { if ((Object)(object)Particle[num3] == (Object)null) { Particle[num3] = Object.Instantiate<GameObject>(carParticles.brakeParticlePerfab, wheelComponent.wheel.position, Quaternion.identity); ((Object)Particle[num3]).name = "WheelParticle"; Particle[num3].transform.parent = ((Component)this).transform; Particle[num3].AddComponent<AudioSource>(); Particle[num3].GetComponent<AudioSource>().maxDistance = 50f; Particle[num3].GetComponent<AudioSource>().spatialBlend = 1f; Particle[num3].GetComponent<AudioSource>().dopplerLevel = 5f; Particle[num3].GetComponent<AudioSource>().rolloffMode = (AudioRolloffMode)2; } ParticleSystem component = Particle[num3].GetComponent<ParticleSystem>(); bool flag2 = false; for (int l = 0; l < carSetting.hitGround.Length; l++) { if (((Component)((WheelHit)(ref val4)).collider).CompareTag(carSetting.hitGround[l].tag)) { flag2 = carSetting.hitGround[l].grounded; if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.5f) && speed > 1f) { Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[l].brakeSound; } else if ((Object)(object)Particle[num3].GetComponent<AudioSource>().clip != (Object)(object)carSetting.hitGround[l].groundSound && !Particle[num3].GetComponent<AudioSource>().isPlaying) { Particle[num3].GetComponent<AudioSource>().clip = carSetting.hitGround[l].groundSound; } Particle[num3].GetComponent<ParticleSystem>().startColor = carSetting.hitGround[l].brakeColor; } } if (flag2 && speed > 5f && !brake) { component.enableEmission = true; Particle[num3].GetComponent<AudioSource>().volume = 0.5f; if (!Particle[num3].GetComponent<AudioSource>().isPlaying) { Particle[num3].GetComponent<AudioSource>().Play(); } } else if ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && speed > 1f) { if (accel < 0f || ((brake || Mathf.Abs(((WheelHit)(ref val4)).sidewaysSlip) > 0.6f) && (wheelComponent == wheels[2] || wheelComponent == wheels[3]))) { if (!Particle[num3].GetComponent<AudioSource>().isPlaying) { Particle[num3].GetComponent<AudioSource>().Play(); } component.enableEmission = true; Particle[num3].GetComponent<AudioSource>().volume = 10f; } } else { component.enableEmission = false; Particle[num3].GetComponent<AudioSource>().volume = Mathf.Lerp(Particle[num3].GetComponent<AudioSource>().volume, 0f, Time.deltaTime * 10f); } } localPosition.y -= Vector3.Dot(wheelComponent.wheel.position - ((WheelHit)(ref val4)).point, ((Component)this).transform.TransformDirection(0f, 1f, 0f) / ((Component)this).transform.lossyScale.x) - collider.radius; localPosition.y = Mathf.Clamp(localPosition.y, -10f, wheelComponent.pos_y); flag = flag || wheelComponent.drive; } else { if ((Object)(object)Particle[num3] != (Object)null) { ParticleSystem component2 = Particle[num3].GetComponent<ParticleSystem>(); component2.enableEmission = false; } localPosition.y = wheelComponent.startPos.y - wheelComponent.settings.Distance; myRigidbody.AddForce(Vector3.down * 5000f); } num3++; wheelComponent.wheel.localPosition = localPosition; } if (num2 > 1) { num /= (float)num2; } motorRPM = 0.95f * motorRPM + 0.05f * Mathf.Abs(num * carSetting.gears[currentGear]); if (motorRPM > 5500f) { motorRPM = 5200f; } int num7 = (int)(motorRPM / efficiencyTableStep); if (num7 >= efficiencyTable.Length) { num7 = efficiencyTable.Length - 1; } if (num7 < 0) { num7 = 0; } float num8 = curTorque * carSetting.gears[currentGear] * efficiencyTable[num7]; WheelComponent[] array2 = wheels; foreach (WheelComponent wheelComponent2 in array2) { WheelCollider collider2 = wheelComponent2.collider; if (wheelComponent2.drive) { if (Mathf.Abs(collider2.rpm) > Mathf.Abs(wantedRPM)) { collider2.motorTorque = 0f; } else { float motorTorque = collider2.motorTorque; if (!brake && accel != 0f && !NeutralGear) { if ((speed < carSetting.LimitForwardSpeed && currentGear > 0) || (speed < carSetting.LimitBackwardSpeed && currentGear == 0)) { collider2.motorTorque = motorTorque * 0.9f + num8 * 1f; } else { collider2.motorTorque = 0f; collider2.brakeTorque = 2000f; } } else { collider2.motorTorque = 0f; } } } if (brake || slip2 > 2f) { collider2.steerAngle = Mathf.Lerp(collider2.steerAngle, steer * wheelComponent2.maxSteer, 0.02f); continue; } float num9 = Mathf.Clamp(speed / carSetting.maxSteerAngle, 1f, carSetting.maxSteerAngle); collider2.steerAngle = steer * (wheelComponent2.maxSteer / num9); } Pitch = Mathf.Clamp(1.2f + (motorRPM - carSetting.idleRPM) / (carSetting.shiftUpRPM - carSetting.idleRPM), 1f, 10f); shiftTime = Mathf.MoveTowards(shiftTime, 0f, 0.1f); if (Pitch == 1f) { carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1f, 0.1f); carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.1f); } else { carSounds.IdleEngine.volume = Mathf.Lerp(carSounds.IdleEngine.volume, 1.8f - Pitch, 0.1f); if ((Pitch > PitchDelay || accel > 0f) && shiftTime == 0f) { carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0f, 0.2f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 1f, 0.1f); } else { carSounds.LowEngine.volume = Mathf.Lerp(carSounds.LowEngine.volume, 0.5f, 0.1f); carSounds.HighEngine.volume = Mathf.Lerp(carSounds.HighEngine.volume, 0f, 0.2f); } carSounds.HighEngine.pitch = Pitch; carSounds.LowEngine.pitch = Pitch; PitchDelay = Pitch; } if (!isOn) { carSounds.IdleEngine.volume = 0f; carSounds.LowEngine.volume = 0f; carSounds.HighEngine.volume = 0f; } } private void OnDrawGizmos() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (carSetting.showNormalGizmos && !Application.isPlaying) { Matrix4x4 matrix = Matrix4x4.TRS(((Component)this).transform.position, ((Component)this).transform.rotation, ((Component)this).transform.lossyScale); Gizmos.matrix = matrix; Gizmos.color = new Color(1f, 0f, 0f, 0.5f); Gizmos.DrawCube(Vector3.up / 1.5f, new Vector3(2.5f, 2f, 6f)); Gizmos.DrawSphere(carSetting.shiftCentre / ((Component)this).transform.lossyScale.x, 0.2f); } } }