WeightedRandomEntityPrototype.cs 625 B

1234567891011121314151617
  1. using Robust.Shared.Prototypes;
  2. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Dictionary;
  3. namespace Content.Shared.Random;
  4. /// <summary>
  5. /// Linter-friendly version of weightedRandom for Entity prototypes.
  6. /// </summary>
  7. [Prototype]
  8. public sealed partial class WeightedRandomEntityPrototype : IWeightedRandomPrototype
  9. {
  10. [IdDataField]
  11. public string ID { get; private set; } = default!;
  12. [DataField("weights", customTypeSerializer: typeof(PrototypeIdDictionarySerializer<float, EntityPrototype>))]
  13. public Dictionary<string, float> Weights { get; private set; } = new();
  14. }