diff --git a/MiraAPI/Patches/Roles/TaskAdderPatch.cs b/MiraAPI/Patches/Roles/TaskAdderPatch.cs index e371b7d..6b549a2 100644 --- a/MiraAPI/Patches/Roles/TaskAdderPatch.cs +++ b/MiraAPI/Patches/Roles/TaskAdderPatch.cs @@ -1,10 +1,10 @@ using AmongUs.GameOptions; using HarmonyLib; -using System; -using System.Collections.Generic; using MiraAPI.PluginLoading; using MiraAPI.Roles; using MiraAPI.Utilities.Assets; +using System; +using System.Collections.Generic; using System.Linq; using TMPro; using UnityEngine; @@ -186,23 +186,23 @@ public static class TaskAdderPatch switch (taskAddButton.MyTask.TaskType) { case TaskTypes.DivertPower: - { - var targetSystem = taskAddButton.MyTask.Cast().TargetSystem; - taskAddButton.Text.text = TranslationController.Instance.GetString( - StringNames.DivertPowerTo, - TranslationController.Instance.GetString(targetSystem)); - break; - } + { + var targetSystem = taskAddButton.MyTask.Cast().TargetSystem; + taskAddButton.Text.text = TranslationController.Instance.GetString( + StringNames.DivertPowerTo, + TranslationController.Instance.GetString(targetSystem)); + break; + } case TaskTypes.FixWeatherNode: - { - var nodeId = taskAddButton.MyTask.Cast().NodeId; - taskAddButton.Text.text = - TranslationController.Instance.GetString( - StringNames.FixWeatherNode) + " " + - TranslationController.Instance.GetString( - WeatherSwitchGame.ControlNames[nodeId]); - break; - } + { + var nodeId = taskAddButton.MyTask.Cast().NodeId; + taskAddButton.Text.text = + TranslationController.Instance.GetString( + StringNames.FixWeatherNode) + " " + + TranslationController.Instance.GetString( + WeatherSwitchGame.ControlNames[nodeId]); + break; + } default: taskAddButton.Text.text = TranslationController.Instance.GetString(taskAddButton.MyTask.TaskType); @@ -276,7 +276,7 @@ public static class TaskAdderPatch { var roleBehaviour = plugin.CustomRoles.ElementAt(m).Value; if (roleBehaviour.Role == RoleTypes.ImpostorGhost || roleBehaviour.Role == RoleTypes.CrewmateGhost || - roleBehaviour.IsDead) + (roleBehaviour is ICustomRole customRole && !customRole.Configuration.ShowInFreeplay)) { continue; } diff --git a/MiraAPI/Roles/CustomRoleConfiguration.cs b/MiraAPI/Roles/CustomRoleConfiguration.cs index cd2220c..a6b1b21 100644 --- a/MiraAPI/Roles/CustomRoleConfiguration.cs +++ b/MiraAPI/Roles/CustomRoleConfiguration.cs @@ -37,6 +37,7 @@ public struct CustomRoleConfiguration CanUseSabotage = role.Team is ModdedRoleTeams.Impostor; TasksCountForProgress = role.Team is ModdedRoleTeams.Crewmate; HideSettings = roleBehaviour?.IsDead == true; + ShowInFreeplay = roleBehaviour?.IsDead == false; CanModifyChance = true; IntroTeamColor = role.Team switch { @@ -128,6 +129,11 @@ public struct CustomRoleConfiguration /// public bool HideSettings; + /// + /// Gets a value indicating whether the role should show up in the Freeplay Role Selection menu. + /// + public bool ShowInFreeplay; + /// /// Gets the color to show during the "Team" part of the intro cutscene. ///