Add ShowInFreeplay configuration

This commit is contained in:
ang-xd committed 2025-02-16 23:13:04 -05:00
1 parent 37446964c5
commit f7c34fb5cd
2 files changed
+9 -3

No files matched your search

+3 -3
View File
@@ -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;
@@ -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;
}
+6
View File
@@ -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
/// </summary>
public bool HideSettings;
/// <summary>
/// Gets a value indicating whether the role should show up in the Freeplay Role Selection menu.
/// </summary>
public bool ShowInFreeplay;
/// <summary>
/// Gets the color to show during the "Team" part of the intro cutscene.
/// </summary>