From 5e2ca191ba9bcd8746e73f63c6f2a5f49731f150 Mon Sep 17 00:00:00 2001
From: XtraCube <72575280+XtraCube@users.noreply.github.com>
Date: Sun, 30 Mar 2025 16:19:52 -0400
Subject: [PATCH 1/2] proper submerged compat
---
MiraAPI/MiraApiPlugin.cs | 1 +
MiraAPI/ModCompatibility.cs | 19 +++++++++++++++++++
MiraAPI/Patches/Roles/EjectionPatches.cs | 2 +-
3 files changed, 21 insertions(+), 1 deletion(-)
create mode 100644 MiraAPI/ModCompatibility.cs
diff --git a/MiraAPI/MiraApiPlugin.cs b/MiraAPI/MiraApiPlugin.cs
index 72424af..8654cf6 100644
--- a/MiraAPI/MiraApiPlugin.cs
+++ b/MiraAPI/MiraApiPlugin.cs
@@ -16,6 +16,7 @@ namespace MiraAPI;
[BepInAutoPlugin("mira.api", "MiraAPI")]
[BepInProcess("Among Us.exe")]
[BepInDependency(ReactorPlugin.Id)]
+[BepInDependency(ModCompatibility.SubmergedId, BepInDependency.DependencyFlags.SoftDependency)]
[ReactorModFlags(ModFlags.RequireOnAllClients)]
public partial class MiraApiPlugin : BasePlugin
{
diff --git a/MiraAPI/ModCompatibility.cs b/MiraAPI/ModCompatibility.cs
new file mode 100644
index 0000000..4163037
--- /dev/null
+++ b/MiraAPI/ModCompatibility.cs
@@ -0,0 +1,19 @@
+using BepInEx.Unity.IL2CPP;
+
+namespace MiraAPI;
+
+///
+/// Mod compatibility tools.
+///
+public static class ModCompatibility
+{
+ ///
+ /// The ID for the Submerged mod.
+ ///
+ public const string SubmergedId = "Submerged";
+
+ ///
+ /// Gets a value indicating whether the Submerged mod is loaded.
+ ///
+ public static bool SubmergedLoaded => IL2CPPChainloader.Instance.Plugins.TryGetValue(SubmergedId, out _);
+}
diff --git a/MiraAPI/Patches/Roles/EjectionPatches.cs b/MiraAPI/Patches/Roles/EjectionPatches.cs
index a7861df..ec1d123 100644
--- a/MiraAPI/Patches/Roles/EjectionPatches.cs
+++ b/MiraAPI/Patches/Roles/EjectionPatches.cs
@@ -42,7 +42,7 @@ public static class EjectionPatches
{
yield return AccessTools.Method(typeof(ExileController), nameof(ExileController.WrapUp));
yield return AccessTools.Method(typeof(AirshipExileController), nameof(AirshipExileController.WrapUpAndSpawn));
- if (AccessTools.TypeByName("Submerged.ExileCutscene.SubmergedExileController") is { } type)
+ if (ModCompatibility.SubmergedLoaded && AccessTools.TypeByName("Submerged.ExileCutscene.SubmergedExileController") is { } type)
{
yield return AccessTools.Method(type, "WrapUpAndSpawn");
}
From 5f4461f7e5c4395d12452a177068fa17752b49e3 Mon Sep 17 00:00:00 2001
From: XtraCube <72575280+XtraCube@users.noreply.github.com>
Date: Sun, 30 Mar 2025 16:26:22 -0400
Subject: [PATCH 2/2] suppress il2cpp warnings
---
MiraAPI/Voting/PlayerVoteData.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/MiraAPI/Voting/PlayerVoteData.cs b/MiraAPI/Voting/PlayerVoteData.cs
index b7a1b84..f673bc4 100644
--- a/MiraAPI/Voting/PlayerVoteData.cs
+++ b/MiraAPI/Voting/PlayerVoteData.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using Il2CppInterop.Runtime.Attributes;
using Reactor.Utilities.Attributes;
using UnityEngine;
@@ -19,6 +20,7 @@ public class PlayerVoteData(nint cppPtr) : MonoBehaviour(cppPtr)
///
/// Gets the list of votes the owner has.
///
+ [HideFromIl2Cpp]
public List Votes { get; private set; } = [];
///