Start adding Starlight support

This commit is contained in:
D1GQ committed 2026-03-06 12:43:32 -06:00
1 parent 55391e7d4e
commit fd9a0e93dc
4 files changed
+28 -9

No files matched your search

+11 -1
View File
@@ -317,5 +317,15 @@ internal class BAUPlugin : BasePlugin
/// Gets the game installation path for Among Us.
/// </summary>
/// <returns>The game installation path string.</returns>
internal static string GetGamePathToAmongUs() => Path.GetDirectoryName(Application.dataPath) ?? Application.dataPath;
internal static string GetGamePathToAmongUs()
{
if (!ModInfo.Starlight)
{
return Path.GetDirectoryName(Application.dataPath) ?? throw new Exception("Unable to find `Application.dataPath` path");
}
else
{
return GetDataPathToAmongUs();
}
}
}
+1
View File
@@ -9,6 +9,7 @@ internal sealed class DumpCommand : BaseCommand
{
internal override string Name => "dump";
internal override string Description => "Dump the entire log to the user's desktop";
internal override bool ShowCommand() => !ModInfo.Starlight;
internal override bool CanRunCommand(out string reason)
{
+5
View File
@@ -63,6 +63,11 @@ internal static class ModInfo
/// </summary>
internal const string DISCORD = "https://discord.gg/vjYrXpzNAn";
/// <summary>
/// Indicator rather that BAU is running on Starlight.
/// </summary>
internal static readonly bool Starlight = OperatingSystem.IsAndroid();
/// <summary>
/// Retrieves metadata from the assembly attributes.
/// </summary>
@@ -51,16 +51,19 @@ internal static class OptionsMenuBehaviourPatch
ClientOptionItem.CreateToggle(Translator.GetString("BetterOption.ShowFPS"), BAUPlugin.ShowFPS, 1, __instance);
// Button options (no toggle)
ClientOptionItem.CreateButton(Translator.GetString("BetterOption.SaveData"), 1, __instance, OpenSaveData, () =>
if (!ModInfo.Starlight)
{
// Only allow opening save data in lobby/main menu, not during gameplay
bool cannotOpen = GameState.IsInGame && !GameState.IsLobby;
if (cannotOpen)
ClientOptionItem.CreateButton(Translator.GetString("BetterOption.SaveData"), 1, __instance, OpenSaveData, () =>
{
BetterNotificationManager.Notify($"Cannot open save data while in gameplay!", 2.5f);
}
return !cannotOpen;
});
// Only allow opening save data in lobby/main menu, not during gameplay
bool cannotOpen = GameState.IsInGame && !GameState.IsLobby;
if (cannotOpen)
{
BetterNotificationManager.Notify($"Cannot open save data while in gameplay!", 2.5f);
}
return !cannotOpen;
});
}
ClientOptionItem.CreateButton(Translator.GetString("BetterOption.ToVanilla"), 1, __instance, SwitchToVanilla, () =>
{