mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Merge branch 'master' into dev
This commit is contained in:
commit
d89bce6956
2 files changed
+26
-1
No files matched your search
@@ -287,7 +287,7 @@ public static class CustomMurderRpc
|
||||
source.CurrentOutfitType == PlayerOutfitType.Shapeshifted,
|
||||
source.shapeshiftTargetPlayerId,
|
||||
target.PlayerId);
|
||||
source.MyPhysics.StartCoroutine(source.KillAnimations.Random()?.CoPerformCustomKill(source, target, createDeadBody, teleportMurderer));
|
||||
source.MyPhysics.StartCoroutine(source.KillAnimations.RandomSnapshot().CoPerformCustomKill(source, target, createDeadBody, teleportMurderer));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -132,6 +132,31 @@ public static class Extensions
|
||||
button.SetCooldownFill(num);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a random element from the specified sequence.
|
||||
/// </summary>
|
||||
/// <param name="input">
|
||||
/// The sequence to select an element from.
|
||||
/// </param>
|
||||
/// <typeparam name="T">
|
||||
/// The type of elements in the sequence.
|
||||
/// </typeparam>
|
||||
/// <returns>
|
||||
/// A randomly selected element from <paramref name="input"/>.
|
||||
/// </returns>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown when <paramref name="input"/> is empty.
|
||||
/// </exception>
|
||||
public static T RandomSnapshot<T>(this IEnumerable<T> input)
|
||||
{
|
||||
var list = input.ToList();
|
||||
|
||||
if (list.Count == 0)
|
||||
throw new InvalidOperationException("Cannot get random element from an empty collection.");
|
||||
|
||||
return list[UnityEngine.Random.Range(0, list.Count)];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a PlayerControl from their PlayerVoteArea in a meeting.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user