mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Add ShowInFreeplay configuration
This commit is contained in:
1 parent
37446964c5
commit
f7c34fb5cd
2 files changed
+25
-19
No files matched your search
@@ -1,10 +1,10 @@
|
|||||||
using AmongUs.GameOptions;
|
using AmongUs.GameOptions;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using MiraAPI.PluginLoading;
|
using MiraAPI.PluginLoading;
|
||||||
using MiraAPI.Roles;
|
using MiraAPI.Roles;
|
||||||
using MiraAPI.Utilities.Assets;
|
using MiraAPI.Utilities.Assets;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@@ -186,23 +186,23 @@ public static class TaskAdderPatch
|
|||||||
switch (taskAddButton.MyTask.TaskType)
|
switch (taskAddButton.MyTask.TaskType)
|
||||||
{
|
{
|
||||||
case TaskTypes.DivertPower:
|
case TaskTypes.DivertPower:
|
||||||
{
|
{
|
||||||
var targetSystem = taskAddButton.MyTask.Cast<DivertPowerTask>().TargetSystem;
|
var targetSystem = taskAddButton.MyTask.Cast<DivertPowerTask>().TargetSystem;
|
||||||
taskAddButton.Text.text = TranslationController.Instance.GetString(
|
taskAddButton.Text.text = TranslationController.Instance.GetString(
|
||||||
StringNames.DivertPowerTo,
|
StringNames.DivertPowerTo,
|
||||||
TranslationController.Instance.GetString(targetSystem));
|
TranslationController.Instance.GetString(targetSystem));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TaskTypes.FixWeatherNode:
|
case TaskTypes.FixWeatherNode:
|
||||||
{
|
{
|
||||||
var nodeId = taskAddButton.MyTask.Cast<WeatherNodeTask>().NodeId;
|
var nodeId = taskAddButton.MyTask.Cast<WeatherNodeTask>().NodeId;
|
||||||
taskAddButton.Text.text =
|
taskAddButton.Text.text =
|
||||||
TranslationController.Instance.GetString(
|
TranslationController.Instance.GetString(
|
||||||
StringNames.FixWeatherNode) + " " +
|
StringNames.FixWeatherNode) + " " +
|
||||||
TranslationController.Instance.GetString(
|
TranslationController.Instance.GetString(
|
||||||
WeatherSwitchGame.ControlNames[nodeId]);
|
WeatherSwitchGame.ControlNames[nodeId]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
taskAddButton.Text.text =
|
taskAddButton.Text.text =
|
||||||
TranslationController.Instance.GetString(taskAddButton.MyTask.TaskType);
|
TranslationController.Instance.GetString(taskAddButton.MyTask.TaskType);
|
||||||
@@ -276,7 +276,7 @@ public static class TaskAdderPatch
|
|||||||
{
|
{
|
||||||
var roleBehaviour = plugin.CustomRoles.ElementAt(m).Value;
|
var roleBehaviour = plugin.CustomRoles.ElementAt(m).Value;
|
||||||
if (roleBehaviour.Role == RoleTypes.ImpostorGhost || roleBehaviour.Role == RoleTypes.CrewmateGhost ||
|
if (roleBehaviour.Role == RoleTypes.ImpostorGhost || roleBehaviour.Role == RoleTypes.CrewmateGhost ||
|
||||||
roleBehaviour.IsDead)
|
(roleBehaviour is ICustomRole customRole && !customRole.Configuration.ShowInFreeplay))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public struct CustomRoleConfiguration
|
|||||||
CanUseSabotage = role.Team is ModdedRoleTeams.Impostor;
|
CanUseSabotage = role.Team is ModdedRoleTeams.Impostor;
|
||||||
TasksCountForProgress = role.Team is ModdedRoleTeams.Crewmate;
|
TasksCountForProgress = role.Team is ModdedRoleTeams.Crewmate;
|
||||||
HideSettings = roleBehaviour?.IsDead == true;
|
HideSettings = roleBehaviour?.IsDead == true;
|
||||||
|
ShowInFreeplay = roleBehaviour?.IsDead == false;
|
||||||
CanModifyChance = true;
|
CanModifyChance = true;
|
||||||
IntroTeamColor = role.Team switch
|
IntroTeamColor = role.Team switch
|
||||||
{
|
{
|
||||||
@@ -128,6 +129,11 @@ public struct CustomRoleConfiguration
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HideSettings;
|
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>
|
/// <summary>
|
||||||
/// Gets the color to show during the "Team" part of the intro cutscene.
|
/// Gets the color to show during the "Team" part of the intro cutscene.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in new issue
Block a user