Faction Test 100.4.0.0

This commit is contained in:
Markus Isberg
2022-11-14 18:28:28 +02:00
parent 87426b68b2
commit c772b61fc1
412 changed files with 16984 additions and 5530 deletions
@@ -82,7 +82,13 @@ namespace Barotrauma.Extensions
return count == 0 ? default : source.ElementAt(Rand.Range(0, count, Rand.RandSync.Unsynced));
}
}
public static T GetRandom<T>(this IEnumerable<T> source, Random rand)
where T : PrefabWithUintIdentifier
{
return source.OrderBy(p => p.UintIdentifier).ToArray().GetRandom(rand);
}
public static T GetRandom<T>(this IEnumerable<T> source, Rand.RandSync randSync)
where T : PrefabWithUintIdentifier
{
@@ -218,6 +224,8 @@ namespace Barotrauma.Extensions
return new Dictionary<TKey, TValue>(immutableDictionary);
}
public static NetCollection<T> ToNetCollection<T>(this IEnumerable<T> enumerable) => new NetCollection<T>(enumerable.ToImmutableArray());
/// <summary>
/// Returns whether a given collection has at least a certain amount
/// of elements for which the predicate returns true.