hail mary fix for s showing up uninvited

This commit is contained in:
Az committed 2026-11-17 00:04:10 -05:00
1 parent 16c6b53a8c
commit 314e108d0e
2 files changed
+49 -1

No files matched your search

+48
View File
@@ -60,4 +60,52 @@ public static class SettingPatches
__result = result;
return false;
}
/// <summary>
/// Prefix for the <see cref="IntGameSetting.GetValueString"/> method. Adds support for custom number suffixes.
/// </summary>
/// <param name="__instance">The <see cref="IntGameSetting"/> instance.</param>
/// <param name="__result">The result of the <see cref="IntGameSetting.GetValueString"/> method.</param>
/// <param name="value">The <see langword="float"/> value.</param>
/// <returns><see langword="false"/> to skip original method.</returns>
[HarmonyPrefix]
[HarmonyPatch(typeof(IntGameSetting), nameof(IntGameSetting.GetValueString))]
public static bool ValueStringPatch(
IntGameSetting __instance,
ref string __result,
[HarmonyArgument(0)] float value)
{
string result;
var suffix = (MiraNumberSuffixes)__instance.SuffixType;
var custom =
ModdedOptionsManager.ModdedOptions.Values.FirstOrDefault(opt =>
opt.OptionBehaviour != null && opt.OptionBehaviour.Data == __instance);
if (custom is ModdedNumberOption moddedNumberOption)
{
if (moddedNumberOption.NegativeWordValue != "#" && (int)value == -1)
{
result = $"<b>{moddedNumberOption.NegativeWordValue}</b>";
}
else if (moddedNumberOption.ZeroWordValue != "#" && Mathf.Abs(value) < 0.0001f)
{
result = $"<b>{moddedNumberOption.ZeroWordValue}</b>";
}
else
{
result = Helpers.FormatValue(value, suffix, __instance.FormatString);
}
}
else if (__instance.ZeroIsInfinity && Mathf.Abs(value) < 0.0001f)
{
result = "<b>∞</b>";
}
else
{
result = Helpers.FormatValue(value, suffix, __instance.FormatString);
}
__result = result;
return false;
}
}
+1 -1
View File
@@ -167,7 +167,7 @@ public sealed class MiraPluginManager
foreach (var type in AccessTools.GetTypesFromAssembly(assembly))
{
if (type.IsDefined<MiraIgnoreAttribute>())
if (type.IsDefined<MiraIgnoreAttribute>() || type.IsDefined<HarmonyAttribute>())
continue;
foreach (var (logContext, handler) in RegistrationHandlers)