mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-19 15:51:52 +00:00
Add BetterMinimapColors and BetterColorblindText options
This commit is contained in:
1 parent
3b66d90183
commit
8bf66881ca
9 files changed
+110
-16
No files matched your search
@@ -63,11 +63,21 @@ internal static class BAUConfigs
|
||||
/// </summary>
|
||||
internal static BAUConfigEntry<bool> MinimapIcons { get; } = new("Better Options", "MinimapIcons", true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration entry for new minimap colors setting.
|
||||
/// </summary>
|
||||
internal static BAUConfigEntry<bool> BetterMinimapColors { get; } = new("Better Options", "BetterMinimapColors", true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration entry for vent color groups setting.
|
||||
/// </summary>
|
||||
internal static BAUConfigEntry<bool> VentColorGroups { get; } = new("Better Options", "VentColorGroups", true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration entry for better color blind text setting.
|
||||
/// </summary>
|
||||
internal static BAUConfigEntry<bool> BetterColorblindText { get; } = new("Better Options", "BetterColorblindText", true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration entry for compress settings file setting.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using BetterAmongUs.Attributes;
|
||||
using BetterAmongUs.Data;
|
||||
using BetterAmongUs.Data.Config;
|
||||
using BetterAmongUs.Generated;
|
||||
using BetterAmongUs.Modules.Support;
|
||||
using BetterAmongUs.MonoScripts.Extended;
|
||||
@@ -91,7 +92,14 @@ internal sealed class MeetingInfoDisplay : PlayerInfoDisplay
|
||||
|
||||
if (!BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_CustomColorBlindText))
|
||||
{
|
||||
_pva.ColorBlindName.transform.localPosition = new Vector3(-0.91f, -0.19f, -0.05f);
|
||||
if (BAUConfigs.BetterColorblindText.Value)
|
||||
{
|
||||
_pva.ColorBlindName.transform.localPosition = new Vector3(-0.91f, -0.19f, -0.05f);
|
||||
}
|
||||
else
|
||||
{
|
||||
_pva.ColorBlindName.transform.localPosition = _pva.NameText.transform.localPosition - new Vector3(0f, 0.19f, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
_lastUpdateFrame = Time.frameCount;
|
||||
|
||||
@@ -411,12 +411,20 @@ internal class PlayerInfoDisplay : MonoBehaviour
|
||||
private void UpdateColorBlindTextPosition()
|
||||
{
|
||||
if (BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_CustomColorBlindText))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var text = _player.cosmetics.colorBlindText;
|
||||
if (!text.enabled)
|
||||
return;
|
||||
|
||||
if (!BAUConfigs.BetterColorblindText.Value)
|
||||
{
|
||||
text.transform.localPosition = new Vector3(0f, -0.2f, 0f);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_player.onLadder && !_player.MyPhysics.Animations.IsPlayingAnyLadderAnimation())
|
||||
{
|
||||
text.transform.localPosition = new Vector3(0f, -1.3f, 0.4999f);
|
||||
|
||||
@@ -5,6 +5,7 @@ using BetterAmongUs.Generated;
|
||||
using BetterAmongUs.Managers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.MonoScripts.Extended;
|
||||
using BetterAmongUs.Patches.Gameplay.Player;
|
||||
using BetterAmongUs.Patches.Gameplay.UI;
|
||||
using BetterAmongUs.Patches.Gameplay.UI.Chat;
|
||||
using BetterAmongUs.Utilities;
|
||||
@@ -55,8 +56,10 @@ internal static class OptionsMenuBehaviourPatch
|
||||
ClientOptionItem.CreateToggle(TranslationStrings.BetterOption_UnlockFPS, BAUConfigs.UnlockFPS, 1, __instance, UpdateFrameRate);
|
||||
ClientOptionItem.CreateToggle(TranslationStrings.BetterOption_ShowFPS, BAUConfigs.ShowFPS, 1, __instance);
|
||||
|
||||
ClientOptionItem.CreateToggle(TranslationStrings.BetterOption_VentColorGroups, BAUConfigs.VentColorGroups, 2, __instance, MiniMapBehaviourPatch.ClearMapIcons);
|
||||
ClientOptionItem.CreateToggle(TranslationStrings.BetterOption_MinimapIcons, BAUConfigs.MinimapIcons, 2, __instance, MiniMapBehaviourPatch.ClearMapIcons);
|
||||
ClientOptionItem.CreateToggle(TranslationStrings.BetterOption_MinimapIcons, BAUConfigs.MinimapIcons, 2, __instance, MiniMapBehaviourPatch.ForceCloseMiniMap);
|
||||
ClientOptionItem.CreateToggle(TranslationStrings.BetterOption_BetterMinimapColors, BAUConfigs.BetterMinimapColors, 2, __instance, MiniMapBehaviourPatch.ForceCloseMiniMap);
|
||||
ClientOptionItem.CreateToggle(TranslationStrings.BetterOption_VentColorGroups, BAUConfigs.VentColorGroups, 2, __instance, MiniMapBehaviourPatch.ForceCloseMiniMap);
|
||||
ClientOptionItem.CreateToggle(TranslationStrings.BetterOption_BetterColorblindText, BAUConfigs.BetterColorblindText, 2, __instance, CosmeticsLayerPatch.UpdateAllColorblindText);
|
||||
ClientOptionItem.CreateToggle(TranslationStrings.BetterOption_CompressSettingFiles, BAUConfigs.CompressSettingFiles, 2, __instance, ConvertAllSettingFiles);
|
||||
|
||||
// Button options (no toggle)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using BetterAmongUs.Utilities;
|
||||
using BetterAmongUs.Data.Config;
|
||||
using BetterAmongUs.Modules.Support;
|
||||
using BetterAmongUs.Utilities;
|
||||
using HarmonyLib;
|
||||
|
||||
namespace BetterAmongUs.Patches.Gameplay.Player;
|
||||
@@ -7,11 +8,27 @@ namespace BetterAmongUs.Patches.Gameplay.Player;
|
||||
[HarmonyPatch]
|
||||
internal static class CosmeticsLayerPatch
|
||||
{
|
||||
internal static void UpdateAllColorblindText()
|
||||
{
|
||||
foreach (var player in PlayerControl.AllPlayerControls)
|
||||
{
|
||||
player.cosmetics.colorBlindText.text = player.cosmetics.GetColorBlindText();
|
||||
}
|
||||
|
||||
if (MeetingHud.Instance != null)
|
||||
{
|
||||
foreach (var pva in MeetingHud.Instance.playerStates)
|
||||
{
|
||||
pva.SetColorblindText();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(CosmeticsLayer), nameof(CosmeticsLayer.GetColorBlindText))]
|
||||
[HarmonyPrefix]
|
||||
private static bool CosmeticsLayer_GetColorBlindText_Prefix(CosmeticsLayer __instance, ref string __result)
|
||||
{
|
||||
if (BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_CustomColorBlindText))
|
||||
if (!BAUConfigs.BetterColorblindText.Value || BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_CustomColorBlindText))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ internal static class PlayerControlPatch
|
||||
if (targetPlayer == null)
|
||||
return;
|
||||
|
||||
if (!BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_CustomColorBlindText))
|
||||
if (BAUConfigs.BetterColorblindText.Value && !BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_CustomColorBlindText))
|
||||
{
|
||||
if (targetPlayer.Data.PlayerId == __instance.Data.PlayerId)
|
||||
{
|
||||
|
||||
@@ -20,39 +20,68 @@ internal static class MiniMapBehaviourPatch
|
||||
[HarmonyPatch(typeof(MapBehaviour), nameof(MapBehaviour.ShowNormalMap))]
|
||||
[HarmonyPostfix]
|
||||
private static void MapBehaviour_ShowNormalMap_Postfix(MapBehaviour __instance)
|
||||
=> __instance.ColorControl.SetColor(new Color(0.05f, 0.6f, 1f, 1f)); // Blue tint for normal map
|
||||
{
|
||||
if (!BAUConfigs.BetterMinimapColors.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.ColorControl.SetColor(new Color(0.05f, 0.6f, 1f, 1f));
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MapBehaviour), nameof(MapBehaviour.ShowDetectiveMap))]
|
||||
[HarmonyPostfix]
|
||||
private static void MapBehaviour_ShowDetectiveMap_Postfix(MapBehaviour __instance)
|
||||
=> __instance.ColorControl.SetColor(new Color(0.05f, 0.6f, 1f, 1f)); // Blue tint for detective map
|
||||
{
|
||||
if (!BAUConfigs.BetterMinimapColors.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.ColorControl.SetColor(new Color(0.05f, 0.6f, 1f, 1f));
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MapBehaviour), nameof(MapBehaviour.ShowSabotageMap))]
|
||||
[HarmonyPostfix]
|
||||
private static void MapBehaviour_ShowSabotageMap_Postfix(MapBehaviour __instance)
|
||||
=> __instance.ColorControl.SetColor(new Color(1f, 0.3f, 0f, 1f)); // Orange tint for sabotage map
|
||||
{
|
||||
if (!BAUConfigs.BetterMinimapColors.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.ColorControl.SetColor(new Color(1f, 0.3f, 0f, 1f));
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MapCountOverlay), nameof(MapCountOverlay.OnEnable))]
|
||||
[HarmonyPostfix]
|
||||
private static void MapCountOverlay_OnEnable_Postfix(MapCountOverlay __instance)
|
||||
// Green background normally, gray if comms sabotaged
|
||||
=> __instance.BackgroundColor.SetColor(PlayerTask.PlayerHasTaskOfType<IHudOverrideTask>(PlayerControl.LocalPlayer) ? Palette.DisabledGrey : new Color(0.2f, 0.5f, 0f, 1f));
|
||||
{
|
||||
if (!BAUConfigs.BetterMinimapColors.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
__instance.BackgroundColor.SetColor(PlayerTask.PlayerHasTaskOfType<IHudOverrideTask>(PlayerControl.LocalPlayer) ? Palette.DisabledGrey : new Color(0.2f, 0.5f, 0f, 1f));
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(MapCountOverlay), nameof(MapCountOverlay.Update))]
|
||||
[HarmonyPrefix]
|
||||
private static void MapCountOverlay_Update_Prefix(MapCountOverlay __instance)
|
||||
{
|
||||
// Handle comms sabotage effect on map
|
||||
if (!BAUConfigs.BetterMinimapColors.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (PlayerTask.PlayerHasTaskOfType<IHudOverrideTask>(PlayerControl.LocalPlayer))
|
||||
{
|
||||
// Comms sabotaged - disable map
|
||||
__instance.isSab = true;
|
||||
__instance.BackgroundColor.SetColor(Palette.DisabledGrey);
|
||||
__instance.SabotageText.gameObject.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Comms working - normal map
|
||||
__instance.isSab = false;
|
||||
__instance.BackgroundColor.SetColor(new Color(0.2f, 0.5f, 0f, 1f));
|
||||
__instance.SabotageText.gameObject.SetActive(false);
|
||||
@@ -62,14 +91,21 @@ internal static class MiniMapBehaviourPatch
|
||||
[HarmonyPatch(typeof(MapConsole), nameof(MapConsole.Use))]
|
||||
[HarmonyPostfix]
|
||||
private static void MapConsole_ShowCountOverlay_Postfix()
|
||||
=> MapBehaviour.Instance.ColorControl.SetColor(new Color(0.2f, 0.5f, 0f, 1f)); // Green tint for admin map
|
||||
{
|
||||
if (!BAUConfigs.BetterMinimapColors.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
MapBehaviour.Instance.ColorControl.SetColor(new Color(0.2f, 0.5f, 0f, 1f));
|
||||
}
|
||||
|
||||
private static Transform? _icons; // Container for all custom map icons
|
||||
|
||||
/// <summary>
|
||||
/// Clears all map icons to be regenerated
|
||||
/// </summary>
|
||||
internal static void ClearMapIcons()
|
||||
internal static void ForceCloseMiniMap()
|
||||
{
|
||||
if (_icons != null)
|
||||
{
|
||||
|
||||
@@ -63,6 +63,8 @@
|
||||
"BetterOption.ShowFPS": "ShowFPS",
|
||||
"BetterOption.VentColorGroups": "Vent Color Groups",
|
||||
"BetterOption.MinimapIcons": "Minimap Icons",
|
||||
"BetterOption.BetterMinimapColors": "Better Minimap Colors",
|
||||
"BetterOption.BetterColorblindText": "Better Colorblind Text",
|
||||
"BetterOption.CompressSettingFiles": "Compress Setting Files",
|
||||
|
||||
"BetterOption.SaveData": "Open Save Data",
|
||||
|
||||
@@ -323,6 +323,16 @@ public static class TranslationStrings
|
||||
/// </summary>
|
||||
public static readonly TranslationString BetterOption_MinimapIcons = new("BetterOption.MinimapIcons");
|
||||
|
||||
/// <summary>
|
||||
/// Base Translation: Better Minimap Colors
|
||||
/// </summary>
|
||||
public static readonly TranslationString BetterOption_BetterMinimapColors = new("BetterOption.BetterMinimapColors");
|
||||
|
||||
/// <summary>
|
||||
/// Base Translation: Better Colorblind Text
|
||||
/// </summary>
|
||||
public static readonly TranslationString BetterOption_BetterColorblindText = new("BetterOption.BetterColorblindText");
|
||||
|
||||
/// <summary>
|
||||
/// Base Translation: Compress Setting Files
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user