From 7c7d184d1f1bd51adf8be5aed9c6dafdef67a7b9 Mon Sep 17 00:00:00 2001 From: Atony <75191600+AtonyGit@users.noreply.github.com> Date: Wed, 19 Aug 2026 17:24:54 -0500 Subject: [PATCH] Wip faction display for roles These need to be their own text object later. --- MiraAPI/Patches/RoleGuidePatches.cs | 4 ++-- MiraAPI/Roles/ICustomRole.cs | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/MiraAPI/Patches/RoleGuidePatches.cs b/MiraAPI/Patches/RoleGuidePatches.cs index 5f9ab98..e617f96 100644 --- a/MiraAPI/Patches/RoleGuidePatches.cs +++ b/MiraAPI/Patches/RoleGuidePatches.cs @@ -141,14 +141,14 @@ public static class RoleGuidePatches if (role is ICustomRole customRole) { __instance.roleName.text = customRole.RoleName; - __instance.roleDescription.text = customRole.RoleDescription; + __instance.roleDescription.text = $"{customRole.RoleFactionTitle}\n" + customRole.RoleDescription; __instance.roleIcon.sprite = customRole.Configuration.Icon?.LoadAsset(); __instance.roleCount.text += $" ({customRole.ParentMod.MiraPlugin.GetAbbreviatedModName()})"; } else { __instance.roleName.text = role.NiceName; - __instance.roleDescription.text = role.BlurbMed; + __instance.roleDescription.text = $"{TranslationController.Instance.GetString(role.TeamType is RoleTeamTypes.Crewmate ? StringNames.Crewmate : StringNames.Impostor)}\n" + role.BlurbMed; __instance.roleIcon.sprite = role.RoleIconColor; __instance.roleCount.text += " (AU)"; } diff --git a/MiraAPI/Roles/ICustomRole.cs b/MiraAPI/Roles/ICustomRole.cs index c0c97be..fde5a7c 100644 --- a/MiraAPI/Roles/ICustomRole.cs +++ b/MiraAPI/Roles/ICustomRole.cs @@ -28,6 +28,17 @@ public interface ICustomRole : IOptionable /// string RoleLongDescription { get; } + /// + /// Gets the faction / alignment of the role. Used in the role guide. + /// + string RoleFactionTitle => Team switch + { + ModdedRoleTeams.Crewmate => TranslationController.Instance.GetString(StringNames.Crewmate), + ModdedRoleTeams.Impostor => TranslationController.Instance.GetString(StringNames.Impostor), + ModdedRoleTeams.Custom => "Neutral", + _ => "Other", + }; + /// /// Gets the of the role. ///