From 2bb1d41e6575db190ae390fd46e10d2f56467ab4 Mon Sep 17 00:00:00 2001 From: ang-xd Date: Sat, 15 Feb 2025 13:49:38 -0500 Subject: [PATCH] Fix issue #24 --- MiraAPI/Patches/Roles/RoleBehaviourPatch.cs | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 MiraAPI/Patches/Roles/RoleBehaviourPatch.cs diff --git a/MiraAPI/Patches/Roles/RoleBehaviourPatch.cs b/MiraAPI/Patches/Roles/RoleBehaviourPatch.cs new file mode 100644 index 0000000..55cc5a5 --- /dev/null +++ b/MiraAPI/Patches/Roles/RoleBehaviourPatch.cs @@ -0,0 +1,25 @@ +using HarmonyLib; +using MiraAPI.Roles; +using UnityEngine; + +namespace MiraAPI.Patches.Roles; + +[HarmonyPatch(typeof(RoleBehaviour))] +public static class RoleBehaviourPatch +{ + /// + /// Update TeamColor text for Mira roles. + /// + [HarmonyPrefix] + [HarmonyPatch(nameof(RoleBehaviour.TeamColor), MethodType.Getter)] + public static bool PrefixTeamColorGetter(RoleBehaviour __instance, ref Color __result) + { + if (__instance is not ICustomRole behaviour) + { + return true; + } + + __result = behaviour.RoleColor; + return false; + } +} \ No newline at end of file