mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
26 lines
702 B
C#
26 lines
702 B
C#
using HarmonyLib;
|
|
using MiraAPI.Modifiers;
|
|
using MiraAPI.Roles;
|
|
using UnityEngine;
|
|
|
|
namespace MiraAPI.Patches.Freeplay;
|
|
|
|
[HarmonyPatch(typeof(TaskAddButton))]
|
|
internal static class TaskAddButtonPatches
|
|
{
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch(nameof(TaskAddButton.Start))]
|
|
public static bool StartPrefix(TaskAddButton __instance)
|
|
{
|
|
// if this becomes problematic in the future, find a new method.
|
|
if (uint.TryParse(__instance.name, out var result))
|
|
{
|
|
__instance.Overlay.sprite = __instance.CheckImage;
|
|
__instance.Overlay.enabled = PlayerControl.LocalPlayer.HasModifier(result);
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|