Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of OmniLand v1.1.5
CoasterMod.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("Omniscye")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CoasterMod")] [assembly: AssemblyTitle("CoasterMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class CoasterSeatCarrier : MonoBehaviour { [Tooltip("Child under the cart where the player sits (must be parented)")] public Transform seatPoint; [Header("Grab & Follow Settings")] [Tooltip("How close the player must be to latch on")] public float grabDistance = 1f; [Tooltip("Spring stiffness for position follow")] public float positionStiffness = 10f; [Tooltip("Spring stiffness for rotation follow")] public float rotationStiffness = 0.2f; private PlayerAvatar playerTarget; private void FixedUpdate() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_0046: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)playerTarget == (Object)null) { foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (item.isDisabled || !(Vector3.Distance(seatPoint.position, ((Component)item).transform.position) <= grabDistance)) { continue; } playerTarget = item; break; } } if ((Object)(object)playerTarget != (Object)null && !playerTarget.isDisabled) { Rigidbody rb = playerTarget.tumble.rb; if (!playerTarget.tumble.isTumbling) { playerTarget.tumble.TumbleRequest(true, false); } playerTarget.tumble.TumbleOverrideTime(1f); playerTarget.FallDamageResetSet(0.1f); Vector3 val = SemiFunc.PhysFollowPosition(((Component)playerTarget.tumble).transform.position, seatPoint.position, rb.velocity, positionStiffness); rb.AddForce(val * (positionStiffness * Time.fixedDeltaTime), (ForceMode)1); Vector3 val2 = SemiFunc.PhysFollowRotation(((Component)playerTarget.tumble).transform, seatPoint.rotation, rb, rotationStiffness); rb.AddTorque(val2 * Time.fixedDeltaTime, (ForceMode)1); } } } [RequireComponent(typeof(Collider))] public class KinematicCoasterMover : MonoBehaviour { [Header("Waypoints & Timing")] public Transform waypointRoot; public float speed = 5f; public float startDelay = 10f; public bool loop = true; public float rotationSpeed = 5f; [Header("Mesh Import Rotation Correction (tweak in Inspector)")] public Vector3 meshEulerOffset = new Vector3(-90f, 180f, -0.085f); private Transform[] waypoints; private int idx; private float delayTimer; private bool started; private Quaternion originalRotation; private Quaternion meshOffsetQuat; private static readonly Regex regex = new Regex("Waypoint_(\\d+)$"); private void Awake() { //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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) originalRotation = ((Component)this).transform.rotation; waypoints = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true) where regex.IsMatch(((Object)t).name) select new { t = t, i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value) } into x orderby x.i select x.t).ToArray(); meshOffsetQuat = Quaternion.Euler(meshEulerOffset); idx = 0; delayTimer = startDelay; started = false; if (waypoints.Length != 0) { ((Component)this).transform.position = waypoints[0].position; } } private void Update() { //IL_0048: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) if (waypoints == null || waypoints.Length == 0) { return; } if (!started) { delayTimer -= Time.deltaTime; ((Component)this).transform.rotation = originalRotation; if (delayTimer <= 0f) { started = true; } return; } if (idx == 0 && ((Component)this).transform.rotation == originalRotation && waypoints.Length > 1) { Vector3 val = waypoints[1].position - waypoints[0].position; Vector3 normalized = ((Vector3)(ref val)).normalized; Quaternion rotation = Quaternion.LookRotation(normalized, Vector3.up) * meshOffsetQuat; ((Component)this).transform.rotation = rotation; } Vector3 position = waypoints[idx].position; Vector3 val2 = position - ((Component)this).transform.position; float num = speed * Time.deltaTime; if (((Vector3)(ref val2)).magnitude <= num) { ((Component)this).transform.position = position; AdvanceIndex(); return; } Transform transform = ((Component)this).transform; transform.position += ((Vector3)(ref val2)).normalized * num; Quaternion val3 = Quaternion.LookRotation(((Vector3)(ref val2)).normalized, Vector3.up) * meshOffsetQuat; ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, val3, rotationSpeed * Time.deltaTime); } private void AdvanceIndex() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) idx++; if (idx >= waypoints.Length) { if (loop) { idx = 0; delayTimer = startDelay; started = false; ((Component)this).transform.rotation = originalRotation; } else { ((Behaviour)this).enabled = false; } } } private void OnDrawGizmos() { //IL_00b8: 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_00d2: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)waypointRoot == (Object)null)) { Vector3[] array = (from t in ((Component)waypointRoot).GetComponentsInChildren<Transform>(true) where regex.IsMatch(((Object)t).name) select new { p = t.position, i = int.Parse(regex.Match(((Object)t).name).Groups[1].Value) } into x orderby x.i select x.p).ToArray(); Gizmos.color = Color.cyan; for (int i = 0; i + 1 < array.Length; i++) { Gizmos.DrawLine(array[i], array[i + 1]); } } } } public class OneTimeDoorOpener : MonoBehaviour { [Tooltip("Distance to player that opens the door")] public float triggerDistance = 2f; [Tooltip("Animator to control")] public Animator doorAnimator; [Tooltip("Name of the trigger parameter in Animator")] public string triggerName = "Open"; private bool hasTriggered = false; private void FixedUpdate() { //IL_003b: 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) if (hasTriggered) { return; } foreach (PlayerAvatar item in SemiFunc.PlayerGetList()) { if (!item.isDisabled) { float num = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num <= triggerDistance) { doorAnimator.SetTrigger(triggerName); hasTriggered = true; break; } } } } } public class Zone2DTrigger : MonoBehaviour { [Tooltip("Side view camera to enable when in 2D mode")] public Camera sideCam; [Tooltip("Z position to lock the player at")] public float lockZ = 0f; [Tooltip("Radius around this object to trigger 2D mode")] public float triggerRadius = 4f; private PlayerAvatar localAvatar; private GameObject playerCamRoot; private MonoBehaviour playerLookScript; private bool isIn2D = false; private void FixedUpdate() { //IL_0062: 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_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)localAvatar == (Object)null) { localAvatar = ((IEnumerable<PlayerAvatar>)SemiFunc.PlayerGetList()).FirstOrDefault((Func<PlayerAvatar, bool>)((PlayerAvatar p) => (Object)(object)p != (Object)null && p.photonView.IsMine && !p.isDisabled)); } if ((Object)(object)localAvatar == (Object)null) { return; } float num = Vector3.Distance(((Component)localAvatar).transform.position, ((Component)this).transform.position); if (!isIn2D && num <= triggerRadius) { isIn2D = true; if ((Object)(object)playerCamRoot == (Object)null) { Camera val = ((IEnumerable<Camera>)((Component)localAvatar).GetComponentsInChildren<Camera>(true)).FirstOrDefault((Func<Camera, bool>)((Camera c) => ((Component)c).CompareTag("MainCamera"))); if ((Object)(object)val != (Object)null) { playerCamRoot = ((Component)((Component)val).transform.root).gameObject; } } if ((Object)(object)playerLookScript == (Object)null) { playerLookScript = ((IEnumerable<MonoBehaviour>)((Component)localAvatar).GetComponentsInChildren<MonoBehaviour>(true)).FirstOrDefault((Func<MonoBehaviour, bool>)((MonoBehaviour c) => ((object)c).GetType().Name == "PlayerLook")); } if (Object.op_Implicit((Object)(object)sideCam)) { ((Behaviour)sideCam).enabled = true; } if (Object.op_Implicit((Object)(object)playerCamRoot)) { playerCamRoot.SetActive(false); } if (Object.op_Implicit((Object)(object)playerLookScript)) { ((Behaviour)playerLookScript).enabled = false; } } else if (isIn2D && num > triggerRadius + 1f) { if (Object.op_Implicit((Object)(object)sideCam)) { ((Behaviour)sideCam).enabled = false; } if (Object.op_Implicit((Object)(object)playerCamRoot)) { playerCamRoot.SetActive(true); } if (Object.op_Implicit((Object)(object)playerLookScript)) { ((Behaviour)playerLookScript).enabled = true; } isIn2D = false; } if (isIn2D && (Object)(object)localAvatar != (Object)null) { Vector3 position = ((Component)localAvatar).transform.position; position.z = lockZ; ((Component)localAvatar).transform.position = position; Vector3 eulerAngles = ((Component)localAvatar).transform.eulerAngles; eulerAngles.y = 90f; ((Component)localAvatar).transform.rotation = Quaternion.Euler(eulerAngles); } } } namespace CoasterMod { [BepInPlugin("Omniscye.CoasterMod", "CoasterMod", "1.0")] public class CoasterMod : BaseUnityPlugin { internal static CoasterMod Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; internal Harmony? Harmony { get; set; } private void Awake() { Instance = this; ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Patch(); Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!"); } internal void Patch() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0026: Expected O, but got Unknown if (Harmony == null) { Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Harmony val2 = val; Harmony = val; } Harmony.PatchAll(); } internal void Unpatch() { Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } } private void Update() { } } [HarmonyPatch(typeof(PlayerController))] internal static class ExamplePlayerControllerPatch { [HarmonyPrefix] [HarmonyPatch("Start")] private static void Start_Prefix(PlayerController __instance) { CoasterMod.Logger.LogDebug((object)$"{__instance} Start Prefix"); } [HarmonyPostfix] [HarmonyPatch("Start")] private static void Start_Postfix(PlayerController __instance) { CoasterMod.Logger.LogDebug((object)$"{__instance} Start Postfix"); } } }