mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-11-19 13:17:10 +00:00
several more options improvements
This commit is contained in:
20 files changed
+156
-195
No files matched your search
@@ -73,7 +73,7 @@ public class HideAndSeekMode : AbstractGameMode
|
||||
|
||||
private static int ImpostorPlayerID()
|
||||
{
|
||||
return OptionGroupSingleton<HnsImpostorOptions>.Instance.SelectedSeeker.Value;
|
||||
return OptionGroupSingleton<HnsImpostorOptions>.Instance.SelectedSeeker;
|
||||
}
|
||||
|
||||
private static bool HasImpostorPlayerID()
|
||||
|
||||
@@ -65,7 +65,7 @@ public class ModdedEnumOptionAttribute(string? title, Type enumType, string idPr
|
||||
public override object GetValue()
|
||||
{
|
||||
return HolderOption is ModdedEnumOption opt
|
||||
? Enum.ToObject(enumType, opt.Value)
|
||||
? Enum.ToObject(enumType, opt.UnderlyingValues[opt.Value])
|
||||
: throw new InvalidOperationException($"HolderOption for option \"{Title}\" is not a ModdedEnumOption with enum type {enumType.FullName}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ModdedEnumOptionListAttribute(string? title, Type enumType, string
|
||||
public override object GetValue(int idx)
|
||||
{
|
||||
return HolderOptionList?.ElementAt(idx) is ModdedEnumOption opt
|
||||
? Enum.ToObject(enumType, opt.Value)
|
||||
? Enum.ToObject(enumType, opt.UnderlyingValues[opt.Value])
|
||||
: throw new InvalidOperationException($"HolderOption for option \"{Titles[idx]}\" is not a ModdedEnumOption with enum type {enumType.FullName}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,7 +428,7 @@ public static class ModdedOptionsManager
|
||||
/// <param name="value">The new object value.</param>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Harmony naming convention.")]
|
||||
[SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Read above.")]
|
||||
[Obsolete("Use PropertySetterPatch<T> instead. This will be removed in a future version.")]
|
||||
[Obsolete("Use PropertySetterPatch<T> instead. This will be removed in a future version.", true)]
|
||||
public static void PropertySetterPatch(MethodBase __originalMethod, object value)
|
||||
{
|
||||
if (!SetterLookup.TryGetValue(__originalMethod.MethodHandle, out var attribute))
|
||||
@@ -470,7 +470,7 @@ public static class ModdedOptionsManager
|
||||
/// <returns><see langword="false"/> so the original getter gets skipped.</returns>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Harmony naming convention")]
|
||||
[SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "Read above.")]
|
||||
[Obsolete("Use PropertyGetterPatch<T> instead. This will be removed in a future version.")]
|
||||
[Obsolete("Use PropertyGetterPatch<T> instead. This will be removed in a future version.", true)]
|
||||
public static bool PropertyGetterPatch(MethodBase __originalMethod, ref object __result)
|
||||
{
|
||||
if (!GetterLookup.TryGetValue(__originalMethod.MethodHandle, out var attribute))
|
||||
|
||||
@@ -101,7 +101,7 @@ public class ModdedEnumOption : ModdedBaseEnumOption<int>
|
||||
/// <inheritdoc />
|
||||
public override NetData GetNetData()
|
||||
{
|
||||
return new(Id, BitConverter.GetBytes(Value));
|
||||
return new(Id, BitConverter.GetBytes(_value));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -186,7 +186,7 @@ public class ModdedEnumOption<T> : ModdedBaseEnumOption<T>
|
||||
public override NetData GetNetData()
|
||||
{
|
||||
var buffer = new byte[Unsafe.SizeOf<T>()];
|
||||
Unsafe.WriteUnaligned(ref buffer[0], Value);
|
||||
Unsafe.WriteUnaligned(ref buffer[0], _value);
|
||||
return new(Id, buffer);
|
||||
}
|
||||
|
||||
|
||||
@@ -282,7 +282,7 @@ public class ModdedNumberOption : ModdedOption<float>
|
||||
/// <inheritdoc />
|
||||
public override NetData GetNetData()
|
||||
{
|
||||
return new NetData(Id, BitConverter.GetBytes(Value));
|
||||
return new NetData(Id, BitConverter.GetBytes(_value));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using BepInEx.Configuration;
|
||||
using MiraAPI.Networking;
|
||||
using MiraAPI.PluginLoading;
|
||||
@@ -14,20 +15,16 @@ namespace MiraAPI.GameOptions.OptionTypes;
|
||||
/// Represents a modded option.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The value type.</typeparam>
|
||||
/// <param name="groupPrefix">The translation ID prefix of the group containing this option.</param>
|
||||
/// <param name="title">The option title.</param>
|
||||
/// <param name="defaultValue">The default value.</param>
|
||||
/// <param name="includeInPreset">Whether to include the option in the preset.</param>
|
||||
public abstract class ModdedOption<T>(string groupPrefix, string title, T defaultValue, bool includeInPreset = true) : IModdedOption
|
||||
public abstract class ModdedOption<T> : IModdedOption
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public uint Id { get; } = ModdedOptionsManager.NextId;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Title { get; set; } = groupPrefix + title;
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public StringNames StringName { get; } = MiraLocaleManager.GetOrCreateLocaleString(groupPrefix + title);
|
||||
public StringNames StringName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the value of the option.
|
||||
@@ -46,18 +43,23 @@ public abstract class ModdedOption<T>(string groupPrefix, string title, T defaul
|
||||
}
|
||||
}
|
||||
|
||||
private T _value = defaultValue;
|
||||
/// <summary>
|
||||
/// The backing value field. Use only for raw and quick comparisons, otherwise use <see cref="Value"/>.
|
||||
/// </summary>
|
||||
[SuppressMessage("Design", "CA1051:Do not declare visible instance fields", Justification = "Useful for raw checks that do not need modifications upon read or write.")]
|
||||
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:Fields should be private", Justification = "Read above.")]
|
||||
protected T _value;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default value of the option.
|
||||
/// </summary>
|
||||
public T DefaultValue { get; } = defaultValue;
|
||||
public T DefaultValue { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public Func<bool> Visible { get; set; } = DelegateUtilities.AlwaysTrue;
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool IncludeInPreset { get; set; } = includeInPreset;
|
||||
public bool IncludeInPreset { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public bool ShowNotification { get; set; } = true;
|
||||
@@ -121,6 +123,23 @@ public abstract class ModdedOption<T>(string groupPrefix, string title, T defaul
|
||||
/// <inheritdoc />
|
||||
public virtual OptionNotifConfiguration Configuration => new(ParentGroup);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModdedOption{T}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="groupPrefix">The translation ID prefix of the group containing this option.</param>
|
||||
/// <param name="title">The option title.</param>
|
||||
/// <param name="defaultValue">The default value.</param>
|
||||
/// <param name="includeInPreset">Whether to include the option in the preset.</param>
|
||||
protected ModdedOption(string groupPrefix, string title, T defaultValue, bool includeInPreset = true)
|
||||
{
|
||||
var translationId = groupPrefix + title;
|
||||
|
||||
Title = translationId;
|
||||
StringName = MiraLocaleManager.GetOrCreateLocaleString(translationId);
|
||||
DefaultValue = _value = defaultValue;
|
||||
IncludeInPreset = includeInPreset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ModdedOption{T}"/> class.
|
||||
/// </summary>
|
||||
|
||||
@@ -129,7 +129,7 @@ public class ModdedPlayerOption : ModdedOption<int>
|
||||
/// <inheritdoc />
|
||||
public override NetData GetNetData()
|
||||
{
|
||||
return new NetData(Id, BitConverter.GetBytes(Value));
|
||||
return new NetData(Id, BitConverter.GetBytes(_value));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -98,7 +98,7 @@ public class ModdedStringOption : ModdedBaseStringOption<string>
|
||||
/// <inheritdoc />
|
||||
public override NetData GetNetData()
|
||||
{
|
||||
return new NetData(Id, Encoding.Unicode.GetBytes(Value));
|
||||
return new NetData(Id, Encoding.Unicode.GetBytes(_value));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ModdedToggleOption : ModdedOption<bool>
|
||||
/// <inheritdoc />
|
||||
public override NetData GetNetData()
|
||||
{
|
||||
return new NetData(Id, BitConverter.GetBytes(Value));
|
||||
return new NetData(Id, BitConverter.GetBytes(_value));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -69,7 +69,7 @@ public sealed class HideAndSeekHudHelper(nint cppPtr) : MonoBehaviour(cppPtr)
|
||||
var item = Helpers.GetAlivePlayers().Count(x => !x.Data.Role.IsImpostor);
|
||||
return !player.inVent && player.Data != null && player.Data.Role != null &&
|
||||
((!player.inVent && player.Data.Role.IsImpostor && IsFinalCountdown &&
|
||||
OptionGroupSingleton<HnsFinalHideOptions>.Instance.FinalHideSeekMap.Value) ||
|
||||
OptionGroupSingleton<HnsFinalHideOptions>.Instance.FinalHideSeekMap) ||
|
||||
(player.Data.Role.IsImpostor &&
|
||||
item <=
|
||||
(GameData.Instance.PlayerCount - 1) / 3));
|
||||
@@ -95,8 +95,8 @@ public sealed class HideAndSeekHudHelper(nint cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// <returns>The match duration in seconds.</returns>
|
||||
public static float GetTotalRoundTime()
|
||||
{
|
||||
var escapeTime = OptionGroupSingleton<HnsCrewmateOptions>.Instance.HidingTime.Value;
|
||||
var finalCountdownTime = OptionGroupSingleton<HnsFinalHideOptions>.Instance.FinalHideTime.Value;
|
||||
var escapeTime = OptionGroupSingleton<HnsCrewmateOptions>.Instance.HidingTime;
|
||||
var finalCountdownTime = OptionGroupSingleton<HnsFinalHideOptions>.Instance.FinalHideTime;
|
||||
return escapeTime + finalCountdownTime;
|
||||
}
|
||||
|
||||
@@ -120,9 +120,9 @@ public sealed class HideAndSeekHudHelper(nint cppPtr) : MonoBehaviour(cppPtr)
|
||||
|
||||
private void Start()
|
||||
{
|
||||
totalHideTime = OptionGroupSingleton<HnsCrewmateOptions>.Instance.HidingTime.Value;
|
||||
totalHideTime = OptionGroupSingleton<HnsCrewmateOptions>.Instance.HidingTime;
|
||||
currentHideTime = totalHideTime;
|
||||
totalFinalHideTime = OptionGroupSingleton<HnsFinalHideOptions>.Instance.FinalHideTime.Value;
|
||||
totalFinalHideTime = OptionGroupSingleton<HnsFinalHideOptions>.Instance.FinalHideTime;
|
||||
currentFinalHideTime = totalFinalHideTime;
|
||||
if (timerBar != null)
|
||||
{
|
||||
|
||||
@@ -137,7 +137,7 @@ public sealed class HnsDangerMeter(nint cppPtr) : MonoBehaviour(cppPtr)
|
||||
|
||||
impostors = [.. Helpers.GetAlivePlayers().Where(x => x.Data.Role.IsImpostor)];
|
||||
|
||||
var baseSpeed = OptionGroupSingleton<HnsCrewmateOptions>.Instance.PlayerSpeed.Value;
|
||||
var baseSpeed = OptionGroupSingleton<HnsCrewmateOptions>.Instance.PlayerSpeed;
|
||||
scaryMusicDistance = 55f * baseSpeed;
|
||||
veryScaryMusicDistance = 15f * baseSpeed;
|
||||
if (scaryMusicDistance >= veryScaryMusicDistance) return;
|
||||
|
||||
@@ -145,7 +145,7 @@ public sealed class HnsMusicHandler(nint cppPtr) : MonoBehaviour(cppPtr)
|
||||
public void StartMusicWithIntro()
|
||||
{
|
||||
if (!PlayerControl.LocalPlayer.Data.Role.IsImpostor) return;
|
||||
var clip = OptionGroupSingleton<HnsCrewmateOptions>.Instance.HidingTime.Value <= 180f
|
||||
var clip = OptionGroupSingleton<HnsCrewmateOptions>.Instance.HidingTime <= 180f
|
||||
? musicCollection.ImpostorShortMusic
|
||||
: musicCollection.ImpostorLongMusic;
|
||||
if (AprilFoolsMode.ShouldHorseAround())
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MiraAPI.GameModes;
|
||||
using MiraAPI.GameOptions;
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using MiraAPI.GameOptions.OptionTypes;
|
||||
using MiraAPI.Utilities;
|
||||
|
||||
@@ -9,108 +10,67 @@ namespace MiraAPI.HnsReimplemented.Options;
|
||||
/// Crewmate options for Hide and Seek.
|
||||
/// </summary>
|
||||
// ReSharper disable once ClassNeverInstantiated.Global (Justification: Instantiated via Activator.CreateInstance.)
|
||||
[SearchPrivate]
|
||||
public class HnsCrewmateOptions : AbstractOptionGroup<HideAndSeekMode>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string GroupName => "Crewmates";
|
||||
public override string GroupName => "MiraApi.Option.Group.HnsCrewmate";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string GroupPrefix => "MiraApi.HnsCrewmate.Option.";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the player speed.
|
||||
/// </summary>
|
||||
public ModdedNumberOption PlayerSpeed { get; } = new(
|
||||
"Player Speed",
|
||||
1f,
|
||||
0.5f,
|
||||
3f,
|
||||
0.25f,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Multiplier,
|
||||
"0.00");
|
||||
[ModdedNumberOption(0.5f, 3f, 0.25f, "#", "#", MiraNumberSuffixes.Multiplier, "0.00")]
|
||||
public float PlayerSpeed { get; } = 1f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hiding time.
|
||||
/// </summary>
|
||||
public ModdedNumberOption HidingTime { get; } = new(
|
||||
"Hiding Time",
|
||||
200,
|
||||
160,
|
||||
300,
|
||||
20,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Seconds);
|
||||
[ModdedNumberOption(160, 300, 20, "#", "#", MiraNumberSuffixes.Seconds)]
|
||||
public float HidingTime { get; } = 200f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the limits of a crewmate's vision.
|
||||
/// </summary>
|
||||
public ModdedNumberOption CrewmateVision { get; } = new(
|
||||
"Crewmate Vision",
|
||||
0.6f,
|
||||
0.25f,
|
||||
1,
|
||||
0.05f,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Multiplier,
|
||||
"0.00");
|
||||
[ModdedNumberOption(0.25f, 1, 0.05f, "#", "#", MiraNumberSuffixes.Multiplier, "0.00")]
|
||||
public float CrewmateVision { get; } = 0.6f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a flag that toggles flashlight vision.
|
||||
/// Gets a value indicating whether flashlight vision is turned on or not.
|
||||
/// </summary>
|
||||
public ModdedToggleOption FlashlightMode { get; } = new(
|
||||
"Flashlight Mode",
|
||||
true);
|
||||
[ModdedToggleOption]
|
||||
public bool FlashlightMode { get; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the range of a crewmate's flashlight.
|
||||
/// </summary>
|
||||
public ModdedNumberOption CrewmateFlashlightSize { get; } = new(
|
||||
"Crewmate Flashlight Size",
|
||||
0.35f,
|
||||
0.1f,
|
||||
0.5f,
|
||||
0.05f,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Multiplier)
|
||||
{
|
||||
Visible = () => OptionGroupSingleton<HnsCrewmateOptions>.Instance.FlashlightMode.Value,
|
||||
};
|
||||
[ModdedNumberOption(0.1f, 0.5f, 0.05f, "#", "#", MiraNumberSuffixes.Multiplier)]
|
||||
[ModdedOptionVisibility(nameof(FlashlightMode))]
|
||||
public float CrewmateFlashlightSize { get; } = 0.35f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum number of times a crewmate can vent.
|
||||
/// </summary>
|
||||
public ModdedNumberOption MaxVentUses { get; } = new(
|
||||
"Max Vent Uses",
|
||||
1,
|
||||
0,
|
||||
5,
|
||||
1,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.None);
|
||||
[ModdedNumberOption(0, 5, 1, "#", "#", MiraNumberSuffixes.None)]
|
||||
public int MaxVentUses { get; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the maximum amount of time a crewmate can spend inside a vent.
|
||||
/// </summary>
|
||||
public ModdedNumberOption MaxTimeInVent { get; } = new(
|
||||
"Max Time in Vent",
|
||||
3,
|
||||
1,
|
||||
10,
|
||||
1,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Seconds)
|
||||
{
|
||||
Visible = () => (int)OptionGroupSingleton<HnsCrewmateOptions>.Instance.MaxVentUses.Value > 0,
|
||||
};
|
||||
[ModdedNumberOption(1, 10, 1, "#", "#", MiraNumberSuffixes.Seconds)]
|
||||
[ModdedOptionVisibility(nameof(LimitedVentUses))]
|
||||
public float MaxTimeInVent { get; } = 3f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the visibility of player names.
|
||||
/// Gets a value indicating whether player names are visible.
|
||||
/// </summary>
|
||||
public ModdedToggleOption ShowNames { get; } = new(
|
||||
"Show Names",
|
||||
false);
|
||||
[ModdedToggleOption]
|
||||
public bool ShowNames { get; } = false;
|
||||
|
||||
private bool LimitedVentUses()
|
||||
{
|
||||
return MaxVentUses > 0;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using MiraAPI.GameModes;
|
||||
using MiraAPI.GameOptions;
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using MiraAPI.GameOptions.OptionTypes;
|
||||
using MiraAPI.Utilities;
|
||||
|
||||
@@ -9,62 +10,43 @@ namespace MiraAPI.HnsReimplemented.Options;
|
||||
/// Final Hide options for Hide and Seek.
|
||||
/// </summary>
|
||||
// ReSharper disable once ClassNeverInstantiated.Global (Justification: Instantiated via Activator.CreateInstance.)
|
||||
[SearchPrivate]
|
||||
public class HnsFinalHideOptions : AbstractOptionGroup<HideAndSeekMode>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string GroupName => "Final Hide";
|
||||
public override string GroupName => "MiraApi.Option.Group.HnsFinalHide";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string GroupPrefix => "MiraApi.HnsFinalHide.Option.";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the duration of the Final Hide phase.
|
||||
/// </summary>
|
||||
public ModdedNumberOption FinalHideTime { get; } = new(
|
||||
"Hiding Time",
|
||||
50,
|
||||
30,
|
||||
120,
|
||||
5,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Seconds);
|
||||
[ModdedNumberOption(30f, 120f, 5f, "#", "#", MiraNumberSuffixes.Seconds)]
|
||||
public float FinalHideTime { get; } = 50f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Seeker's speed when the Final Hide phase begins.
|
||||
/// </summary>
|
||||
public ModdedNumberOption FinalHideImpostorSpeed { get; } = new(
|
||||
"Final Hide Impostor Speed",
|
||||
1.2f,
|
||||
1f,
|
||||
3,
|
||||
0.05f,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Multiplier,
|
||||
"0.00");
|
||||
[ModdedNumberOption(1f, 3f, 0.05f, "#", "#", MiraNumberSuffixes.Multiplier, "0.00")]
|
||||
public float FinalHideImpostorSpeed { get; } = 1.2f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the Seeker sees the Final hide player pings.
|
||||
/// Gets a value indicating whether the Seeker sees the Final hide player pings.
|
||||
/// </summary>
|
||||
public ModdedToggleOption FinalHidePings { get; } = new(
|
||||
"Final Hide Pings",
|
||||
true);
|
||||
[ModdedToggleOption]
|
||||
public bool FinalHidePings { get; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the interval between each ping.
|
||||
/// </summary>
|
||||
public ModdedNumberOption PingInterval { get; } = new(
|
||||
"Ping Interval",
|
||||
6,
|
||||
3,
|
||||
10,
|
||||
5,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Seconds);
|
||||
[ModdedNumberOption(3f, 10f, 5f, "#", "#", MiraNumberSuffixes.Seconds)]
|
||||
[ModdedOptionVisibility(nameof(FinalHidePings))]
|
||||
public float PingInterval { get; } = 6f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the Seeker can see players on an admin map.
|
||||
/// Gets a value indicating whether the Seeker can see players on an admin map.
|
||||
/// </summary>
|
||||
public ModdedToggleOption FinalHideSeekMap { get; } = new(
|
||||
"Final Hide Seek Map",
|
||||
true);
|
||||
[ModdedToggleOption]
|
||||
public bool FinalHideSeekMap { get; } = true;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using MiraAPI.GameModes;
|
||||
using MiraAPI.GameOptions;
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using MiraAPI.GameOptions.OptionTypes;
|
||||
using MiraAPI.Utilities;
|
||||
|
||||
@@ -9,44 +10,36 @@ namespace MiraAPI.HnsReimplemented.Options;
|
||||
/// Seeker settings on Hide and Seek.
|
||||
/// </summary>
|
||||
// ReSharper disable once ClassNeverInstantiated.Global (Justification: Instantiated via Activator.CreateInstance.)
|
||||
[SearchPrivate]
|
||||
public class HnsImpostorOptions : AbstractOptionGroup<HideAndSeekMode>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string GroupName => "Impostors";
|
||||
public override string GroupName => "MiraApi.Option.Group.HnsImpostor";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string GroupPrefix => "MiraApi.HnsImpostor.Option.";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the player who will be the seeker.
|
||||
/// </summary>
|
||||
public ModdedPlayerOption SelectedSeeker { get; } = new(
|
||||
"Forced Impostor");
|
||||
[ModdedPlayerOption]
|
||||
public int SelectedSeeker { get; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the range of a seeker's vision.
|
||||
/// </summary>
|
||||
public ModdedNumberOption ImpostorVision { get; } = new(
|
||||
"Impostor Vision",
|
||||
0.6f,
|
||||
0.25f,
|
||||
1,
|
||||
0.05f,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Multiplier,
|
||||
"0.00");
|
||||
[ModdedNumberOption(0.25f, 1f, 0.05f, "#", "#", MiraNumberSuffixes.Multiplier, "0.00")]
|
||||
public float ImpostorVision { get; } = 0.6f;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the range of a seeker's flashlight.
|
||||
/// </summary>
|
||||
public ModdedNumberOption ImpostorFlashlightSize { get; } = new(
|
||||
"Impostor Flashlight Size",
|
||||
0.35f,
|
||||
0.1f,
|
||||
0.5f,
|
||||
0.05f,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.Multiplier)
|
||||
[ModdedNumberOption(0.1f, 0.5f, 0.05f, "#", "#", MiraNumberSuffixes.Multiplier)]
|
||||
[ModdedOptionVisibility(nameof(IsFlashlightModeEnabled))]
|
||||
public float ImpostorFlashlightSize { get; } = 0.35f;
|
||||
|
||||
private static bool IsFlashlightModeEnabled()
|
||||
{
|
||||
Visible = () => OptionGroupSingleton<HnsCrewmateOptions>.Instance.FlashlightMode.Value,
|
||||
};
|
||||
return OptionGroupSingleton<HnsCrewmateOptions>.Instance.FlashlightMode;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using MiraAPI.GameModes;
|
||||
using MiraAPI.GameOptions;
|
||||
using MiraAPI.GameOptions.Attributes;
|
||||
using MiraAPI.GameOptions.OptionTypes;
|
||||
using MiraAPI.Utilities;
|
||||
|
||||
@@ -9,47 +10,30 @@ namespace MiraAPI.HnsReimplemented.Options;
|
||||
/// Task options for Hide and Seek.
|
||||
/// </summary>
|
||||
// ReSharper disable once ClassNeverInstantiated.Global (Justification: Instantiated via Activator.CreateInstance.)
|
||||
[SearchPrivate]
|
||||
public class HnsTaskOptions : AbstractOptionGroup<HideAndSeekMode>
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string GroupName => "Tasks";
|
||||
public override string GroupName => "MiraApi.Option.Group.HnsTask";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string GroupPrefix => "MiraApi.HnsTask.Option.";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the umber of common tasks.
|
||||
/// Gets the number of common tasks.
|
||||
/// </summary>
|
||||
public ModdedNumberOption CommonTasks { get; } = new(
|
||||
"# Common Tasks",
|
||||
1,
|
||||
0,
|
||||
4,
|
||||
1,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.None);
|
||||
[ModdedNumberOption(0, 4, 1, "#", "#", MiraNumberSuffixes.None)]
|
||||
public int CommonTasks { get; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of long tasks.
|
||||
/// </summary>
|
||||
public ModdedNumberOption LongTasks { get; } = new(
|
||||
"# Long Tasks",
|
||||
1,
|
||||
0,
|
||||
4,
|
||||
1,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.None);
|
||||
[ModdedNumberOption(0, 4, 1, "#", "#", MiraNumberSuffixes.None)]
|
||||
public int LongTasks { get; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the number of short tasks.
|
||||
/// </summary>
|
||||
public ModdedNumberOption ShortTasks { get; } = new(
|
||||
"# Short Tasks",
|
||||
2,
|
||||
0,
|
||||
8,
|
||||
1,
|
||||
"#",
|
||||
"#",
|
||||
MiraNumberSuffixes.None);
|
||||
[ModdedNumberOption(0, 8, 1, "#", "#", MiraNumberSuffixes.None)]
|
||||
public int ShortTasks { get; } = 2;
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Il2CppInterop.Runtime.Attributes;
|
||||
using MiraAPI.GameOptions;
|
||||
using MiraAPI.PluginLoading;
|
||||
using MiraAPI.Roles;
|
||||
|
||||
@@ -26,11 +26,9 @@
|
||||
<string name="MiraApi.CustomOptionMenuDescription">Apply game settings for this mod!</string>
|
||||
<string name="MiraApi.Gamemode">Gamemode</string>
|
||||
<string name="MiraApi.Gamemode.Classic">Classic</string>
|
||||
<string name="MiraApi.Gamemode.Classic.Description">The classic Among Us experience!
|
||||
Find the Impostors or deceive the Crew.</string>
|
||||
<string name="MiraApi.Gamemode.Classic.Description">The classic Among Us experience![nl]Find the Impostors or deceive the Crew.</string>
|
||||
<string name="MiraApi.Gamemode.HideAndSeek">Hide n Seek</string>
|
||||
<string name="MiraApi.Gamemode.HideAndSeek.Description">You can run, but you can't hide!
|
||||
Outlive the timer or eliminate the crew.</string>
|
||||
<string name="MiraApi.Gamemode.HideAndSeek.Description">You can run, but you can't hide![nl]Outlive the timer or eliminate the crew.</string>
|
||||
<string name="MiraApi.GameSetting.Global.ClickToClose">Click to close</string>
|
||||
<string name="MiraApi.GameSetting.Global.ClickToOpen">Click to open</string>
|
||||
<string name="MiraApi.GameSetting.Preset.Hint">Select or create a options preset for this game</string>
|
||||
@@ -78,4 +76,31 @@ Outlive the timer or eliminate the crew.</string>
|
||||
<string name="Activated">Activated</string>
|
||||
<string name="Deactivated">Deactivated</string>
|
||||
<string name="MiraApi.AbbreviatedDistance">unit(s)</string>
|
||||
|
||||
<string name="MiraApi.Option.Group.HnsCrewmate">Crewmates</string>
|
||||
<string name="MiraApi.HnsCrewmate.Option.PlayerSpeed">Player Speed</string>
|
||||
<string name="MiraApi.HnsCrewmate.Option.HidingTime">Hiding Time</string>
|
||||
<string name="MiraApi.HnsCrewmate.Option.CrewmateVision">Crewmate Vision</string>
|
||||
<string name="MiraApi.HnsCrewmate.Option.FlashlightMode">Flashlight Mode</string>
|
||||
<string name="MiraApi.HnsCrewmate.Option.CrewmateFlashlightSize">Crewmate Flashlight Size</string>
|
||||
<string name="MiraApi.HnsCrewmate.Option.MaxVentUses">Max Vent Uses</string>
|
||||
<string name="MiraApi.HnsCrewmate.Option.MaxTimeInVent">Max Time In Vent</string>
|
||||
<string name="MiraApi.HnsCrewmate.Option.ShowNames">Show Names</string>
|
||||
|
||||
<string name="MiraApi.Option.Group.HnsFinalHide">Final Hide</string>
|
||||
<string name="MiraApi.HnsFinalHide.Option.FinalHideTime">Hiding Time</string>
|
||||
<string name="MiraApi.HnsFinalHide.Option.FinalHideImpostorSpeed">Final Hide Impostor Speed</string>
|
||||
<string name="MiraApi.HnsFinalHide.Option.FinalHidePings">Final Hide Pings</string>
|
||||
<string name="MiraApi.HnsFinalHide.Option.PingInterval">Ping Interval</string>
|
||||
<string name="MiraApi.HnsFinalHide.Option.FinalHideSeekMap">Final Hide Seek Map</string>
|
||||
|
||||
<string name="MiraApi.Option.Group.HnsImpostor">Impostors</string>
|
||||
<string name="MiraApi.HnsImpostor.Option.SelectedSeeker">Forced Impostor</string>
|
||||
<string name="MiraApi.HnsImpostor.Option.ImpostorVision">Impostor Vision</string>
|
||||
<string name="MiraApi.HnsImpostor.Option.ImpostorFlashlightSize">Impostor Flashlight Size</string>
|
||||
|
||||
<string name="MiraApi.Option.Group.HnsTask">Tasks</string>
|
||||
<string name="MiraApi.HnsTask.Option.CommonTasks"># Common Tasks</string>
|
||||
<string name="MiraApi.HnsTask.Option.LongTasks"># Long Tasks</string>
|
||||
<string name="MiraApi.HnsTask.Option.ShortTasks"># Short Tasks</string>
|
||||
</resources>
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using AmongUs.GameOptions;
|
||||
using Il2CppInterop.Runtime.Attributes;
|
||||
using MiraAPI.GameModes;
|
||||
using MiraAPI.Patches.Freeplay;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
|
||||
Reference in new issue
Block a user