RandomSpawnsLoot.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. using Content.Shared.Random;
  2. using Robust.Shared.Prototypes;
  3. using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
  4. namespace Content.Shared.Procedural.Loot;
  5. /// <summary>
  6. /// Randomly places loot in free areas inside the dungeon.
  7. /// </summary>
  8. public sealed partial class RandomSpawnsLoot : IDungeonLoot
  9. {
  10. [ViewVariables(VVAccess.ReadWrite), DataField("entries", required: true)]
  11. public List<RandomSpawnLootEntry> Entries = new();
  12. }
  13. [DataDefinition]
  14. public partial record struct RandomSpawnLootEntry() : IBudgetEntry
  15. {
  16. [ViewVariables(VVAccess.ReadWrite), DataField("proto", required: true, customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
  17. public string Proto { get; set; } = string.Empty;
  18. /// <summary>
  19. /// Cost for this loot to spawn.
  20. /// </summary>
  21. [ViewVariables(VVAccess.ReadWrite), DataField("cost")]
  22. public float Cost { get; set; } = 1f;
  23. /// <summary>
  24. /// Unit probability for this entry. Weighted against the entire table.
  25. /// </summary>
  26. [ViewVariables(VVAccess.ReadWrite), DataField("prob")]
  27. public float Prob { get; set; } = 1f;
  28. }