Add linter-friendly WeightedRandom prototypes (#18729)
This commit is contained in:
17
Content.Shared/Random/WeightedRandomEntityPrototype.cs
Normal file
17
Content.Shared/Random/WeightedRandomEntityPrototype.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
|
||||
|
||||
namespace Content.Shared.Random;
|
||||
|
||||
/// <summary>
|
||||
/// Linter-friendly version of weightedRandom for Entity prototypes.
|
||||
/// </summary>
|
||||
[Prototype("weightedRandomEntity")]
|
||||
public sealed class WeightedRandomEntityPrototype : IWeightedRandomPrototype
|
||||
{
|
||||
[IdDataField]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
[DataField("weights", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, EntityPrototype>))]
|
||||
public Dictionary<string, float> Weights { get; } = new();
|
||||
}
|
||||
Reference in New Issue
Block a user