mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Replaced true, false, and null with langword annotations
This commit is contained in:
1 parent
adb9a2823d
commit
8852c014ab
25 files changed
+105
-105
No files matched your search
@@ -17,7 +17,7 @@ public static class MiraEventManager
|
||||
/// </summary>
|
||||
/// <param name="eventInstance">The <typeparamref name="T"/> instance.</param>
|
||||
/// <typeparam name="T">Type of Event.</typeparam>
|
||||
/// <returns>If there was an event handler invoked for this event, return true. Otherwise, return false.</returns>
|
||||
/// <returns>If there was an event handler invoked for this event, return <see langword="true"/>. Otherwise, return <see langword="false"/>.</returns>
|
||||
public static bool InvokeEvent<T>(T eventInstance) where T : MiraEvent
|
||||
{
|
||||
EventWrappers.TryGetValue(typeof(T), out var handlers);
|
||||
@@ -46,7 +46,7 @@ public static class MiraEventManager
|
||||
/// </summary>
|
||||
/// <param name="eventInstance">The <see cref="MiraEvent"/> instance.</param>
|
||||
/// <param name="type">The type to use for handler lookup.</param>
|
||||
/// <returns>If there was an event handler invoked for this event, return true. Otherwise, return false.</returns>
|
||||
/// <returns>If there was an event handler invoked for this event, return <see langword="true"/>. Otherwise, return <see langword="false"/>.</returns>
|
||||
public static bool InvokeEvent(MiraEvent eventInstance, Type type)
|
||||
{
|
||||
EventWrappers.TryGetValue(type, out var handlers);
|
||||
@@ -130,7 +130,7 @@ public static class MiraEventManager
|
||||
/// Unregister a <see cref="MiraEvent"/> handler using the <see cref="MiraEventHandle"/>.
|
||||
/// </summary>
|
||||
/// <param name="eventHandle">A handle to the event.</param>
|
||||
/// <returns>True if the event was unregistered successfully, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the event was unregistered successfully, <see langword="false"/> otherwise.</returns>
|
||||
public static bool UnregisterEventHandler(MiraEventHandle eventHandle)
|
||||
{
|
||||
if (!EventWrappers.TryGetValue(eventHandle.EventType, out var handlers))
|
||||
|
||||
@@ -12,12 +12,12 @@ public class ReportBodyEvent : MiraCancelableEvent
|
||||
public PlayerControl Reporter { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the player that is being reported. Will be null for emergency meeting.
|
||||
/// Gets the player that is being reported. Will be <see langword="null"/> for emergency meeting.
|
||||
/// </summary>
|
||||
public NetworkedPlayerInfo? Target { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="DeadBody"/> that is being reported. Will be null for emergency meeting.
|
||||
/// Gets the <see cref="DeadBody"/> that is being reported. Will be <see langword="null"/> for emergency meeting.
|
||||
/// </summary>
|
||||
public DeadBody? Body { get; }
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public class CheckForEndVotingEvent : MiraCancelableEvent
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CheckForEndVotingEvent"/> class.
|
||||
/// </summary>
|
||||
/// <param name="isVotingComplete">>True if voting is complete, false otherwise.</param>
|
||||
/// <param name="isVotingComplete">><see langword="true"/> if voting is complete, <see langword="false"/> otherwise.</param>
|
||||
public CheckForEndVotingEvent(bool isVotingComplete)
|
||||
{
|
||||
IsVotingComplete = isVotingComplete;
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace MiraAPI.Events.Vanilla.Meeting.Voting;
|
||||
/// Initializes a new instance of the <see cref="ProcessVotesEvent"/> class.
|
||||
/// </remarks>
|
||||
/// <param name="votes">>The list of <see cref="CustomVote"/>s that are being processed.</param>
|
||||
/// <param name="exiledPlayer">The player to be exiled. Will be null if no player is to be exiled.</param>
|
||||
/// <param name="exiledPlayer">The player to be exiled. Will be <see langword="null"/> if no player is to be exiled.</param>
|
||||
public class ProcessVotesEvent(List<CustomVote> votes, NetworkedPlayerInfo? exiledPlayer = null) : MiraEvent
|
||||
{
|
||||
private readonly List<CustomVote> _originalVotes = [.. votes];
|
||||
@@ -34,7 +34,7 @@ public class ProcessVotesEvent(List<CustomVote> votes, NetworkedPlayerInfo? exil
|
||||
public List<CustomVote> Votes { get; } = votes;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the player to be exiled. Will be null if no player is to be exiled.
|
||||
/// Gets or sets the player to be exiled. Will be <see langword="null"/> if no player is to be exiled.
|
||||
/// </summary>
|
||||
public NetworkedPlayerInfo? ExiledPlayer
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ public abstract class CustomGameOver
|
||||
/// </summary>
|
||||
/// <param name="playerControl">The <see cref="PlayerControl"/> that requested the Game Over.</param>
|
||||
/// <param name="winners">The collection of winners.</param>
|
||||
/// <returns>True if the condition is met, otherwise false.</returns>
|
||||
/// <returns><see langword="true"/> if the condition is met, otherwise <see langword="false"/>.</returns>
|
||||
public virtual bool VerifyCondition(PlayerControl playerControl, NetworkedPlayerInfo[] winners)
|
||||
{
|
||||
return true;
|
||||
@@ -29,7 +29,7 @@ public abstract class CustomGameOver
|
||||
/// Runs before the base game calls <see cref="EndGameManager.SetEverythingUp"/>.
|
||||
/// </summary>
|
||||
/// <param name="endGameManager">The <see cref="EndGameManager"/> instance.</param>
|
||||
/// <returns>Return True to use the run the original method, return False to skip it.</returns>
|
||||
/// <returns>Return <see langword="true"/> to use the run the original method, return <see langword="false"/> to skip it.</returns>
|
||||
public virtual bool BeforeEndGameSetup(EndGameManager endGameManager)
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -20,7 +20,7 @@ public static class GameOverManager
|
||||
/// </summary>
|
||||
/// <param name="gameOverType">Type of the <see cref="CustomGameOver"/>.</param>
|
||||
/// <exception cref="ArgumentException">Thrown when the type is not a subclass of <see cref="CustomGameOver"/>, is abstract, or does not have a parameterless constructor.</exception>
|
||||
/// <returns>>True if the game over was registered successfully, false otherwise.</returns>
|
||||
/// <returns>><see langword="true"/> if the game over was registered successfully, <see langword="false"/> otherwise.</returns>
|
||||
public static bool RegisterGameOver(Type gameOverType)
|
||||
{
|
||||
if (!typeof(CustomGameOver).IsAssignableFrom(gameOverType))
|
||||
|
||||
@@ -88,60 +88,60 @@ public abstract class CustomGameMode
|
||||
/// <summary>
|
||||
/// Should Roles Settings be available when this gamemode is selected.
|
||||
/// </summary>
|
||||
/// <returns>True if Role Settings are enabled in this game mode.</returns>
|
||||
/// <returns><see langword="true"/> if Role Settings are enabled in this game mode.</returns>
|
||||
public virtual bool AreRoleSettingsEnabled() => true;
|
||||
|
||||
/// <summary>
|
||||
/// Should Game Settings be available when this gamemode is selected.
|
||||
/// </summary>
|
||||
/// <returns>True if Game Settings are enabled in this mode.</returns>
|
||||
/// <returns><see langword="true"/> if Game Settings are enabled in this mode.</returns>
|
||||
public virtual bool AreGameSettingsEnabled() => true;
|
||||
|
||||
/// <summary>
|
||||
/// Custom winner selection.
|
||||
/// </summary>
|
||||
/// <returns>List of winners or null.</returns>
|
||||
/// <returns>List of winners or <see langword="null"/>.</returns>
|
||||
public virtual List<NetworkedPlayerInfo>? CalculateWinners() => null;
|
||||
|
||||
/// <summary>
|
||||
/// Show gamemode in <see cref="IntroCutscene"/>.
|
||||
/// </summary>
|
||||
/// <returns>True if the game mode should be shown in the intro cutscene.</returns>
|
||||
/// <returns><see langword="true"/> if the game mode should be shown in the intro cutscene.</returns>
|
||||
public virtual bool ShowGameModeIntroCutscene() => false;
|
||||
|
||||
/// <summary>
|
||||
/// Can Admin be used in this gamemode.
|
||||
/// </summary>
|
||||
/// <param name="console">Admin Console.</param>
|
||||
/// <returns>True if Admin console is enabled.</returns>
|
||||
/// <returns><see langword="true"/> if Admin console is enabled.</returns>
|
||||
public virtual bool CanUseMapConsole(MapConsole console) => true;
|
||||
|
||||
/// <summary>
|
||||
/// Can a <see cref="DeadBody"/> be reported in this gamemode.
|
||||
/// </summary>
|
||||
/// <param name="body">Target <see cref="DeadBody"/> for reporting.</param>
|
||||
/// <returns>True if <see cref="DeadBody"/>s can be reported.</returns>
|
||||
/// <returns><see langword="true"/> if <see cref="DeadBody"/>s can be reported.</returns>
|
||||
public virtual bool CanReport(DeadBody body) => true;
|
||||
|
||||
/// <summary>
|
||||
/// Can <see cref="SystemConsole"/>s be used in this gamemode.
|
||||
/// </summary>
|
||||
/// <param name="console">System Console.</param>
|
||||
/// <returns>True if <see cref="SystemConsole"/>s are enabled in this mode.</returns>
|
||||
/// <returns><see langword="true"/> if <see cref="SystemConsole"/>s are enabled in this mode.</returns>
|
||||
public virtual bool CanUseSystemConsole(SystemConsole console) => true;
|
||||
|
||||
/// <summary>
|
||||
/// Can tasks be interacted with in this gamemode.
|
||||
/// </summary>
|
||||
/// <param name="console">Task console.</param>
|
||||
/// <returns>True if tasks are enabled in this mode.</returns>
|
||||
/// <returns><see langword="true"/> if tasks are enabled in this mode.</returns>
|
||||
public virtual bool CanUseTasks(Console console) => true;
|
||||
|
||||
/// <summary>
|
||||
/// Should the sabotage map be used when attempting to open sabotage overlay.
|
||||
/// </summary>
|
||||
/// <param name="map"><see cref="MapBehaviour"/> object.</param>
|
||||
/// <returns>True if the sabotage map should be shown.</returns>
|
||||
/// <returns><see langword="true"/> if the sabotage map should be shown.</returns>
|
||||
public virtual bool ShouldShowSabotageMap(MapBehaviour map) => true;
|
||||
|
||||
/// <summary>
|
||||
@@ -149,6 +149,6 @@ public abstract class CustomGameMode
|
||||
/// </summary>
|
||||
/// <param name="vent">Target vent.</param>
|
||||
/// <param name="playerInfo">Player attempting to vent.</param>
|
||||
/// <returns>True if venting is enabled in this mode.</returns>
|
||||
/// <returns><see langword="true"/> if venting is enabled in this mode.</returns>
|
||||
public virtual bool CanVent(Vent vent, NetworkedPlayerInfo playerInfo) => true;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ public static class ModdedOptionsManager
|
||||
/// </summary>
|
||||
/// <param name="__originalMethod">The original getter method.</param>
|
||||
/// <param name="__result">The result of the property getter.</param>
|
||||
/// <returns>False so the original getter gets skipped.</returns>
|
||||
/// <returns><see langword="false"/> so the original getter gets skipped.</returns>
|
||||
#pragma warning disable CA1707
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming", Justification = "Harmony naming convention")]
|
||||
public static bool PropertyGetterPatch(MethodBase __originalMethod, ref object __result)
|
||||
|
||||
@@ -91,9 +91,9 @@ public class ModdedPlayerOption : ModdedOption<int>
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a player from the value. If <see cref="AllowNone"/> is enabled and none is enabled this will return null.
|
||||
/// Returns a player from the value. If <see cref="AllowNone"/> is enabled and none is enabled this will return <see langword="null"/>.
|
||||
/// </summary>
|
||||
/// <returns>A player or null if chosen none.</returns>
|
||||
/// <returns>A player or <see langword="null"/> if chosen none.</returns>
|
||||
public NetworkedPlayerInfo? GetPlayerValue()
|
||||
{
|
||||
return Value < 0 ? null : Values[Value];
|
||||
|
||||
@@ -54,7 +54,7 @@ public abstract class CustomActionButton
|
||||
public virtual string CooldownTimerFormatString => "0";
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the button has an effect ability. By default true if <see cref="EffectDuration"/> is greater than 0.
|
||||
/// Gets a value indicating whether the button has an effect ability. By default <see langword="true"/> if <see cref="EffectDuration"/> is greater than 0.
|
||||
/// </summary>
|
||||
public virtual bool HasEffect => EffectDuration > 0;
|
||||
|
||||
@@ -79,7 +79,7 @@ public abstract class CustomActionButton
|
||||
public virtual ButtonUsesMode UsesMode => ButtonUsesMode.PerGame;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the keybind for this button. If null, no keybind will be added.
|
||||
/// Gets the keybind for this button. If <see langword="null"/>, no keybind will be added.
|
||||
/// </summary>
|
||||
public virtual BaseKeybind? Keybind => null;
|
||||
|
||||
@@ -429,10 +429,10 @@ public abstract class CustomActionButton
|
||||
|
||||
/// <summary>
|
||||
/// This method determines if the button should be active or not.
|
||||
/// True means the button is active, false means the button is disabled.
|
||||
/// <see langword="true"/> means the button is active, <see langword="false"/> means the button is disabled.
|
||||
/// </summary>
|
||||
/// <param name="role">The <see cref="RoleBehaviour"/> of the local player.</param>
|
||||
/// <returns>True if the button is enabled, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the button is enabled, <see langword="false"/> otherwise.</returns>
|
||||
public abstract bool Enabled(RoleBehaviour? role);
|
||||
|
||||
/// <summary>
|
||||
@@ -445,7 +445,7 @@ public abstract class CustomActionButton
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value indicating whether the effect can be ended early by the player.
|
||||
/// Always false by default.
|
||||
/// Always <see langword="false"/> by default.
|
||||
/// </summary>
|
||||
/// <returns>Can the effect be canceled.</returns>
|
||||
public virtual bool IsEffectCancellable() => false;
|
||||
@@ -474,7 +474,7 @@ public abstract class CustomActionButton
|
||||
|
||||
/// <summary>
|
||||
/// This method is called on the <see cref="HudManager.SetHudActive(PlayerControl, RoleBehaviour, bool)"/> method. It determines whether the button should be visible or not.
|
||||
/// The default behavior is to show the button if the <paramref name="visible"/> parameter and the <see cref="Enabled"/> method return true.
|
||||
/// The default behavior is to show the button if the <paramref name="visible"/> parameter and the <see cref="Enabled"/> method return <see langword="true"/>.
|
||||
/// It can be overridden for custom behavior.
|
||||
/// </summary>
|
||||
/// <param name="visible">Passed in from <see cref="HudManager.SetHudActive(PlayerControl, RoleBehaviour, bool)"/>, should hud be active.</param>
|
||||
@@ -599,7 +599,7 @@ public abstract class CustomActionButton<T> : CustomActionButton where T : MonoB
|
||||
/// Determines if the target <typeparamref name="T"/> is valid.
|
||||
/// </summary>
|
||||
/// <param name="target">The target <typeparamref name="T"/> being checked.</param>
|
||||
/// <returns>True if the target <typeparamref name="T"/> is valid, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the target <typeparamref name="T"/> is valid, <see langword="false"/> otherwise.</returns>
|
||||
public virtual bool IsTargetValid(T? target)
|
||||
{
|
||||
return target != null;
|
||||
@@ -608,7 +608,7 @@ public abstract class CustomActionButton<T> : CustomActionButton where T : MonoB
|
||||
/// <summary>
|
||||
/// The method used to get the target <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <returns>The target <typeparamref name="T"/> or null if it isn't found.</returns>
|
||||
/// <returns>The target <typeparamref name="T"/> or <see langword="null"/> if it isn't found.</returns>
|
||||
public abstract T? GetTarget();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -17,8 +17,8 @@ public static class ModCompatibility
|
||||
/// <summary>
|
||||
/// Checks if the Submerged mod is loaded.
|
||||
/// </summary>
|
||||
/// <param name="submergedAssembly">Submerged mod assembly if loaded, null otherwise.</param>
|
||||
/// <returns>True if the Submerged mod is loaded, false otherwise.</returns>
|
||||
/// <param name="submergedAssembly">Submerged mod assembly if loaded, <see langword="null"/> otherwise.</param>
|
||||
/// <returns><see langword="true"/> if the Submerged mod is loaded, <see langword="false"/> otherwise.</returns>
|
||||
public static bool SubmergedLoaded([NotNullWhen(true)] out Assembly? submergedAssembly)
|
||||
{
|
||||
var result = IL2CPPChainloader.Instance.Plugins.TryGetValue(SubmergedId, out var plugin);
|
||||
|
||||
@@ -50,7 +50,7 @@ public abstract class BaseModifier : IOptionable
|
||||
public abstract string ModifierName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the modifier icon. Useless if <see cref="HideOnUi"/> is true.
|
||||
/// Gets the modifier icon. Useless if <see cref="HideOnUi"/> is <see langword="true"/>.
|
||||
/// </summary>
|
||||
public virtual LoadableAsset<Sprite>? ModifierIcon => null;
|
||||
|
||||
@@ -70,12 +70,12 @@ public abstract class BaseModifier : IOptionable
|
||||
public virtual Color FreeplayFileColor => Color.gray;
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the modifier is unique. If true, the player can only have one instance of this modifier.
|
||||
/// Gets a value indicating whether the modifier is unique. If <see langword="true"/>, the player can only have one instance of this modifier.
|
||||
/// </summary>
|
||||
public virtual bool Unique => true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the HUD description for this modifier. Does nothing if <see cref="HideOnUi"/> is true. Required to be visible on UI.
|
||||
/// Gets the HUD description for this modifier. Does nothing if <see cref="HideOnUi"/> is <see langword="true"/>. Required to be visible on UI.
|
||||
/// </summary>
|
||||
/// <returns>The description string for the HUD.</returns>
|
||||
public virtual string GetDescription() => string.Empty;
|
||||
@@ -126,6 +126,6 @@ public abstract class BaseModifier : IOptionable
|
||||
/// <summary>
|
||||
/// Determines whether the player can vent.
|
||||
/// </summary>
|
||||
/// <returns>True if the player can vent, false otherwise. Null for no effect.</returns>
|
||||
/// <returns><see langword="true"/> if the player can vent, <see langword="false"/> otherwise. <see langword="null"/> for no effect.</returns>
|
||||
public virtual bool? CanVent() => null;
|
||||
}
|
||||
@@ -206,10 +206,10 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// <summary>
|
||||
/// Tries to get a <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <param name="modifier">The <typeparamref name="T"/> or null.</param>
|
||||
/// <param name="modifier">The <typeparamref name="T"/> or <see langword="null"/>.</param>
|
||||
/// <param name="predicate">The predicate to check the <typeparamref name="T"/> by.</param>
|
||||
/// <typeparam name="T">The Type of the <see cref="BaseModifier"/>.</typeparam>
|
||||
/// <returns>True if the <typeparamref name="T"/> was found, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <typeparamref name="T"/> was found, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool TryGetModifier<T>([NotNullWhen(true)] out T? modifier, Func<T, bool>? predicate = null) where T : BaseModifier
|
||||
{
|
||||
@@ -221,9 +221,9 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// Tries to get a <see cref="BaseModifier"/> by its type.
|
||||
/// </summary>
|
||||
/// <param name="type">The modifier type.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or null.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or <see langword="null"/>.</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/> by.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> was found, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> was found, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool TryGetModifier(Type type, [NotNullWhen(true)] out BaseModifier? modifier, Func<BaseModifier, bool>? predicate = null)
|
||||
{
|
||||
@@ -235,9 +235,9 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// Tries to get a <see cref="BaseModifier"/> by its type ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="BaseModifier"/>'s type ID.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or null.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or <see langword="null"/>.</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/> by.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> was found, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> was found, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool TryGetModifier(uint id, [NotNullWhen(true)] out BaseModifier? modifier, Func<BaseModifier, bool>? predicate = null)
|
||||
{
|
||||
@@ -249,8 +249,8 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// Tries to get a <see cref="BaseModifier"/> by its unique ID.
|
||||
/// </summary>
|
||||
/// <param name="modifierGuid">The <see cref="BaseModifier"/>'s unique ID.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or null.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> was found, false otherwise.</returns>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or <see langword="null"/>.</param>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> was found, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool TryGetModifier(Guid modifierGuid, [NotNullWhen(true)] out BaseModifier? modifier)
|
||||
{
|
||||
@@ -263,7 +263,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate to check the <typeparamref name="T"/> by.</param>
|
||||
/// <typeparam name="T">The Type of the <see cref="BaseModifier"/>.</typeparam>
|
||||
/// <returns>The <typeparamref name="T"/> if it is found, null otherwise.</returns>
|
||||
/// <returns>The <typeparamref name="T"/> if it is found, <see langword="null"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public T? GetModifier<T>(Func<T, bool>? predicate = null) where T : BaseModifier
|
||||
{
|
||||
@@ -275,7 +275,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// </summary>
|
||||
/// <param name="type">The modifier type.</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/> by.</param>
|
||||
/// <returns>The <see cref="BaseModifier"/> if it is found, null otherwise.</returns>
|
||||
/// <returns>The <see cref="BaseModifier"/> if it is found, <see langword="null"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public BaseModifier? GetModifier(Type type, Func<BaseModifier, bool>? predicate = null)
|
||||
{
|
||||
@@ -287,7 +287,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="BaseModifier"/> ID.</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/> by.</param>
|
||||
/// <returns>The <see cref="BaseModifier"/> if it is found, null otherwise.</returns>
|
||||
/// <returns>The <see cref="BaseModifier"/> if it is found, <see langword="null"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public BaseModifier? GetModifier(uint id, Func<BaseModifier, bool>? predicate = null)
|
||||
{
|
||||
@@ -301,7 +301,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// Gets a <see cref="BaseModifier"/> by unique ID.
|
||||
/// </summary>
|
||||
/// <param name="modifierGuid">The <see cref="BaseModifier"/>'s unique ID.</param>
|
||||
/// <returns>The <see cref="BaseModifier"/> if it is found, or null.</returns>
|
||||
/// <returns>The <see cref="BaseModifier"/> if it is found, or <see langword="null"/>.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public BaseModifier? GetModifier(Guid modifierGuid)
|
||||
{
|
||||
@@ -469,7 +469,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// </summary>
|
||||
/// <param name="id">The ID of the <see cref="BaseModifier"/>.</param>
|
||||
/// <param name="args">The arguments to initialize the <see cref="BaseModifier"/> with.</param>
|
||||
/// <returns>The <see cref="BaseModifier"/> if it was created, or null if it failed.</returns>
|
||||
/// <returns>The <see cref="BaseModifier"/> if it was created, or <see langword="null"/> if it failed.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public BaseModifier? AddModifier(uint id, params object[] args)
|
||||
{
|
||||
@@ -484,7 +484,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// </summary>
|
||||
/// <param name="predicate">The predicate to check the <typeparamref name="T"/>.</param>
|
||||
/// <typeparam name="T">The Type of the <see cref="BaseModifier"/>.</typeparam>
|
||||
/// <returns>True if the <typeparamref name="T"/> is present, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <typeparamref name="T"/> is present, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool HasModifier<T>(Func<T, bool>? predicate=null) where T : BaseModifier
|
||||
{
|
||||
@@ -496,7 +496,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// </summary>
|
||||
/// <param name="type">The modifier type.</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/>.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> is present, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> is present, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool HasModifier(Type type, Func<BaseModifier, bool>? predicate=null)
|
||||
{
|
||||
@@ -508,7 +508,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="BaseModifier"/>'s type ID.</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/>.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> is present, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> is present, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool HasModifier(uint id, Func<BaseModifier, bool>? predicate=null)
|
||||
{
|
||||
@@ -522,7 +522,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// Checks if a player has an active <see cref="BaseModifier"/> by its unique ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="BaseModifier"/>'s guid.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> is present, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> is present, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool HasModifier(Guid id)
|
||||
{
|
||||
@@ -535,7 +535,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// <param name="checkInactive">Whether to check inactive <typeparamref name="T"/>s (those pending to be added).</param>
|
||||
/// <param name="predicate">The predicate to check the <typeparamref name="T"/>.</param>
|
||||
/// <typeparam name="T">The Type of the <see cref="BaseModifier"/>.</typeparam>
|
||||
/// <returns>True if the <typeparamref name="T"/> is present, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <typeparamref name="T"/> is present, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool HasModifier<T>(bool checkInactive, Func<T, bool>? predicate=null) where T : BaseModifier
|
||||
{
|
||||
@@ -549,7 +549,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// <param name="type">The modifier type.</param>
|
||||
/// <param name="checkInactive">Whether to check inactive <see cref="BaseModifier"/>s (those pending to be added).</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/>.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> is present, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> is present, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool HasModifier(Type type, bool checkInactive, Func<BaseModifier, bool>? predicate=null)
|
||||
{
|
||||
@@ -563,7 +563,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// <param name="id">The <see cref="BaseModifier"/>'s type ID.</param>
|
||||
/// <param name="checkInactive">Whether to check inactive <see cref="BaseModifier"/>s (those pending to be added).</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/>.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> is present, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> is present, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool HasModifier(uint id, bool checkInactive, Func<BaseModifier, bool>? predicate=null)
|
||||
{
|
||||
@@ -578,7 +578,7 @@ public class ModifierComponent(IntPtr cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// </summary>
|
||||
/// <param name="id">The <see cref="BaseModifier"/>'s guid.</param>
|
||||
/// <param name="checkInactive">Whether to check inactive <see cref="BaseModifier"/>s (those pending to be added).</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> is present, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> is present, <see langword="false"/> otherwise.</returns>
|
||||
[HideFromIl2Cpp]
|
||||
public bool HasModifier(Guid id, bool checkInactive)
|
||||
{
|
||||
|
||||
@@ -123,7 +123,7 @@ public static class ModifierExtensions
|
||||
/// Gets the <see cref="ModifierComponent"/> for a <see cref="PlayerControl"/>.
|
||||
/// </summary>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> object.</param>
|
||||
/// <returns>A <see cref="ModifierComponent"/> if there is one, null otherwise.</returns>
|
||||
/// <returns>A <see cref="ModifierComponent"/> if there is one, <see langword="null"/> otherwise.</returns>
|
||||
public static ModifierComponent GetModifierComponent(this PlayerControl player)
|
||||
{
|
||||
if (ModifierComponents.TryGetValue(player, out var component))
|
||||
@@ -147,7 +147,7 @@ public static class ModifierExtensions
|
||||
/// <typeparam name="T">The type of the <see cref="BaseModifier"/>.</typeparam>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="predicate">Optional predicate to filter the <see cref="BaseModifier"/>s.</param>
|
||||
/// <returns>True if the <see cref="PlayerControl"/> has the <typeparamref name="T"/>, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="PlayerControl"/> has the <typeparamref name="T"/>, <see langword="false"/> otherwise.</returns>
|
||||
public static bool HasModifier<T>(this PlayerControl player, Func<T, bool>? predicate = null) where T : BaseModifier
|
||||
{
|
||||
return player.GetModifierComponent().HasModifier(predicate);
|
||||
@@ -159,7 +159,7 @@ public static class ModifierExtensions
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="type">The type of the modifier.</param>
|
||||
/// <param name="predicate">Optional predicate to filter the <see cref="BaseModifier"/>s.</param>
|
||||
/// <returns>True if the <see cref="PlayerControl"/> has the <see cref="BaseModifier"/>, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="PlayerControl"/> has the <see cref="BaseModifier"/>, <see langword="false"/> otherwise.</returns>
|
||||
public static bool HasModifier(this PlayerControl player, Type type, Func<BaseModifier, bool>? predicate = null)
|
||||
{
|
||||
return player.GetModifierComponent().HasModifier(type, predicate);
|
||||
@@ -171,7 +171,7 @@ public static class ModifierExtensions
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="typeId">The type ID of the <see cref="BaseModifier"/>.</param>
|
||||
/// <param name="predicate">Optional predicate to filter the <see cref="BaseModifier"/>s.</param>
|
||||
/// <returns>True if the <see cref="PlayerControl"/> has the <see cref="BaseModifier"/>, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="PlayerControl"/> has the <see cref="BaseModifier"/>, <see langword="false"/> otherwise.</returns>
|
||||
public static bool HasModifier(
|
||||
this PlayerControl player,
|
||||
uint typeId,
|
||||
@@ -185,7 +185,7 @@ public static class ModifierExtensions
|
||||
/// </summary>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="uniqueId">The unique ID of the <see cref="BaseModifier"/>.</param>
|
||||
/// <returns>True if the <see cref="PlayerControl"/> has the <see cref="BaseModifier"/>, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="PlayerControl"/> has the <see cref="BaseModifier"/>, <see langword="false"/> otherwise.</returns>
|
||||
public static bool HasModifier(this PlayerControl player, Guid uniqueId)
|
||||
{
|
||||
return player.GetModifierComponent().HasModifier(uniqueId);
|
||||
@@ -219,10 +219,10 @@ public static class ModifierExtensions
|
||||
/// Tries to get a <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="modifier">The <typeparamref name="T"/> or null.</param>
|
||||
/// <param name="modifier">The <typeparamref name="T"/> or <see langword="null"/>.</param>
|
||||
/// <param name="predicate">The predicate to check the <typeparamref name="T"/> by.</param>
|
||||
/// <typeparam name="T">The Type of the <see cref="BaseModifier"/>.</typeparam>
|
||||
/// <returns>True if the <typeparamref name="T"/> was found, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <typeparamref name="T"/> was found, <see langword="false"/> otherwise.</returns>
|
||||
public static bool TryGetModifier<T>(this PlayerControl player, [NotNullWhen(true)] out T? modifier, Func<T, bool>? predicate = null) where T : BaseModifier
|
||||
{
|
||||
return player.GetModifierComponent().TryGetModifier(out modifier, predicate);
|
||||
@@ -233,9 +233,9 @@ public static class ModifierExtensions
|
||||
/// </summary>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="type">The modifier type.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or null.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or <see langword="null"/>.</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/> by.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> was found, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> was found, <see langword="false"/> otherwise.</returns>
|
||||
public static bool TryGetModifier(this PlayerControl player, Type type, [NotNullWhen(true)] out BaseModifier? modifier, Func<BaseModifier, bool>? predicate = null)
|
||||
{
|
||||
return player.GetModifierComponent().TryGetModifier(type, out modifier, predicate);
|
||||
@@ -246,9 +246,9 @@ public static class ModifierExtensions
|
||||
/// </summary>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="id">The <see cref="BaseModifier"/> type ID.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or null.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or <see langword="null"/>.</param>
|
||||
/// <param name="predicate">The predicate to check the <see cref="BaseModifier"/> by.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> was found, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> was found, <see langword="false"/> otherwise.</returns>
|
||||
public static bool TryGetModifier(this PlayerControl player, uint id, [NotNullWhen(true)] out BaseModifier? modifier, Func<BaseModifier, bool>? predicate = null)
|
||||
{
|
||||
return player.GetModifierComponent().TryGetModifier(id, out modifier, predicate);
|
||||
@@ -259,8 +259,8 @@ public static class ModifierExtensions
|
||||
/// </summary>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="modifierGuid">The <see cref="BaseModifier"/> unique ID.</param>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or null.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> was found, false otherwise.</returns>
|
||||
/// <param name="modifier">The <see cref="BaseModifier"/> or <see langword="null"/>.</param>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> was found, <see langword="false"/> otherwise.</returns>
|
||||
public static bool TryGetModifier(this PlayerControl player, Guid modifierGuid, [NotNullWhen(true)] out BaseModifier? modifier)
|
||||
{
|
||||
return player.GetModifierComponent().TryGetModifier(modifierGuid, out modifier);
|
||||
@@ -272,7 +272,7 @@ public static class ModifierExtensions
|
||||
/// <typeparam name="T">The type of the <see cref="BaseModifier"/>.</typeparam>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="predicate">Optional predicate to filter the <typeparamref name="T"/>s.</param>
|
||||
/// <returns>The <typeparamref name="T"/> if found, null otherwise.</returns>
|
||||
/// <returns>The <typeparamref name="T"/> if found, <see langword="null"/> otherwise.</returns>
|
||||
public static T? GetModifier<T>(this PlayerControl player, Func<T, bool>? predicate = null) where T : BaseModifier
|
||||
{
|
||||
return player.GetModifierComponent().GetModifier(predicate);
|
||||
@@ -284,7 +284,7 @@ public static class ModifierExtensions
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="type">The type of the modifier.</param>
|
||||
/// <param name="predicate">Optional predicate to filter the <see cref="BaseModifier"/>s.</param>
|
||||
/// <returns>The <see cref="BaseModifier"/> if found, null otherwise.</returns>
|
||||
/// <returns>The <see cref="BaseModifier"/> if found, <see langword="null"/> otherwise.</returns>
|
||||
public static BaseModifier? GetModifier(
|
||||
this PlayerControl player,
|
||||
Type type,
|
||||
@@ -299,7 +299,7 @@ public static class ModifierExtensions
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="typeId">The type ID of the <see cref="BaseModifier"/>.</param>
|
||||
/// <param name="predicate">Optional predicate to filter the <see cref="BaseModifier"/>s.</param>
|
||||
/// <returns>The <see cref="BaseModifier"/> if found, null otherwise.</returns>
|
||||
/// <returns>The <see cref="BaseModifier"/> if found, <see langword="null"/> otherwise.</returns>
|
||||
public static BaseModifier? GetModifier(
|
||||
this PlayerControl player,
|
||||
uint typeId,
|
||||
@@ -313,7 +313,7 @@ public static class ModifierExtensions
|
||||
/// </summary>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> instance.</param>
|
||||
/// <param name="uniqueId">The GUID of the <see cref="BaseModifier"/>.</param>
|
||||
/// <returns>The <see cref="BaseModifier"/> if found, null otherwise.</returns>
|
||||
/// <returns>The <see cref="BaseModifier"/> if found, <see langword="null"/> otherwise.</returns>
|
||||
public static BaseModifier? GetModifier(
|
||||
this PlayerControl player,
|
||||
Guid uniqueId)
|
||||
|
||||
@@ -30,19 +30,19 @@ public abstract class GameModifier : BaseModifier
|
||||
/// Determines whether the modifier is valid on a role.
|
||||
/// </summary>
|
||||
/// <param name="role">The role to be checked.</param>
|
||||
/// <returns>True if the modifier is valid on the role, otherwise false.</returns>
|
||||
/// <returns><see langword="true"/> if the modifier is valid on the role, otherwise <see langword="false"/>.</returns>
|
||||
public virtual bool IsModifierValidOn(RoleBehaviour role) => true;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the player won the game with this modifier. The modifier with the highest priority will override other modifiers.
|
||||
/// </summary>
|
||||
/// <param name="reason">The reason why the game ended.</param>
|
||||
/// <returns>True if the player won, false if they lost. Return null to use the player's default win condition.</returns>
|
||||
/// <returns><see langword="true"/> if the player won, <see langword="false"/> if they lost. Return <see langword="null"/> to use the player's default win condition.</returns>
|
||||
public virtual bool? DidWin(GameOverReason reason) => null;
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the modifier can spawn in general, accounting for gamemodes and everything else.
|
||||
/// </summary>
|
||||
/// <returns>True if the modifier is able to spawn, otherwise false.</returns>
|
||||
/// <returns><see langword="true"/> if the modifier is able to spawn, otherwise <see langword="false"/>.</returns>
|
||||
public virtual bool CanSpawnOnCurrentMode() => !GameManager.Instance.IsHideAndSeek();
|
||||
}
|
||||
@@ -20,7 +20,7 @@ public static class SettingPatches
|
||||
/// <param name="__instance">The <see cref="FloatGameSetting"/> instance.</param>
|
||||
/// <param name="__result">The result of the <see cref="FloatGameSetting.GetValueString"/> method.</param>
|
||||
/// <param name="value">The <see langword="float"/> value.</param>
|
||||
/// <returns>False to skip original method.</returns>
|
||||
/// <returns><see langword="false"/> to skip original method.</returns>
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(FloatGameSetting), nameof(FloatGameSetting.GetValueString))]
|
||||
public static bool ValueStringPatch(
|
||||
|
||||
@@ -32,7 +32,7 @@ public static class RoleOptionsCollectionPatch
|
||||
/// <summary>
|
||||
/// Set the role chance for custom Launchpad roles based on config.
|
||||
/// </summary>
|
||||
/// <returns>Return false to skip original method, true to not.</returns>
|
||||
/// <returns>Return <see langword="false"/> to skip original method, <see langword="true"/> to not.</returns>
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(RoleOptionsCollectionV10.GetChancePerGame))]
|
||||
public static bool GetChancePrefix(RoleTypes role, ref int __result)
|
||||
@@ -62,7 +62,7 @@ public static class RoleOptionsCollectionPatch
|
||||
/// <summary>
|
||||
/// Set the amount for custom Launchpad roles based on config.
|
||||
/// </summary>
|
||||
/// <returns>Return false to skip original method, true to not.</returns>
|
||||
/// <returns>Return <see langword="false"/> to skip original method, <see langword="true"/> to not.</returns>
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(RoleOptionsCollectionV10.GetNumPerGame))]
|
||||
public static bool GetNumPrefix(RoleTypes role, ref int __result)
|
||||
|
||||
@@ -144,7 +144,7 @@ public record struct CustomRoleConfiguration
|
||||
public string FreeplayFolder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the outline <see cref="Color"/> for the <see cref="KillButton"/> if <see cref="UseVanillaKillButton"/> is true.
|
||||
/// Gets or sets the outline <see cref="Color"/> for the <see cref="KillButton"/> if <see cref="UseVanillaKillButton"/> is <see langword="true"/>.
|
||||
/// </summary>
|
||||
public Color KillButtonOutlineColor { get; set; }
|
||||
|
||||
|
||||
@@ -207,7 +207,7 @@ public static class CustomRoleManager
|
||||
/// </summary>
|
||||
/// <param name="roleType">The <see cref="RoleTypes"/> <see langword="enum"/>.</param>
|
||||
/// <param name="result">The <see cref="ICustomRole"/> result.</param>
|
||||
/// <returns>True if the role was found.</returns>
|
||||
/// <returns><see langword="true"/> if the role was found.</returns>
|
||||
public static bool GetCustomRoleBehaviour(RoleTypes roleType, out ICustomRole? result)
|
||||
{
|
||||
CustomRoles.TryGetValue((ushort)roleType, out var temp);
|
||||
|
||||
@@ -18,7 +18,7 @@ public static class CustomRoleUtils
|
||||
/// Determines whether the specified <see cref="RoleBehaviour"/> can spawn in general, accounting for gamemodes and everything else.
|
||||
/// </summary>
|
||||
/// <param name="role">The <see cref="RoleBehaviour"/> you would like to check for.</param>
|
||||
/// <returns>True if the <see cref="RoleBehaviour"/> is able to spawn, otherwise false.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="RoleBehaviour"/> is able to spawn, otherwise <see langword="false"/>.</returns>
|
||||
public static bool CanSpawnOnCurrentMode(RoleBehaviour role)
|
||||
{
|
||||
if (role is ICustomRole custom)
|
||||
@@ -125,7 +125,7 @@ public static class CustomRoleUtils
|
||||
/// Determines if a <see cref="RoleBehaviour"/> is a custom role or not.
|
||||
/// </summary>
|
||||
/// <param name="role">The <see cref="RoleBehaviour"/> to check.</param>
|
||||
/// <returns>True if the <see cref="RoleBehaviour"/> is a custom role, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="RoleBehaviour"/> is a custom role, <see langword="false"/> otherwise.</returns>
|
||||
public static bool IsCustomRole(this RoleBehaviour role)
|
||||
{
|
||||
return CustomRoleManager.CustomRoles.ContainsKey((ushort)role.Role);
|
||||
|
||||
@@ -200,7 +200,7 @@ public interface ICustomRole : IOptionable
|
||||
/// </summary>
|
||||
/// <param name="instance">The intro cutscene instance.</param>
|
||||
/// <param name="yourTeam">The reference to the list of player in the team.</param>
|
||||
/// <returns>True to use the original team intro code, false to skip.</returns>
|
||||
/// <returns><see langword="true"/> to use the original team intro code, <see langword="false"/> to skip.</returns>
|
||||
public virtual bool SetupIntroTeam(IntroCutscene instance, ref Il2CppSystem.Collections.Generic.List<PlayerControl> yourTeam)
|
||||
{
|
||||
if (Team == ModdedRoleTeams.Custom)
|
||||
@@ -216,10 +216,10 @@ public interface ICustomRole : IOptionable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a custom ejection message for the role. Return null to use the default message.
|
||||
/// Gets a custom ejection message for the role. Return <see langword="null"/> to use the default message.
|
||||
/// </summary>
|
||||
/// <param name="player">The NetworkedPlayerInfo object for this player.</param>
|
||||
/// <returns>A string with a custom ejection message or null.</returns>
|
||||
/// <returns>A string with a custom ejection message or <see langword="null"/>.</returns>
|
||||
string? GetCustomEjectionMessage(NetworkedPlayerInfo player)
|
||||
{
|
||||
return Team == ModdedRoleTeams.Impostor ? $"{player.PlayerName} was The {RoleName}" : null;
|
||||
@@ -235,7 +235,7 @@ public interface ICustomRole : IOptionable
|
||||
/// Determine whether a given <see cref="BaseModifier"/> can be applied to this role.
|
||||
/// </summary>
|
||||
/// <param name="modifier">The modifier to be tested.</param>
|
||||
/// <returns>True if the <see cref="BaseModifier"/> is valid on this role, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="BaseModifier"/> is valid on this role, <see langword="false"/> otherwise.</returns>
|
||||
bool IsModifierApplicable(BaseModifier modifier)
|
||||
{
|
||||
return true;
|
||||
@@ -244,7 +244,7 @@ public interface ICustomRole : IOptionable
|
||||
/// <summary>
|
||||
/// Determines whether the role can spawn in general, accounting for gamemodes and everything else.
|
||||
/// </summary>
|
||||
/// <returns>True if the role is able to spawn, otherwise false.</returns>
|
||||
/// <returns><see langword="true"/> if the role is able to spawn, otherwise <see langword="false"/>.</returns>
|
||||
public virtual bool CanSpawnOnCurrentMode() => !GameManager.Instance.IsHideAndSeek();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -175,7 +175,7 @@ public static class Extensions
|
||||
/// Checks if a <see cref="PlayerControl"/> is the game's host.
|
||||
/// </summary>
|
||||
/// <param name="playerControl">The <see cref="PlayerControl"/> you're checking for.</param>
|
||||
/// <returns>If the player is the host, true, else false.</returns>
|
||||
/// <returns>If the player is the host, <see langword="true"/>, else <see langword="false"/>.</returns>
|
||||
public static bool IsHost(this PlayerControl playerControl)
|
||||
{
|
||||
return TutorialManager.InstanceExists || AmongUsClient.Instance.HostId == playerControl.OwnerId;
|
||||
@@ -185,7 +185,7 @@ public static class Extensions
|
||||
/// Checks if a <see cref="PlayerControl"/> is protected by a Guardian Angel.
|
||||
/// </summary>
|
||||
/// <param name="playerControl">The <see cref="PlayerControl"/> you're checking for.</param>
|
||||
/// <returns>If the player is protected, true, else false.</returns>
|
||||
/// <returns>If the player is protected, <see langword="true"/>, else <see langword="false"/>.</returns>
|
||||
public static bool ProtectedByGa(this PlayerControl playerControl)
|
||||
{
|
||||
return playerControl.protectedByGuardianId > -1;
|
||||
@@ -213,7 +213,7 @@ public static class Extensions
|
||||
/// Determines if a <see langword="float"/> is an integer.
|
||||
/// </summary>
|
||||
/// <param name="number">The <see langword="float"/> number.</param>
|
||||
/// <returns>True if the <see langword="float"/> is an integer, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see langword="float"/> is an integer, <see langword="false"/> otherwise.</returns>
|
||||
public static bool IsInteger(this float number)
|
||||
{
|
||||
return Mathf.Approximately(number, Mathf.Round(number));
|
||||
@@ -228,7 +228,7 @@ public static class Extensions
|
||||
/// Gets the <see cref="PlayerVoteData"/> of a <see cref="PlayerControl"/>.
|
||||
/// </summary>
|
||||
/// <param name="player">The <see cref="PlayerControl"/> object.</param>
|
||||
/// <returns>A <see cref="PlayerVoteData"/> if there is one, null otherwise.</returns>
|
||||
/// <returns>A <see cref="PlayerVoteData"/> if there is one, <see langword="null"/> otherwise.</returns>
|
||||
public static PlayerVoteData GetVoteData(this PlayerControl player)
|
||||
{
|
||||
if (VoteDataComponents.TryGetValue(player, out var component))
|
||||
@@ -379,7 +379,7 @@ public static class Extensions
|
||||
/// Checks if a type is static.
|
||||
/// </summary>
|
||||
/// <param name="type">The type being checked.</param>
|
||||
/// <returns>True if the type is static, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the type is static, <see langword="false"/> otherwise.</returns>
|
||||
public static bool IsStatic(this Type type)
|
||||
{
|
||||
return type is { IsClass: true, IsAbstract: true, IsSealed: true };
|
||||
@@ -460,7 +460,7 @@ public static class Extensions
|
||||
/// Determines if a given <see cref="OptionBehaviour"/> is for a custom option.
|
||||
/// </summary>
|
||||
/// <param name="optionBehaviour">The <see cref="OptionBehaviour"/> to be tested.</param>
|
||||
/// <returns>True if the <see cref="OptionBehaviour"/> is for a custom options, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the <see cref="OptionBehaviour"/> is for a custom options, <see langword="false"/> otherwise.</returns>
|
||||
public static bool IsCustom(this OptionBehaviour optionBehaviour)
|
||||
{
|
||||
return ModdedOptionsManager.ModdedOptions.Values.Any(
|
||||
@@ -514,7 +514,7 @@ public static class Extensions
|
||||
/// </summary>
|
||||
/// <param name="playerControl">The <see cref="PlayerControl"/> object.</param>
|
||||
/// <param name="radius">The radius to search within.</param>
|
||||
/// <returns>The <see cref="DeadBody"/> if it is found, or null there is none within the radius.</returns>
|
||||
/// <returns>The <see cref="DeadBody"/> if it is found, or <see langword="null"/> there is none within the radius.</returns>
|
||||
public static DeadBody? GetNearestDeadBody(this PlayerControl playerControl, float radius)
|
||||
{
|
||||
return Helpers
|
||||
@@ -531,7 +531,7 @@ public static class Extensions
|
||||
/// <param name="colliderTag">An optional collider tag.</param>
|
||||
/// <param name="predicate">Optional predicate to test if the <typeparamref name="T"/> is valid.</param>
|
||||
/// <typeparam name="T">The type of the object.</typeparam>
|
||||
/// <returns>The <typeparamref name="T"/> if it was found, or null if there is none within the radius.</returns>
|
||||
/// <returns>The <typeparamref name="T"/> if it was found, or <see langword="null"/> if there is none within the radius.</returns>
|
||||
public static T? GetNearestObjectOfType<T>(
|
||||
this PlayerControl playerControl,
|
||||
float radius,
|
||||
@@ -552,7 +552,7 @@ public static class Extensions
|
||||
/// <param name="ignoreColliders">Whether colliders should be ignored when searching.</param>
|
||||
/// <param name="includeGhosts">Determines if Ghosts are included.</param>
|
||||
/// <param name="predicate">Optional predicate to test if the <see cref="PlayerControl"/> is valid.</param>
|
||||
/// <returns>The closest <see cref="PlayerControl"/> if there is one, false otherwise.</returns>
|
||||
/// <returns>The closest <see cref="PlayerControl"/> if there is one, <see langword="false"/> otherwise.</returns>
|
||||
public static PlayerControl? GetClosestPlayer(
|
||||
this PlayerControl playerControl,
|
||||
bool includeImpostors,
|
||||
|
||||
@@ -129,7 +129,7 @@ public static class Helpers
|
||||
/// Determines whether a given probability check succeeds.
|
||||
/// </summary>
|
||||
/// <param name="probability">An integer value representing the success probability (0-100).</param>
|
||||
/// <returns>True if the number falls in the range, false if not.</returns>
|
||||
/// <returns><see langword="true"/> if the number falls in the range, <see langword="false"/> if not.</returns>
|
||||
public static bool CheckChance(int probability)
|
||||
{
|
||||
switch (probability)
|
||||
@@ -459,7 +459,7 @@ public static class Helpers
|
||||
/// Gets a <see cref="DeadBody"/> by its parent ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The player ID.</param>
|
||||
/// <returns>A <see cref="DeadBody"/> or null if its not found.</returns>
|
||||
/// <returns>A <see cref="DeadBody"/> or <see langword="null"/> if its not found.</returns>
|
||||
public static DeadBody? GetBodyById(byte id)
|
||||
{
|
||||
return Object.FindObjectsOfType<DeadBody>().FirstOrDefault(body => body.ParentId == id);
|
||||
|
||||
@@ -48,7 +48,7 @@ public class PlayerVoteData(nint cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// Returns whether the owner has voted for the specified player.
|
||||
/// </summary>
|
||||
/// <param name="playerId">The target's playerId.</param>
|
||||
/// <returns>True if the owner voted for the specified player, false otherwise.</returns>
|
||||
/// <returns><see langword="true"/> if the owner voted for the specified player, <see langword="false"/> otherwise.</returns>
|
||||
public bool VotedFor(byte playerId)
|
||||
{
|
||||
return Votes.Exists(x => x.Suspect == playerId);
|
||||
|
||||
@@ -17,11 +17,11 @@ public static class VotingUtils
|
||||
private const byte SkipVoteId = 253;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the exiled player from the list of <see cref="CustomVote"/>s. Returns null if no player is to be exiled.
|
||||
/// Gets the exiled player from the list of <see cref="CustomVote"/>s. Returns <see langword="null"/> if no player is to be exiled.
|
||||
/// </summary>
|
||||
/// <param name="votes">>The list of <see cref="CustomVote"/>s to check.</param>
|
||||
/// <param name="isTie">Whether the vote is a tie.</param>
|
||||
/// <returns>The player to be exiled. Will be null if no player is to be exiled.</returns>
|
||||
/// <returns>The player to be exiled. Will be <see langword="null"/> if no player is to be exiled.</returns>
|
||||
public static NetworkedPlayerInfo? GetExiled(List<CustomVote> votes, out bool isTie)
|
||||
{
|
||||
var max = CalculateNumVotes(votes).MaxPair(out var tie);
|
||||
|
||||
Reference in new issue
Block a user