diff --git a/MiraAPI/GameOptions/IModdedOption.cs b/MiraAPI/GameOptions/IModdedOption.cs
index 947b6ff..5a3c3f8 100644
--- a/MiraAPI/GameOptions/IModdedOption.cs
+++ b/MiraAPI/GameOptions/IModdedOption.cs
@@ -17,9 +17,9 @@ public interface IModdedOption
uint Id { get; }
///
- /// Gets the title of the option.
+ /// Gets or sets the title of the option.
///
- string Title { get; }
+ string Title { get; set; }
///
/// Gets the StringName for the option, used for localization.
diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs
index 0cca206..04cfd09 100644
--- a/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs
+++ b/MiraAPI/GameOptions/OptionTypes/ModdedNumberOption.cs
@@ -54,7 +54,6 @@ public class ModdedNumberOption : ModdedOption
/// Optional format string for the option screen.
/// Whether zero is infinity or not.
/// Whether to include this option in the preset or not.
- /// Whether holding shift will divide the increment or not.
public ModdedNumberOption(
string title,
float defaultValue,
diff --git a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs
index 392c76f..206894d 100644
--- a/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs
+++ b/MiraAPI/GameOptions/OptionTypes/ModdedOption.cs
@@ -21,7 +21,7 @@ public abstract class ModdedOption : IModdedOption
public uint Id { get; }
///
- public string Title { get; }
+ public string Title { get; set; }
///
public StringNames StringName { get; }
diff --git a/MiraAPI/Hud/CustomActionButton.cs b/MiraAPI/Hud/CustomActionButton.cs
index 43c11df..2fd5c63 100644
--- a/MiraAPI/Hud/CustomActionButton.cs
+++ b/MiraAPI/Hud/CustomActionButton.cs
@@ -217,7 +217,7 @@ public abstract class CustomActionButton
new Vector3(MaxUses <= 0 ? -0.4f : 0.4f, 0.45f, -9f)
);
KeybindText = KeybindIcon.transform.GetChild(0).GetComponent();
- HudManagerPatches.moddedKeybindIcons.Add(KeybindText);
+ HudManagerPatches.ModdedKeybindIcons.Add(KeybindText);
Button.usesRemainingSprite.transform.localPosition = new(-0.341f, 0.45f, -0.1f);
}
}
diff --git a/MiraAPI/Keybinds/VanillaKeybind.cs b/MiraAPI/Keybinds/VanillaKeybind.cs
index c04b83b..8911b49 100644
--- a/MiraAPI/Keybinds/VanillaKeybind.cs
+++ b/MiraAPI/Keybinds/VanillaKeybind.cs
@@ -19,6 +19,6 @@ public class VanillaKeybind : BaseKeybind
public VanillaKeybind(int id)
{
RewiredInputAction = KeybindUtils.GetInputActionById(id);
- Id = RewiredInputAction?.name;
+ Id = RewiredInputAction != null ? RewiredInputAction.name : id.ToString();
}
}
diff --git a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs
index 78fa445..5bee1ae 100644
--- a/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs
+++ b/MiraAPI/Patches/Freeplay/TaskAdderPatches.cs
@@ -21,10 +21,14 @@ using Object = UnityEngine.Object;
namespace MiraAPI.Patches.Freeplay;
[HarmonyPatch(typeof(TaskAdderGame))]
-internal static class TaskAdderPatches
+public static class TaskAdderPatches
{
private static Scroller _scroller = null!;
private static Dictionary folders = new();
+ public static string CrewmateName => TranslationController.Instance.GetString(StringNames.Crewmate);
+ public static string ImpostorName => TranslationController.Instance.GetString(StringNames.Impostor);
+ public static string NeutralName => "Neutral";
+ public static string ModifiersName => "Modifiers";
[HarmonyPostfix]
[HarmonyPatch(nameof(TaskAdderGame.Begin))]
@@ -66,19 +70,16 @@ internal static class TaskAdderPatches
__instance.RootFolderPrefab.GetComponent().ClickMask = collider;
__instance.RootFolderPrefab.gameObject.SetActive(false);
__instance.TaskParent = inner.transform;
- var crewLocale = TranslationController.Instance.GetString(StringNames.Crewmate);
- var impLocale = TranslationController.Instance.GetString(StringNames.Impostor);
-
- var crewmateFolder = __instance.Root.SubFolders.ToArray().FirstOrDefault(x => x.FolderName == crewLocale)!;
- var impostorFolder = __instance.Root.SubFolders.ToArray().FirstOrDefault(x => x.FolderName == impLocale)!;
+ var crewmateFolder = __instance.Root.SubFolders.ToArray().FirstOrDefault(x => x.FolderName == CrewmateName)!;
+ var impostorFolder = __instance.Root.SubFolders.ToArray().FirstOrDefault(x => x.FolderName == ImpostorName)!;
//var neutralFolder = __instance.CreateFolder("Neutral", __instance.Root, 2, Color.gray);
- var modifiersFolder = __instance.CreateFolder("Modifiers", __instance.Root, 0, Color.blue);
+ var modifiersFolder = __instance.CreateFolder(ModifiersName, __instance.Root, 0, Color.blue);
folders.Clear();
folders.Add(crewmateFolder.FolderName, crewmateFolder);
folders.Add(impostorFolder.FolderName, impostorFolder);
//folders.Add("Neutrals", neutralFolder);
- folders.Add("Modifiers", modifiersFolder);
+ folders.Add(ModifiersName, modifiersFolder);
int folderIdx = 2;
foreach (var plugin in MiraPluginManager.Instance.RegisteredPlugins)
@@ -137,8 +138,8 @@ internal static class TaskAdderPatches
Object.Instantiate(__instance.RootFolderPrefab, __instance.transform);
impFolder.gameObject.SetActive(false);
impFolder.SetFolderColor(TaskFolder.FolderColor.Red);
- crewFolder.FolderName = TranslationController.Instance.GetString(StringNames.Crewmate);
- impFolder.FolderName = TranslationController.Instance.GetString(StringNames.Impostor);
+ crewFolder.FolderName = CrewmateName;
+ impFolder.FolderName = ImpostorName;
rootFolder.SubFolders.Insert(0, crewFolder);
rootFolder.SubFolders.Insert(0, impFolder);
Il2CppSystem.Collections.Generic.List impRoles = new();
@@ -440,7 +441,7 @@ internal static class TaskAdderPatches
}
}
- if (folders.TryGetValue("Modifiers", out var modifiersFolder) && taskFolder.IsChildOf(modifiersFolder))
+ if (folders.TryGetValue(ModifiersName, out var modifiersFolder) && taskFolder.IsChildOf(modifiersFolder))
{
var plugin = MiraPluginManager.GetPluginByGuid(taskFolder.name.Replace("(Clone)", string.Empty));
if (plugin != null)
diff --git a/MiraAPI/Patches/HudManagerPatches.cs b/MiraAPI/Patches/HudManagerPatches.cs
index 17fb2bd..8a40b85 100644
--- a/MiraAPI/Patches/HudManagerPatches.cs
+++ b/MiraAPI/Patches/HudManagerPatches.cs
@@ -27,7 +27,7 @@ public static class HudManagerPatches
private static Dictionary vanillaKeybindIcons = new();
- internal static List moddedKeybindIcons = new();
+ internal static List ModdedKeybindIcons = new();
/*
///
@@ -90,7 +90,7 @@ public static class HudManagerPatches
fakeButton.ToggleVisible(true);
fakeButton.Destroy();
}
- moddedKeybindIcons = [];
+ ModdedKeybindIcons = [];
foreach (var button in CustomButtonManager.CustomButtons)
{
@@ -192,7 +192,7 @@ public static class HudManagerPatches
btnIcon.Key.text = KeybindUtils.GetKeycodeByActionId(btnIcon.Value).ToString();
btnIcon.Key.transform.parent.gameObject.SetActive(canSeeBinds);
}
- foreach (var btnIcon in moddedKeybindIcons)
+ foreach (var btnIcon in ModdedKeybindIcons)
{
btnIcon.transform.parent.gameObject.SetActive(canSeeBinds);
}
diff --git a/MiraAPI/Roles/CustomRoleConfiguration.cs b/MiraAPI/Roles/CustomRoleConfiguration.cs
index d93fbf2..b1dfae1 100644
--- a/MiraAPI/Roles/CustomRoleConfiguration.cs
+++ b/MiraAPI/Roles/CustomRoleConfiguration.cs
@@ -1,4 +1,5 @@
using AmongUs.GameOptions;
+using MiraAPI.Patches.Freeplay;
using MiraAPI.Utilities.Assets;
using UnityEngine;
@@ -36,7 +37,7 @@ public record struct CustomRoleConfiguration
{
ModdedRoleTeams.Crewmate => TranslationController.Instance.GetString(StringNames.Crewmate),
ModdedRoleTeams.Impostor => TranslationController.Instance.GetString(StringNames.Impostor),
- _ => "Neutral",
+ _ => TaskAdderPatches.NeutralName,
};
IntroSound = role.Team is ModdedRoleTeams.Crewmate
? CustomRoleManager.CrewmateIntroSound